Bug 21589

Summary: LUKS volumes not detected properly
Product: hal Reporter: Malte Starostik <m-starostik>
Component: haldAssignee: David Zeuthen (not reading bugmail) <zeuthen>
Status: NEW --- QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Malte Starostik 2009-05-06 02:02:16 UTC
I have some LUKS encrypted volumes, both internal SATA and external USB disks.  Hald detects the presence of the encrypted volumes but not the plaintext volumes when the device mapping is set up.
When I attach the external disk, a "crypto_LUKS" volume appears in dolphin's places bar and I can successfully setup a mapping by entering the passphrase.  But as with the fixed disks that are mounted at boot, the plaintext volume is never detected.
According to the logs the slave device is not found and from a glance at hotplug_event_begin_add_blockdev() in hald/linux/blockdev.c I suspect that this might be caused by the volume.fstype property (= "crypto_LUKS") being set on a fakevolume (whatever that is) and not the actual block device, while the slave device enumeration in hotplug_event_begin_add_blockdev() doesn't consider the fakevolume.

hal version: 0.5.11, same problem applies to 0.5.12rc1
kernel: 2.6.28
distribution: gentoo

Log snippet of one of the devices:
[I] blockdev.c:874: block_add: sysfs_path=/sys/devices/virtual/block/dm-10 dev=/dev/mapper/permanent is_part=0, parent=0x00000000
[I] blockdev.c:915: Looking in /sys/devices/virtual/block/dm-10/slaves for Device Mapper
[I] blockdev.c:926:  /sys/devices/virtual/block/dm-10/slaves/. -> /sys/devices/virtual/block/dm-10/slaves
[I] blockdev.c:958: Couldn't find slave volume in devices
[I] blockdev.c:926:  /sys/devices/virtual/block/dm-10/slaves/.. -> /sys/devices/virtual/block/dm-10
[I] blockdev.c:958: Couldn't find slave volume in devices
[I] blockdev.c:926:  /sys/devices/virtual/block/dm-10/slaves/sdd -> /sys/devices/pci0000:00/0000:00:1f.2/host3/target3:0:0/3:0:0:0/block/sdd
[I] blockdev.c:964: Done looking in /sys/devices/virtual/block/dm-10/slaves
[I] blockdev.c:970: Ignoring hotplug event - no parent
[W] blockdev.c:1473: Not adding device object

relevant lshal output:
udi = '/org/freedesktop/Hal/devices/storage_serial_SATA_ST31500341AS_9VS13VFP'
  block.device = '/dev/sdd'  (string)
  block.is_volume = false  (bool)
  block.major = 8  (0x8)  (int)
  block.minor = 48  (0x30)  (int)
  block.storage_device = '/org/freedesktop/Hal/devices/storage_serial_SATA_ST31500341AS_9VS13VFP'  (string)
  info.capabilities = {'storage', 'block'} (string list)
  info.category = 'storage'  (string)
  info.parent = '/org/freedesktop/Hal/devices/pci_8086_2922_scsi_host_2_scsi_device_lun0'  (string)
  info.product = 'ST31500341AS'  (string)
  info.udi = '/org/freedesktop/Hal/devices/storage_serial_SATA_ST31500341AS_9VS13VFP'  (string)
  info.vendor = 'ATA'  (string)
  linux.hotplug_type = 3  (0x3)  (int)
  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1f.2/host3/target3:0:0/3:0:0:0/block/sdd'  (string)
  storage.automount_enabled_hint = true  (bool)
  storage.bus = 'scsi'  (string)
  storage.drive_type = 'disk'  (string)
  storage.firmware_version = 'CC1H'  (string)
  storage.hotpluggable = false  (bool)
  storage.lun = 0  (0x0)  (int)
  storage.media_check_enabled = false  (bool)
  storage.model = 'ST31500341AS'  (string)
  storage.no_partitions_hint = false  (bool)
  storage.originating_device = '/org/freedesktop/Hal/devices/computer'  (string)
  storage.partitioning_scheme = 'none'  (string)
  storage.removable = false  (bool)
  storage.removable.media_available = true  (bool)
  storage.removable.media_size = 1500301910016  (0x15d50f66000)  (uint64)
  storage.requires_eject = false  (bool)
  storage.serial = 'SATA_ST31500341AS_9VS13VFP'  (string)
  storage.size = 1500301910016  (0x15d50f66000)  (uint64)
  storage.vendor = 'ATA'  (string)
  volume.ignore = true  (bool)

udi = '/org/freedesktop/Hal/devices/volume_uuid_8d3cf090_84ba_424f_acff_0a80118b7f3d'
  block.device = '/dev/sdd'  (string)
  block.is_volume = true  (bool)
  block.major = 8  (0x8)  (int)
  block.minor = 48  (0x30)  (int)
  block.storage_device = '/org/freedesktop/Hal/devices/storage_serial_SATA_ST31500341AS_9VS13VFP'  (string)
  info.capabilities = {'volume', 'block'} (string list)
  info.category = 'volume'  (string)
  info.interfaces = {'org.freedesktop.Hal.Device.Volume.Crypto'} (string list)
  info.parent = '/org/freedesktop/Hal/devices/storage_serial_SATA_ST31500341AS_9VS13VFP'  (string)
  info.product = 'Volume (crypto_LUKS)'  (string)
  info.udi = '/org/freedesktop/Hal/devices/volume_uuid_8d3cf090_84ba_424f_acff_0a80118b7f3d'  (string)
  linux.hotplug_type = 3  (0x3)  (int)
  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1f.2/host3/target3:0:0/3:0:0:0/block/sdd/fakevolume'  (string)
  org.freedesktop.Hal.Device.Volume.Crypto.method_argnames = {'passphrase', ''} (string list)
  org.freedesktop.Hal.Device.Volume.Crypto.method_execpaths = {'hal-luks-setup', 'hal-luks-teardown'} (string list)
  org.freedesktop.Hal.Device.Volume.Crypto.method_names = {'Setup', 'Teardown'} (string list)
  org.freedesktop.Hal.Device.Volume.Crypto.method_signatures = {'s', ''} (string list)
  storage.model = ''  (string)
  volume.block_size = 512  (0x200)  (int)
  volume.fstype = 'crypto_LUKS'  (string)
  volume.fsusage = 'crypto'  (string)
  volume.fsversion = '2'  (string)
  volume.ignore = true  (bool)
  volume.is_disc = false  (bool)
  volume.is_mounted = false  (bool)
  volume.is_mounted_read_only = false  (bool)
  volume.is_partition = false  (bool)
  volume.label = ''  (string)
  volume.linux.is_device_mapper = false  (bool)
  volume.mount_point = ''  (string)
  volume.num_blocks = 2930277168  (0xaea87b30)  (uint64)
  volume.size = 1500301910016  (0x15d50f66000)  (uint64)
  volume.uuid = '8d3cf090-84ba-424f-acff-0a80118b7f3d'  (string)
Comment 1 Malte Starostik 2009-05-07 13:22:01 UTC
As my main concern is with the external HDD, I found a kludge to make it work:

<device>
    <match key="info.udi" string="/org/freedesktop/Hal/devices/storage_serial_XXXXXXXXXXXXX">
      <merge key="volume.fstype" type="string">crypto_LUKS</merge>
    </match>
</device>

This workaround seems to confirm my guess about the fakevolumes getting into the way.  I'm tempted to add a check for that case to the code, but I found no indication of what exactly fakevolumes do and why they're created for basically all of my volumes:

/dev/md0 has an fstab entry (ext3 on /boot) but is not mounted.  A fakevolume is created and neither file system type nor mount point are recognized by hal.

/dev/md1 is a non-LUKS encrypted swap partition.  This is the only device without a fakevolume, yet the corresponding plaintext device /dev/mapper/swap missing (don't know if swap is supposed to be listed).

/dev/md2 is a LUKS encrypted LVM volume.  I know these aren't handled, yet there is a fakevolume

/dev/sdc and /dev/sdd are whole-disk LUKS volumes containing ext3 file systems.  Again, fakevolumes exist, no further info about the corresponding device mapper mappings, file systems or mount points is provided by hal

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.