[Pkg-utopia-maintainers] Bug#648810: Bug#648810: udisks-daemon: regression from squeeze: partitions on USB disks are not scanned by default

Michael Biebl biebl at debian.org
Tue Nov 15 12:05:09 UTC 2011


On 15.11.2011 12:32, Bjørn Mork wrote:
> Michael Biebl <biebl at debian.org> writes:
> 
>> I can't see the usability regression. 
> 
> OK. I certainly don't have the full picture here, and this might be a
> bug in some other part of the puzzle.  If you can provide any pointers
> where to look further, then I'd appreciate that.
> 
> But the observed fact on my laptop is that this used to work out of the
> box, and it doesn't anymore after upgrading to wheezy.  That's why I
> labelled it "regression".

What exactly used to work? udisks-daemon has always been started on
demand so I fail to see the regression wrt udisks.

>> If no one is using the udisks service, why should it be started?
> 
> If I am right assuming that the task "scan for partitions and inform the
> kernel" is delegated to udisks,

Nope, that's not how it works. udisks-daemon does not do the partition
probing and inform the kernel.

 then it looks to me as if udisks-daemon
> need to run regardless of whether anything uses the udisks service.  It
> is then not just the dbus interface that depends on udisks-daemon, but
> anything using the kernel interfaces.
> 
> If my assumption is wrong, then I would appreciate a hint as to where to
> look for this.  Maybe udev?

Most likely. As said, the device and partition probing is done by udev
and its helpers. See /lib/udev/rules.d. The results of running those
probers is stored in the udev db.

> My question is really "what service is responsible for calling the
> BLKRRPART ioctl whenever a new disk is detected?"

$ grep blkid /lib/udev/rules.d/*
/lib/udev/rules.d/60-persistent-storage-dm.rules:IMPORT{program}="/sbin/blkid
-o udev -p $tempnode"
/lib/udev/rules.d/60-persistent-storage.rules:
IMPORT{program}="/sbin/blkid -o udev -p -u noraid -O
$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode"
/lib/udev/rules.d/60-persistent-storage.rules:
IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode"
/lib/udev/rules.d/60-persistent-storage.rules:KERNEL!="sr*",
IMPORT{program}="/sbin/blkid -o udev -p $tempnode"

There are also specializied probers for md and lvm devices.

>> Btw, the device probing is done by udev and its helpers and not udisks
>> itself, ie. if you attach a usb device, and then later start
>> udisks-daemon, your statement that those partitions wouldn't be detected
>> is simply not true.
> 
> The disk is probed and detected regardless of udisks-daemon, but not
> its partitions.

As said, probing the devices/partitions is done by udev, and
udisks-daemon is more or less a D-Bus interface to the udev database.

> 
>> Can you provide further information what kind of problem you are having?
> 
> Plugging in my phone (which provides a partitioned hard drive and a CD
> over USB), without running udisks-daemon:
> 
> bjorn at nemi:~$ ps aux|grep udisk
> bjorn    12482  0.0  0.0   8920   852 pts/6    S+   12:04   0:00 grep udisk
> 
> 
> nemi:/home/bjorn# udevadm monitor --kernel --udev
> monitor will print the received events for:
> UDEV - the event which udev sends out after rule processing
> KERNEL - the kernel uevent
> 
> 
> 
> KERNEL[12802.743473] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1 (usb)
> KERNEL[12802.744379] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0 (usb)
> KERNEL[12802.746485] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10 (scsi)
> KERNEL[12802.746536] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/scsi_host/host10 (scsi_host)
> UDEV  [12802.756836] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1 (usb)
> UDEV  [12802.767990] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0 (usb)
> UDEV  [12802.768837] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10 (scsi)
> UDEV  [12802.769338] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/scsi_host/host10 (scsi_host)
> KERNEL[12803.749427] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0 (scsi)
> KERNEL[12803.749488] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:0 (scsi)
> KERNEL[12803.749584] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:0/scsi_disk/10:0:0:0 (scsi_disk)
> KERNEL[12803.749758] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:0/scsi_device/10:0:0:0 (scsi_device)
> KERNEL[12803.750145] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:0/scsi_generic/sg2 (scsi_generic)
> UDEV  [12803.750196] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0 (scsi)
> KERNEL[12803.750528] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:0/bsg/10:0:0:0 (bsg)
> KERNEL[12803.750733] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:1 (scsi)
> KERNEL[12803.752976] add      /devices/virtual/bdi/8:16 (bdi)
> KERNEL[12803.753888] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:0/block/sdb (block)
> KERNEL[12803.757430] change   /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:0/block/sdb (block)
> KERNEL[12803.759888] add      /devices/virtual/bdi/11:1 (bdi)
> KERNEL[12803.760836] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:1/block/sr1 (block)
> KERNEL[12803.761293] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:1/scsi_device/10:0:0:1 (scsi_device)
> KERNEL[12803.761938] change   /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:1/block/sr1 (block)
> KERNEL[12803.762624] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:1/scsi_generic/sg3 (scsi_generic)
> KERNEL[12803.762901] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:1/bsg/10:0:0:1 (bsg)
> UDEV  [12803.768524] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:1 (scsi)
> UDEV  [12803.769526] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:0 (scsi)
> UDEV  [12803.771572] add      /devices/virtual/bdi/8:16 (bdi)
> UDEV  [12803.771605] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:1/scsi_device/10:0:0:1 (scsi_device)
> UDEV  [12803.771625] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:0/scsi_disk/10:0:0:0 (scsi_disk)
> UDEV  [12803.772237] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:1/bsg/10:0:0:1 (bsg)
> UDEV  [12803.773005] add      /devices/virtual/bdi/11:1 (bdi)
> UDEV  [12803.776060] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:0/scsi_device/10:0:0:0 (scsi_device)
> UDEV  [12803.777941] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:0/scsi_generic/sg2 (scsi_generic)
> UDEV  [12803.779058] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:0/bsg/10:0:0:0 (bsg)
> UDEV  [12803.780405] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:1/scsi_generic/sg3 (scsi_generic)
> UDEV  [12803.791858] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:1/block/sr1 (block)
> UDEV  [12803.814886] change   /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:1/block/sr1 (block)
> UDEV  [12803.851827] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:0/block/sdb (block)
> UDEV  [12803.865867] change   /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host10/target10:0:0/10:0:0:0/block/sdb (block)
> 
> 
> 
> (Note that the events are repeated because the phone reenumerates after
> selecting "hard disk mode".  Please ignore this)
> 
> As you can see, no partitions on sdb there and neither sdb nor its
> partitions are detected by the kernel:
> 
> bjorn at nemi:~$ cat /proc/partitions 
> major minor  #blocks  name
> 
>    8        0  125034840 sda
>    8        1     129724 sda1
>    8        2  124904988 sda2
>  254        0  124903960 dm-0
>  254        1  119668736 dm-1
>  254        2    5234688 dm-2
> 
> 
> I see that udev has assigned the device file to the "floppy" group
> though...  That might be the real cause for my problems?  Didn't notice
> this before:
> 
> 
> bjorn at nemi:~$ ls -l /dev/sdb*
> brw-rw---- 1 root floppy 8, 16 Nov 15 12:07 /dev/sdb

> Running udisks --dump at this point will *not* find any partitions
> either (as expected):

[..]

> But running udisks has the side effect that udisks-daemon is started,
> and that will trigger these interesting events:
> 
> KERNEL[13123.172428] change   /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host11/target11:0:0/11:0:0:0/block/sdb (block)
> KERNEL[13123.187854] change   /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host11/target11:0:0/11:0:0:0/block/sdb (block)
> KERNEL[13123.190016] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host11/target11:0:0/11:0:0:0/block/sdb/sdb1 (block)
> UDEV  [13123.286163] change   /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host11/target11:0:0/11:0:0:0/block/sdb (block)
> UDEV  [13123.355741] change   /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host11/target11:0:0/11:0:0:0/block/sdb (block)
> UDEV  [13123.501462] add      /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host11/target11:0:0/11:0:0:0/block/sdb/sdb1 (block)
> 
> bjorn at nemi:~$ ps aux|grep udisk
> root     13167  0.0  0.0 127444  3828 ?        Sl   12:13   0:00 /usr/lib/udisks/udisks-daemon
> root     13168  0.0  0.0  45108   764 ?        S    12:13   0:00 udisks-daemon: polling /dev/sdb
> 
> 
> And now the partition device is of course also there, as expected from
> the above udev output:
> 
> bjorn at nemi:~$ ls -l /dev/sdb*
> brw-rw---- 1 root floppy 8, 16 Nov 15 12:13 /dev/sdb
> brw-rw---- 1 root floppy 8, 17 Nov 15 12:13 /dev/sdb1


That sounds like either an issue in udev or the kernel not generating
proper uevents when the device is plugged in.

It sounds like running udisks-daemon triggers a uevent which causes udev
to probe the partition on that device.

Marco, do you have maybe an idea why the partition is not correctly
probed initially?

Bjørn, what does udevadm info --query=all --name=sdb show after you
plugged in your device (and udisks daemon is not running).

If you run "echo change > /sys/block/sdb/uevent", do you partitions show
up? how does the udevadm info look then?

Michael
-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-utopia-maintainers/attachments/20111115/ab1b6d43/attachment.pgp>


More information about the Pkg-utopia-maintainers mailing list