Comment 0 for bug 153768

Revision history for this message
In , Tristan Schmelcher (tschmelcher) wrote :

Hard drives connected by eSATA are hotpluggable from the end-user's perspective, but HAL erroneously considers them to be fixed. This causes problems for users on distros that forbid normal users from mounting fixed drives as a security precaution (e.g., Debian, Ubuntu). Meanwhile, using the same drive as a USB device via an eSATA-to-USB adapter works correctly. Further, manually mounting the eSATA device as root works as correctly.

Steps to reproduce:

1) Obtain a computer with an eSATA port, an eSATA drive, and an eSATA-to-USB adapter.

2) Setup HAL to give your user account the hal-storage-removable-mount permission but not the hal-storage-fixed-mount permission (this is hard-coded in Debian because it does not have PolicyKit yet; see http://people.debian.org/~terpstra/message/20070807.181731.32cacc62.en.html).

3) Plug in the drive via USB and observe that it mounts automatically.

4) Plug in the drive via eSATA and observe that it erroneously fails to mount, giving the following error message:

Cannot mount volume.

Error org.freedesktop.Hal.Device.PermissionDeniedByPolicy.

-> Details

    hal-storage-fixed-mount refused uid 1000

5) Try to open the drive in Nautilus and observe the same error. Try to mount it with gnome-mount as yourself (e.g., "gnome-mount -d /dev/sdb1") and observe the same error.

6) Mount the eSATA drive manually as root (e.g., "sudo gnome-mount -d /dev/sdb1" or "sudo mount /dev/sdb1 /media/disk") and observe that it works and that the drive is accessible.

Expected behaviour:

eSATA drives should be considered to be hotpluggable, and thus the normal user account should be able to successfully mount the eSATA drive (either automatically as in step 4 or manually as in step 5). For an end user who switches from a USB connection to eSATA to get the extra speed (me), the error message is a rude awakening.

I have observed this bug on Debian Etch/Lenny 2.6.18-5 amd64 for each of the following package versions for hal and libhal-storage1:

0.5.8.1-9
0.5.9.1-2
0.5.9.1-4

For the latter two tests, hal-info was 20070618-1. For all three, libhal1 was version 0.5.9.1-2, but I'd imagine the bug is not in libhal.

Some info on my system: it is a Dell XPS M1710 laptop with a Core 2 Duo. The eSATA port actually comes from an eSATA-to-ExpressCard adapter, which requires only the pciehp kernel module (which on my system must be loaded with the option pciehp_force=1).

The output of lshal -m follows.

When inserting via USB:

$ lshal -m

Start monitoring devicelist:
-------------------------------------------------
19:25:10.144: usb_device_152d_2338_7CA0D1820141 added
19:25:10.204: usb_device_152d_2338_7CA0D1820141_if0 added
19:25:10.222: usb_device_152d_2338_7CA0D1820141_usbraw added
19:25:15.164: usb_device_152d_2338_7CA0D1820141_if0_scsi_host added
19:25:15.165: usb_device_152d_2338_7CA0D1820141_if0_scsi_host_scsi_device_lun0 added
19:25:15.195: usb_device_152d_2338_7CA0D1820141_if0_scsi_host_scsi_device_lun0_scsi_generic added
19:25:15.263: storage_serial_WDC_WD32_WD_WCAPD1820141_7CA0D1820141 added
19:25:15.301: volume_uuid_5dae87a8_e207_42f2_85a5_812936842bda added
19:25:15.492: volume_uuid_5dae87a8_e207_42f2_85a5_812936842bda property volume.mount_point = '/media/disk-1'
19:25:15.497: volume_uuid_5dae87a8_e207_42f2_85a5_812936842bda property volume.is_mounted = true

When inserting via eSATA:

$ lshal -m

Start monitoring devicelist:
-------------------------------------------------
19:28:41.331: pci_197b_2360_scsi_host added
19:28:41.333: pci_197b_2360_scsi_host_scsi_device_lun0 added
19:28:41.353: pci_197b_2360_scsi_host_scsi_device_lun0_scsi_generic added
19:28:41.415: storage_serial_SATA_WDC_WD3200KS_00_WD_WCAPD1820141 added
19:28:41.442: volume_uuid_5dae87a8_e207_42f2_85a5_812936842bda added

Viewing the lshal output for that storage ID confirms that it does not realize that the eSATA drive is hotpluggable (see indicated line):

udi = '/org/freedesktop/Hal/devices/storage_serial_SATA_WDC_WD3200KS_00_WD_WCAPD
1820141'
  block.device = '/dev/sdb' (string)
  block.is_volume = false (bool)
  block.major = 8 (0x8) (int)
  block.minor = 16 (0x10) (int)
  block.storage_device = '/org/freedesktop/Hal/devices/storage_serial_SATA_WDC_W
D3200KS_00_WD_WCAPD1820141' (string)
  info.capabilities = {'storage', 'block'} (string list)
  info.category = 'storage' (string)
  info.parent = '/org/freedesktop/Hal/devices/pci_197b_2360_scsi_host_scsi_devic
e_lun0' (string)
  info.product = 'WDC WD3200KS-00P' (string)
  info.udi = '/org/freedesktop/Hal/devices/storage_serial_SATA_WDC_WD3200KS_00_W
D_WCAPD1820141' (string)
  info.vendor = 'ATA' (string)
  linux.hotplug_type = 3 (0x3) (int)
  linux.sysfs_path = '/sys/block/sdb' (string)
  storage.automount_enabled_hint = true (bool)
  storage.bus = 'scsi' (string)
  storage.drive_type = 'disk' (string)
  storage.firmware_version = '21.0' (string)
  storage.hotpluggable = false (bool) <-------------------- WRONG
  storage.lun = 0 (0x0) (int)
  storage.media_check_enabled = false (bool)
  storage.model = 'WDC WD3200KS-00P' (string)
  storage.no_partitions_hint = false (bool)
  storage.originating_device = '/org/freedesktop/Hal/devices/pci_197b_2360_scsi_
host_scsi_device_lun0' (string)
  storage.partitioning_scheme = 'mbr' (string)
  storage.physical_device = '/org/freedesktop/Hal/devices/pci_197b_2360_scsi_hos
t_scsi_device_lun0' (string)
  storage.removable = false (bool)
  storage.removable.media_available = true (bool)
  storage.removable.media_size = 320072933376 (0x4a85d56000) (uint64)
  storage.requires_eject = false (bool)
  storage.serial = 'SATA_WDC_WD3200KS-00_WD-WCAPD1820141' (string)
  storage.size = 320072933376 (0x4a85d56000) (uint64)
  storage.vendor = 'ATA' (string)

Thanks in advance, and good luck! I certainly hope that it does not turn out to be impossible to distinguish between eSATA drives and internal SATA drives ...