[Bug 56484] SRU proposal; #56484 hal does not detect non-ATAPI CD-ROM drives

Martin Pitt martin.pitt at ubuntu.com
Tue Sep 19 16:44:20 UTC 2006

Hi Matt,

I propose to fix https://launchpad.net/bugs/56484 in dapper.

Impact: hal does not detect drives whose device file name ends in
numbers; this particularly affects non-ATAPI CD-ROM devices (/dev/sr0)
and floppies (/dev/fd0). (Please look at the bug duplicates for
confirmation that dapper is affected as well). Apparently this worked
fine in breezy. We have a request from the support center to fix this
in Dapper.

Patch: http://librarian.launchpad.net/4313504/16-nonpartitions-ending-

While this is not a nice an general solution for future upstream
versions, it is a very conservative and cautios solution. Hal's
current logic is flawed: if a device ends in numbers, then the code
assumes it's a partition on a drive and takes dirname(drive name) as
the parent sysfs device. However, in the case of e. g. /dev/sr0 (which
is a drive and not a partition), the parent of /sys/block/sr0 is
/sys/block which is not a valid sysfs device, and thus the device is
discarded with 'no parent'. According to Scott James Remnant, sysfs
gurarantees that /sys/block/foo are drives and /sys/block/foo/bar are
partitions, thus the patch just special-cases the flawed logic and
re-sets the 'is_partition' flag if the device name is a direct entry
in /sys/block (as opposed to a subdirectory of a /sys/block/ dir).

Status: Applied in Edgy some weeks ago, tested with appropriate
hardware, no reported regressions.


hal does not detect non-ATAPI CD-ROM drives

More information about the desktop-bugs mailing list