Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 179181 - sys-fs/udev-111 - CD/DVD /dev symlinks still broken
Summary: sys-fs/udev-111 - CD/DVD /dev symlinks still broken
Status: RESOLVED CANTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: udev maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-20 03:58 UTC by Rick Harris
Modified: 2007-05-24 19:52 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
/dev/.udev/tmp-rules--70-persistent-cd.rules (udev-cdrules.txt,693 bytes, text/plain)
2007-05-22 10:07 UTC, Rick Harris
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rick Harris 2007-05-20 03:58:52 UTC
System has only one DVDRW/CDRW drive that is always located at device /dev/hdd.

Starting with a fresh set of rules as installed by udev-111 and on a fresh reboot:

# ls -l /dev/cd*
lrwxrwxrwx 1 root root 3 2007-05-20 21:39 /dev/cdrom2 -> hdd
lrwxrwxrwx 1 root root 3 2007-05-20 21:39 /dev/cdrom3 -> hdd
lrwxrwxrwx 1 root root 3 2007-05-20 21:39 /dev/cdrom4 -> hdd

# ls -l /dev/dv*
ls: cannot access /dev/dv*: No such file or directory


Expected results:
# ls -l /dev/cd*
lrwxrwxrwx 1 root root 3 2007-05-20 21:39 /dev/cdrom -> hdd

# ls -l /dev/dv*
lrwxrwxrwx 1 root root 3 2007-05-20 21:39 /dev/dvd -> hdd

If it helps any, the output of /lib/udev/cdrom_id:
# /lib/udev/cdrom_id /dev/hdd
ID_CDROM=1
ID_CDROM_CD_R=1
ID_CDROM_CD_RW=1
ID_CDROM_DVD=1
ID_CDROM_DVD_R=1
ID_CDROM_MRW=1
ID_CDROM_MRW_W=1
ID_CDROM_RAM=1

Thanks :)
Comment 1 Rick Harris 2007-05-20 04:23:13 UTC
Just now found that downgrading back to udev-104, it works as expected:

# ls -lah /dev/dv*
lrwxrwxrwx 1 root root 3 2007-05-20 23:17 /dev/dvd -> hdd
lrwxrwxrwx 1 root root 3 2007-05-20 23:17 /dev/dvdrw -> hdd

# ls -lah /dev/cd*
lrwxrwxrwx 1 root root 3 2007-05-20 23:17 /dev/cdrom -> hdd
lrwxrwxrwx 1 root root 3 2007-05-20 23:17 /dev/cdrw -> hdd
Comment 2 Matthias Schwarzott gentoo-dev 2007-05-21 13:09:25 UTC
There must be some kernel-changes triggering that behaviour.

Can you please attach /etc/udev/rules.d/70-persistent-cd.rules
without that file we cannot do anything for you.
Comment 3 Rick Harris 2007-05-22 08:19:01 UTC
/etc/udev/rules.d/70-persistent-cd.rules does not exist for either udev-104 or udev-111

Closest thing I have is /etc/udev/rules.d/75-cd-aliases-generator.rules
Here is it's contents:
# these rules generate rules for the /dev/{cdrom,dvd,...} symlinks

ACTION=="add", SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{GENERATED}!="?*", PROGRAM="write_cd_rules", SYMLINK+="%c"

# uname -a
Linux SCOOBY 2.6.17.6 #1 Mon Oct 2 18:06:57 CST 2006 i686 AMD Athlon(tm) XP 2800+ AuthenticAMD GNU/Linux
Comment 4 Rick Harris 2007-05-22 08:20:20 UTC
Re-opening, see Comment #3
Comment 5 Matthias Schwarzott gentoo-dev 2007-05-22 09:02:37 UTC
Not having 70-persistent-cd.rules is strang. If you still does not have it, could you test if you have /dev/.udev/tmp-rules--*.

Please attach output of 
udevinfo -a -p /sys/block/hdd
and udevtest /sys/block/hdd
Comment 6 Rick Harris 2007-05-22 10:07:37 UTC
Created attachment 119980 [details]
/dev/.udev/tmp-rules--70-persistent-cd.rules
Comment 7 Rick Harris 2007-05-22 10:33:01 UTC
Bugzilla is giving the usual attachment bug:
undef error - Undefined subroutine Fh::slice at data/template/template/en/custom/global/hidden-fields.html.tmpl line 58

So pasting 'udevinfo -a -p /sys/block/hdd':

Udevinfo starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/block/hdd':
    KERNEL=="hdd"
    SUBSYSTEM=="block"
    DRIVER==""
    ATTR{stat}=="   14843   454936  3758232   512036        0        0        0        0        0   346760   512036"
    ATTR{size}=="9180416"
    ATTR{removable}=="1"
    ATTR{range}=="1"
    ATTR{dev}=="22:64"

  looking at parent device '/devices/pci0000:00/0000:00:0f.0/ide1/1.1':
    KERNELS=="1.1"
    SUBSYSTEMS=="ide"
    DRIVERS=="ide-cdrom"
    ATTRS{modalias}=="ide:m-cdrom"
    ATTRS{drivename}=="hdd"
    ATTRS{media}=="cdrom"

  looking at parent device '/devices/pci0000:00/0000:00:0f.0/ide1':
    KERNELS=="ide1"
    SUBSYSTEMS==""
    DRIVERS==""

  looking at parent device '/devices/pci0000:00/0000:00:0f.0':
    KERNELS=="0000:00:0f.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="VIA_IDE"
    ATTRS{modalias}=="pci:v00001106d00000571sv00001458sd00005002bc01sc01i8a"
    ATTRS{local_cpus}=="1"
    ATTRS{irq}=="0"
    ATTRS{class}=="0x01018a"
    ATTRS{subsystem_device}=="0x5002"
    ATTRS{subsystem_vendor}=="0x1458"
    ATTRS{device}=="0x0571"
    ATTRS{vendor}=="0x1106"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""



Pasting 'udevtest /sys/block/hdd':
parse_file: reading '/etc/udev/rules.d/05-udev-early.rules' as rules file
parse_file: reading '/etc/udev/rules.d/50-udev.rules' as rules file
parse_file: reading '/etc/udev/rules.d/60-persistent-input.rules' as rules file
parse_file: reading '/etc/udev/rules.d/60-persistent-storage.rules' as rules file
parse_file: reading '/etc/udev/rules.d/64-device-mapper.rules' as rules file
add_to_rules: link priority=50
parse_file: reading '/etc/udev/rules.d/70-persistent-cd.rules' as rules file
parse_file: reading '/etc/udev/rules.d/75-cd-aliases-generator.rules' as rules file
parse_file: reading '/etc/udev/rules.d/75-persistent-net-generator.rules' as rules file
parse_file: reading '/etc/udev/rules.d/90-hal.rules' as rules file
parse_file: reading '/etc/udev/rules.d/95-udev-late.rules' as rules file
parse_file: reading '/etc/udev/rules.d/99-libsane.rules' as rules file
This program is for debugging only, it does not run any program,
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

main: looking at device '/block/hdd' from subsystem 'block'
match_rule: set ENV 'IN_HOTPLUG=1'
run_program: 'cdrom_id --export /dev/.tmp-22-64'
run_program: '/lib/udev/cdrom_id' (stdout) 'ID_CDROM=1'
run_program: '/lib/udev/cdrom_id' (stdout) 'ID_CDROM_CD_R=1'
run_program: '/lib/udev/cdrom_id' (stdout) 'ID_CDROM_CD_RW=1'
run_program: '/lib/udev/cdrom_id' (stdout) 'ID_CDROM_DVD=1'
run_program: '/lib/udev/cdrom_id' (stdout) 'ID_CDROM_DVD_R=1'
run_program: '/lib/udev/cdrom_id' (stdout) 'ID_CDROM_MRW=1'
run_program: '/lib/udev/cdrom_id' (stdout) 'ID_CDROM_MRW_W=1'
run_program: '/lib/udev/cdrom_id' (stdout) 'ID_CDROM_RAM=1'
run_program: '/lib/udev/cdrom_id' returned with status 0
run_program: 'ata_id --export /dev/.tmp-22-64'
run_program: '/lib/udev/ata_id' (stdout) 'ID_TYPE=cd'
run_program: '/lib/udev/ata_id' (stdout) 'ID_MODEL=Imation_IMW16DL84I'
run_program: '/lib/udev/ata_id' (stdout) 'ID_SERIAL='
run_program: '/lib/udev/ata_id' (stdout) 'ID_REVISION=PSI1'
run_program: '/lib/udev/ata_id' (stdout) 'ID_BUS=ata'
run_program: '/lib/udev/ata_id' returned with status 0
run_program: 'path_id /block/hdd'
run_program: '/lib/udev/path_id' (stdout) 'ID_PATH=pci-0000:00:0f.0-ide-1:1'
run_program: '/lib/udev/path_id' returned with status 0
udev_rules_get_name: add symlink 'disk/by-path/pci-0000:00:0f.0-ide-1:1'
match_rule: set ENV 'GENERATED=1'
udev_rules_get_name: add symlink 'cdrom'
match_rule: set ENV 'GENERATED=1'
udev_rules_get_name: add symlink 'cdrw'
match_rule: set ENV 'GENERATED=1'
udev_rules_get_name: add symlink 'dvd'
match_rule: set ENV 'GENERATED=1'
udev_rules_get_name: add symlink 'dvdrw'
udev_rules_get_name: no node name set, will use kernel name 'hdd'
udev_db_get_device: no db file to read /dev/.udev/db/%2fblock%2fhdd: No such file or directory
udev_node_add: creating device node '/dev/hdd', major = '22', minor = '64', mode = '0660', uid = '0', gid = '19'
udev_node_update_symlinks: update symlink 'disk/by-path/pci-0000:00:0f.0-ide-1:1' of '/block/hdd'
udev_db_get_devices_by_name: no index directory '/dev/.udev/names/disk%2fby-path%2fpci-0000:00:0f.0-ide-1:1': No such file or directory
update_link: found -1 devices with name 'disk/by-path/pci-0000:00:0f.0-ide-1:1'
update_link: no reference left, remove 'disk/by-path/pci-0000:00:0f.0-ide-1:1'
udev_node_update_symlinks: update symlink 'cdrom' of '/block/hdd'
udev_db_get_devices_by_name: no index directory '/dev/.udev/names/cdrom': No such file or directory
update_link: found -1 devices with name 'cdrom'
update_link: no reference left, remove 'cdrom'
udev_node_update_symlinks: update symlink 'cdrw' of '/block/hdd'
udev_db_get_devices_by_name: no index directory '/dev/.udev/names/cdrw': No such file or directory
update_link: found -1 devices with name 'cdrw'
update_link: no reference left, remove 'cdrw'
udev_node_update_symlinks: update symlink 'dvd' of '/block/hdd'
udev_db_get_devices_by_name: no index directory '/dev/.udev/names/dvd': No such file or directory
update_link: found -1 devices with name 'dvd'
update_link: no reference left, remove 'dvd'
udev_node_update_symlinks: update symlink 'dvdrw' of '/block/hdd'
udev_db_get_devices_by_name: no index directory '/dev/.udev/names/dvdrw': No such file or directory
update_link: found -1 devices with name 'dvdrw'
update_link: no reference left, remove 'dvdrw'
main: run: 'udev_run_devd block'
main: run: 'socket:/org/kernel/udev/monitor'
main: run: 'socket:/org/freedesktop/hal/udev_event'
Comment 8 Matthias Schwarzott gentoo-dev 2007-05-22 11:04:40 UTC
Looks good so far, but I guess this is the output from udev-104.
Could you redo your test with udev-111 ?
Comment 9 Rick Harris 2007-05-22 11:34:07 UTC
Output is using udev-111, but I have been flipping backwards/forwards between 104 and 111 for this test, so perhaps it is taking into account symlinks that have already been created using 104.

I'll test again doing a reboot this time between versions (original bug report was also verified in this way).
Comment 10 Rick Harris 2007-05-23 09:46:19 UTC
Well I have tested on a reboot and now it appears to be fixed for both 104 and 111 versions.

Which lead me to dig deeper and re-instate an old /etc/udev/ backup from a time when I knew for sure that it was not working.

It looks like you are spot on with the 70-persistent-cd.rules files.
Several months (and udev versions) ago I had a second CDROM drive in this machine, which was a SONY CDU4811. This has since been removed but it looks like udev has not refreshed the changes in 70-persistent-cd.rules.

Here is the contents of the suspect 70-persistent-cd.rules:
# Imation_IMW16DL84I (pci-0000:00:0f.0-ide-1:0)
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.0-ide-1:0", SYMLINK+="cdrom", ENV{GENERATED}="1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.0-ide-1:0", SYMLINK+="cdrw", ENV{GENERATED}="1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.0-ide-1:0", SYMLINK+="dvd", ENV{GENERATED}="1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.0-ide-1:0", SYMLINK+="dvdrw", ENV{GENERATED}="1"
# Imation_IMW16DL84I (pci-0000:00:0f.0-ide-1:0)
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.0-ide-1:0", SYMLINK+="cdrom1", ENV{GENERATED}="1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.0-ide-1:0", SYMLINK+="cdrw1", ENV{GENERATED}="1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.0-ide-1:0", SYMLINK+="dvd1", ENV{GENERATED}="1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.0-ide-1:0", SYMLINK+="dvdrw1", ENV{GENERATED}="1"
# SONY_CDU4811 (pci-0000:00:0f.0-ide-1:1)
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.0-ide-1:1", SYMLINK+="cdrom2", ENV{GENERATED}="1"
# SONY_CDU4811 (pci-0000:00:0f.0-ide-1:1)
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:0f.0-ide-1:1", SYMLINK+="cdrom3", ENV{GENERATED}="1"

As you can see the old removed SONY CDU4811 is still present, and both drives have been duplicated.

Indeed re-instating this false 70-persistent-cd.rules file reproduces the same kind of fouled symlinking reported originally.

As previously noted /etc/udev/rules.d/70-persistent-cd.rules did not exist, so perhaps the contents of /dev/.udev/tmp-rules--70-persistent-cd.rules was stale.

All seeming to be well and good now, but it could be said that udev-111 does not correctly refresh/update 70-persistent-cd.rules with the current hardware configuration, leading to strange symlink creation.

I'll run a small test to check if udev-111 is OK updating/refreshing the 70-persistent-cd.rules.
It may be possible that the mis-configuration could have been installed via a rogue version of udev, but with a new version of udev released almost weekly (many of which have been removed from portage) it becomes hard to track down.
Comment 11 Matthias Schwarzott gentoo-dev 2007-05-23 09:50:58 UTC
1. I know that some older version of udev had problems leading to duplication of entries in the persistent rules.

2. How should udev know, that it should delete entries from there? That is against the persistent-concept, that should guarantee, that the device names do NOT change.
Comment 12 Rick Harris 2007-05-24 19:52:59 UTC
(In reply to comment #11)
> 2. How should udev know, that it should delete entries from there? That is
> against the persistent-concept, that should guarantee, that the device names > do NOT change.

If udev creates a fresh file at each boot using the currently detected hardware configuration, then it wouldn't need to know what to delete, it would just create valid entries.

Hardware changes such as the removal/addition of DVD/CD drives while not made every day, certainly do occur and the system should transparently deal with that.

Udev creates symlinks to these devices at each boot, so it was my understanding that udev would also correctly map those created symlinks to a meaningful layout of the current hardware configuration (as now automatically created by /lib/udev/write_cd_rules).

Granted in the old pre-udev days, the symlinking had to be done by hand, but it was a once-off type thing that would not be lost at each reboot.

If udev's persistent rule file creation is to remain the way it is, then perhaps some user documentation needs to be written detailing the process of what udev files to delete when a user makes any hardware changes, so that they may be re-created to reflect the current hardware.

Something like:
# rm -rf /dev/.udev

Then another command to re-populate /dev/.udev/...
Though I haven't stumbled across what that is yet apart from rebooting.

Just an idea here and maybe something better tackled upstream, but have udev dynamically create a fresh set of /dev/.udev/tmp-rules--70-persistent-* files at each boot with the comment up the top that if the user would like to modify it they can have a custom configuration at /etc/udev/rules.d/70-persistent-* that would override the dynamic default located in /dev/.udev/tmp-rules--70-persistent-*

Closing this one as it's now probably more in the WISHLIST category.