My system has two optical drives (hdc, hdd). In FC4 the "eject" command opened hdc. In FC5 the "eject" command opens hdd. This is not what an end-user expects. "eject" (without arguments) opens /dev/cdrom by default. In FC5 /dev/cdrom points to /dev/hdd. I want /dev/cdrom to point to /dev/hdc so that "eject" works as it did in FC4. I also have xmms configured to play /dev/cdrom by default. udev-084-13 kernel 2.6.16-1.2096_FC5 lrwxrwxrwx 1 root root 3 Apr 26 13:35 cdrom -> hdd lrwxrwxrwx 1 root root 3 Apr 26 13:35 cdrom-hdc -> hdc lrwxrwxrwx 1 root root 3 Apr 26 13:35 cdrom-hdd -> hdd lrwxrwxrwx 1 root root 3 Apr 26 13:35 cdrw -> hdd lrwxrwxrwx 1 root root 3 Apr 26 13:35 cdrw-hdd -> hdd lrwxrwxrwx 1 root root 3 Apr 26 13:35 cdwriter -> hdd lrwxrwxrwx 1 root root 3 Apr 26 13:35 cdwriter-hdd -> hdd My workaround is to create the file /etc/udev/rules.d/51-udev.rules containing these rules: KERNEL=="hdc", BUS=="ide", SYSFS{removable}=="1", SYSFS{device/media}=="cdrom", SYMLINK+="cdrom" KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", SYSFS{device/media}=="cdrom", SYMLINK+="cdrom-%k" According to the FC5 release notes, the assignment of /dev/cdrom to a device in a system with more than one cdrom drive is "random", and that assignment "usually sticks". Are the release notes correct? If so, it seems to me udev should ensure that /dev/cdrom points to a definite, not a random, device, and, preferably, that it points to the first device.
$ cat /proc/sys/dev/cdrom/info CD-ROM information, Id: cdrom.c 3.20 2003/12/17 drive name: hdd hdc drive speed: 40 48 drive # of slots: 1 1 Can close tray: 1 1 Can open tray: 1 1 Can lock tray: 1 1 Can change speed: 1 1 Can select disk: 0 0 Can read multisession: 1 1 Can read MCN: 1 1 Reports media changed: 1 1 Can play audio: 1 1 Can write CD-R: 1 0 Can write CD-RW: 1 0 Can read DVD: 0 1 Can write DVD-R: 0 0 Can write DVD-RAM: 0 0 Can read MRW: 1 1 Can write MRW: 1 1 Can write RAM: 1 0
> Are the release notes correct? yes > If so, it seems to me udev should ensure that /dev/cdrom > points to a definite, not a random, device, > and, preferably, that it points to the first device. well, tell me how
what is the first cdrom? - sda vs. hda
(In reply to comment #0) > My workaround is to create the file > /etc/udev/rules.d/51-udev.rules containing these rules: > KERNEL=="hdc", BUS=="ide", SYSFS{removable}=="1", SYSFS{device/media}=="cdrom", > SYMLINK+="cdrom" > KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", > SYSFS{device/media}=="cdrom", SYMLINK+="cdrom-%k" This didn't seem to work consistently, so I modified 50-udev.rules. I suspect that I really can override the standard cdrom rules by adding another rules file, but have not experimented much beyond the above. $ rcsdiff -u 50-udev.rules =================================================================== RCS file: RCS/50-udev.rules,v retrieving revision 1.1 diff -u -r1.1 50-udev.rules --- 50-udev.rules 2006/04/26 19:19:20 1.1 +++ 50-udev.rules 2006/04/27 10:27:04 @@ -237,7 +237,8 @@ SYSFS{device/media}=="floppy", \ SYMLINK+="floppy floppy-%k", OPTIONS+="ignore_remove, all_partitions" -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", SYSFS{device/media}=="cdrom", SYMLINK+="cdrom cdrom-%k" +KERNEL=="hdc", BUS=="ide", SYSFS{removable}=="1", SYSFS{device/media}=="cdrom", SYMLINK+="cdrom" +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", SYSFS{device/media}=="cdrom", SYMLINK+="cdrom-%k" KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="check-cdrom.sh %k DVD", SYMLINK+="dvd dvd-%k" KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k DVD", SYMLINK+="dvd dvd-%k"
(In reply to comment #3) > what is the first cdrom? > - sda vs. hda <g> Good question. I can come up with several ways to order devices so that there is a "first" device. 1. sort by device name. 2. sort by device number (major, minor) 3. sort first by system address of device controller and then by device number on the controller. (I'm thinking of the PCI address of the controller as displayed by lspci.) Any of these would be deterministic and predictable, however none are satisfying, because how symbolic device names are assigned to devices is really a matter of user preference. This makes me think a GUI or configuration tool (e.g. system-config-devices) would provide be a better approach to setting up device names in general. If, during system installation or booting or after a new device is hotplugged, there is any ambiguity about which device is the user's preferred cdrom, the user could be prompted for it.
> I can come up with several ways to order devices so that there is a "first" device. A fourth way: 4. specify in a udev rules file what the ordering should be: hd* < sd*