Opened 19 years ago

Closed 18 years ago

#1640 closed defect (fixed)

Udev rules don't handle multiple CDROM devices correctly

Reported by: Matthew Burgess Owned by: archaic@…
Priority: normal Milestone: 6.2
Component: Book Version: SVN
Severity: normal Keywords:
Cc:

Description (last modified by Jeremy Huntwork)

See the above URL for details. Basically if a system has more than one CDROM drive, only the last one detected will get the /dev/cdrom symlink. In addition to this, we don't appear to handle DVD drives similarly. Do we want to? If so, I'd rather we build the 'cdrom_id' helper and use that to correctly determine drive capabilities (see the gentoo rules in the udev tarball for example usage).

Change History (8)

comment:1 by DJ Lucas, 19 years ago

Personally, I don't think it's LFS's problem. ISTM it's a BLFS issue and the symlink shouldn't be included at all. Before udev/hotplug, it wasn't there, and if I remember right, it was suggested in BLFS way back when. Also, I like the cdsymlinks.sh well enough that I've not yet tried cdrom_id, which means a _choice_ of what to use...isn't choice taboo? ;-)

Just to be complete, here are my rules, config, and results. The optical group is not at all required, but I like to segregate it just a little more than a generic disk group. Without the optical group (would be disk) the second rule for each type below is not needed. BTW I don't use scsi so those are not yet tested, but should work as the IDE ones:

[dj@name1 Gnome-2.12]# cat /etc/udev/rules.d/20-optical-devices.rules

BUS=="ide", KERNEL=="hd[!0-9]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}"

BUS=="ide", KERNEL=="hd[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT=="cdrom", OWNER="root", GROUP="optical", MODE="660", OPTIONS="last_rule"

BUS=="scsi", KERNEL=="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}", OPTIONS="last_rule"

BUS=="scsi", KERNEL=="sr[0-9]*", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT=="cdrom", OWNER="root", GROUP="optical", MODE="660", OPTIONS="last_rule"

BUS=="scsi", KERNEL=="scd[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}", OPTIONS="last_rule"

BUS=="ide", KERNEL=="scd[0-9]*", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT=="cdrom", OWNER="root", GROUP="optical", MODE="660", OPTIONS="last_rule"

* [dj@name1 Gnome-2.12]# cat /etc/udev/cdsymlinks.conf # Configuration file for cdsymlinks OUTPUT="CD CDRW DVD DVDRW" NUMBERED_LINKS=1

* [dj@name1 Gnome-2.12]# ls -l /dev/hd* brw-rw---- 1 root optical 3, 0 Oct 9 19:14 /dev/hda brw-rw---- 1 root optical 3, 64 Oct 9 19:14 /dev/hdb brw-rw---- 1 root disk 33, 0 Oct 9 19:14 /dev/hde brw-rw---- 1 root disk 33, 1 Oct 9 19:14 /dev/hde1 <snip> * [dj@name1 Gnome-2.12]# ls -l /dev/{cd,dvd}* lrwxrwxrwx 1 root root 3 Oct 9 19:14 /dev/cdrom -> hda lrwxrwxrwx 1 root root 3 Oct 9 19:14 /dev/cdrom1 -> hdb lrwxrwxrwx 1 root root 3 Oct 9 19:14 /dev/cdrw -> hda lrwxrwxrwx 1 root root 3 Oct 9 19:14 /dev/cdrw1 -> hdb lrwxrwxrwx 1 root root 3 Oct 9 19:14 /dev/dvd -> hdb lrwxrwxrwx 1 root root 3 Oct 9 19:14 /dev/dvdrw -> hdb

comment:2 by Jeremy Huntwork, 18 years ago

Description: modified (diff)
Milestone: 6.2

comment:3 by Matthew Burgess, 18 years ago

Version: SVNudev_update

comment:4 by archaic@…, 18 years ago

Version: udev_updateSVN

comment:5 by alexander@…, 18 years ago

See http://marc.theaimsgroup.com/?l=linux-hotplug-devel&m=114363313617910&w=2 for a mechanism to create persistent CD symlinks (replacement for the obsolete "%e"). Needs some tweaks to the LFS udev configuration, because the one-file approach to rules doesn't work.

Also note that the current LFS IDE CD-ROM rule is racy (i.e.: sometimes works, sometimes doesn't), and resets all user-specified symlinks. Questions on #lfs-support are rather frequent. Please remove the rule as a stopgap measure.

comment:6 by archaic@…, 18 years ago

Owner: changed from lfs-book@… to archaic@…
Status: newassigned

This is being addressed as part of the udev-090 update. Unless something goes terribly wrong, the update will occur within the next 6 hours or so.

comment:7 by archaic@…, 18 years ago

Just to update, this will take until tomorrow to commit so DJ has time to roll a new bootscript package. The work is done and waiting.

comment:8 by archaic@…, 18 years ago

Resolution: fixed
Status: assignedclosed

Fixed in r7569.

Note: See TracTickets for help on using tickets.