udev deletes and recreates partition devices when the disk is opened r/w

Bug #1655779 reported by Lynn
24
This bug affects 6 people
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Won't Fix
Undecided
Unassigned

Bug Description

Description: Ubuntu 16.04.1 LTS
Release: 16.04

parted: 3.2-15
gparted: 0.25.0-1

Applications that utilized parted/libparted to probe for block device information disable the read only status during the probe.

Example:

Set a block device read only using either hdparm -r1 /dev/sdc* or blockdev --setro /dev/sdc*:
# hdparm -r1 /dev/sdc*

/dev/sdc:
 readonly = 1 (on)

/dev/sdc1:
 readonly = 1 (on)

Run gparted

Check the readonly status with hdparm:
# hdparm -r /dev/sdc*

/dev/sdc:
 readonly = 0 (off)

/dev/sdc1:
 readonly = 0 (off)

The read only status has changed to off. This can be replicated using partprobe:

Set a block device read only using either hdparm -r1 /dev/sdc*:
# hdparm -r1 /dev/sdc*

/dev/sdc:
 readonly = 1 (on)

/dev/sdc1:
 readonly = 1 (on)

Probe the devices using partprobe -s:
# partprobe -s
/dev/sda: msdos partitions 1 2 3
/dev/sdb: gpt partitions 1 2 3 5 4
/dev/sdc: msdos partitions 1

Recheck the read only status:
# hdparm -r /dev/sdc*

/dev/sdc:
 readonly = 0 (off)

/dev/sdc1:
 readonly = 0 (off)

As before the read only status has been switched off. Again, this can be replicated using parted:

Set a block device read only using either hdparm -r1 /dev/sdc*:
# hdparm -r1 /dev/sdc*

/dev/sdc:
 readonly = 1 (on)

/dev/sdc1:
 readonly = 1 (on)

List the partition layout using parted -l:
# parted -l
.
.
Model: WDC WD10 EFRX-68JCSN0 (scsi)
Disk /dev/sdc: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
 1 1049kB 1000GB 1000GB primary ntfs

Recheck the read only status:
# hdparm -r /dev/sdc*

/dev/sdc:
 readonly = 0 (off)

/dev/sdc1:
 readonly = 0 (off)

Revision history for this message
Phillip Susi (psusi) wrote :

I could not reproduce this at first using a loop device, but then I tried scsi_debug. This can be reproduced with a simple dd if=/dev/zero count=0 of=/dev/sda. Parted takes care to not needlessly delete and recreate partition dev nodes when they are not modified, but it appears that there has been a regression in udev/systemd that deletes and recreates all partitions on the disk any time the disk is opened for RW access, thus resetting the RO flag, and also triggering needless update events that cause unity to re-add removed drive icons to the launcher.

affects: parted (Ubuntu) → udev (Ubuntu)
summary: - parted/libparted disables the read only status during the probe
+ udev deletes and recreates partition devices when the disk is opened r/w
Revision history for this message
Phillip Susi (psusi) wrote :

Strange... it appears to be something in persistent-storage.rules, but I can not see what... the only thing I can see that it runs is scsi_id, and running that myself does not produce this effect.

Phillip Susi (psusi)
affects: udev (Ubuntu) → systemd (Ubuntu)
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in systemd (Ubuntu):
status: New → Confirmed
Revision history for this message
Dan Streetman (ddstreet) wrote :

please reopen if this is still an issue

Changed in systemd (Ubuntu):
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.