Bug 334981 - device mapping with udev rules didn't work
device mapping with udev rules didn't work
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: udev (Show other bugs)
7
All Linux
low Severity medium
: ---
: ---
Assigned To: Harald Hoyer
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-10-16 14:13 EDT by Martin
Modified: 2007-11-30 17:12 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-10-17 11:53:46 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Martin 2007-10-16 14:13:03 EDT
Description of problem:
i have two dvd drives a DVD-Rom and a DVD-RW drive, but the symlink to /dev/dvd
always
show always to /dev/sr1 the DVD-RW and not to /dev/sr0
The DVD-Rom drive should be mapped as /dev/dvd and /dev/cdrom to /dev/sr0
The DVD-RW drive should be mapped as /dev/dvdwriter and /dev/dvdrw to /dev/sr1

therefore i created this 2 rules in the file /etc/udev/rules.d/51-custom.rules,
but this didn't work after reboot.

SUBSYSTEMS=="scsi", ATTRS{model}=="DVD-ROM SH-D163A", ATTRS{vendor}=="TSSTcorp",
NAME:="sr0", SYMLINK+="cdrom dvd"
SUBSYSTEMS=="scsi", ATTRS{model}=="CD/DVDW SH-W163A", ATTRS{vendor}=="TSSTcorp",
NAME:="sr1", SYMLINK+="dvdwriter dvdrw


# udevinfo -q all -p /block/sr0
P: /block/sr0
N: sr0
S: scd0
S: cdrom
S: dvd
S: disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0
S: cdrom1
S: dvd1
E: ID_CDROM=1
E: ID_CDROM_DVD=1
E: ID_CDROM_MRW=1
E: ID_CDROM_MRW_W=1
E: ID_CDROM_RAM=1
E: DEVTYPE=disk
E: ID_VENDOR=TSSTcorp
E: ID_MODEL=DVD-ROM_SH-D163A
E: ID_REVISION=SB00
E: ID_SERIAL=
E: ID_SERIAL_SHORT=���^\q?^_
E: ID_TYPE=cd
E: ID_BUS=scsi
E: ID_PATH=pci-0000:00:1f.2-scsi-0:0:0:0
E: GENERATED=1

# udevinfo -q all -p /block/sr1
P: /block/sr1
N: sr1
S: scd1
S: dvdwriter
S: dvdrw
S: disk/by-path/pci-0000:00:1f.2-scsi-0:0:1:0
S: cdrom
S: cdrw
S: dvd
E: ID_CDROM=1
E: ID_CDROM_CD_R=1
E: ID_CDROM_CD_RW=1
E: ID_CDROM_DVD=1
E: ID_CDROM_DVD_R=1
E: ID_CDROM_MRW=1
E: ID_CDROM_MRW_W=1
E: ID_CDROM_RAM=1
E: DEVTYPE=disk
E: ID_VENDOR=TSSTcorp
E: ID_MODEL=CDDVDW_SH-W163A
E: ID_REVISION=TS01
E: ID_SERIAL=
E: ID_SERIAL_SHORT=���^\q?^_
E: ID_TYPE=cd
E: ID_BUS=scsi
E: ID_PATH=pci-0000:00:1f.2-scsi-0:0:1:0
E: GENERATED=1

Version-Release number of selected component (if applicable):
kernel-2.6.23.1-4.fc7
udev-static-115-5.20071012git.fc7
udev-115-5.20071012git.fc7
libvolume_id-115-5.20071012git.fc7

# ls -l /dev/dvd* /dev/scd* /dev/sr* /dev/cd*
lrwxrwxrwx 1 root root     3 16. Okt 19:43 /dev/cdrom -> sr1
lrwxrwxrwx 1 root root     3 16. Okt 19:43 /dev/cdrom1 -> sr0
lrwxrwxrwx 1 root root     3 16. Okt 19:43 /dev/cdrw -> sr1
lrwxrwxrwx 1 root root     3 16. Okt 19:43 /dev/dvd -> sr1
lrwxrwxrwx 1 root root     3 16. Okt 19:43 /dev/dvd1 -> sr0
lrwxrwxrwx 1 root root     3 16. Okt 19:43 /dev/dvdrw -> sr1
lrwxrwxrwx 1 root root     3 16. Okt 19:43 /dev/dvdwriter -> sr1
lrwxrwxrwx 1 root root     3 16. Okt 19:43 /dev/scd0 -> sr0
lrwxrwxrwx 1 root root     3 16. Okt 19:43 /dev/scd1 -> sr1
brw-rw---- 1 root disk 11, 0 16. Okt 19:43 /dev/sr0
brw-rw---- 1 root disk 11, 1 16. Okt 19:43 /dev/sr1


if i run udevtrigger again the devices are mapped correctly, but not on reboot.
# udevtrigger
# ls -l /dev/dvd* /dev/scd* /dev/sr* /dev/cd*
lrwxrwxrwx 1 root root     3 16. Okt 19:58 /dev/cdrom -> sr0
lrwxrwxrwx 1 root root     3 16. Okt 19:43 /dev/cdrom1 -> sr0
lrwxrwxrwx 1 root root     3 16. Okt 19:43 /dev/cdrw -> sr1
lrwxrwxrwx 1 root root     3 16. Okt 19:58 /dev/dvd -> sr0
lrwxrwxrwx 1 root root     3 16. Okt 19:43 /dev/dvd1 -> sr0
lrwxrwxrwx 1 root root     3 16. Okt 19:43 /dev/dvdrw -> sr1
lrwxrwxrwx 1 root root     3 16. Okt 19:43 /dev/dvdwriter -> sr1
lrwxrwxrwx 1 root root     3 16. Okt 19:43 /dev/scd0 -> sr0
lrwxrwxrwx 1 root root     3 16. Okt 19:43 /dev/scd1 -> sr1
crw-rw---- 1 root disk 21, 1 16. Okt 19:58 /dev/sr0
crw-r----- 1 root disk 21, 2 16. Okt 19:58 /dev/sr1
Comment 1 Harald Hoyer 2007-10-17 11:19:18 EDT
udev-115-5.20071012git.fc7 has its own persisten naming mechanism. Please edit:
/etc/udev/rules.d/70-persistent-cd.rules
Comment 2 Martin 2007-10-17 11:53:46 EDT
ok, solved in my case by editing the 70-persistent-cd.rules

# DVD-ROM_SH-D163A (pci-0000:00:1f.2-scsi-0:0:0:0)
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-0:0:0:0",
SYMLINK+="cdrom", ENV{GENERATED}="1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-0:0:0:0",
SYMLINK+="dvd", ENV{GENERATED}="1"
# CDDVDW_SH-W163A (pci-0000:00:1f.2-scsi-0:0:1:0)
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-0:0:1:0",
SYMLINK+="cdrom1", ENV{GENERATED}="1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-0:0:1:0",
SYMLINK+="cdrw", ENV{GENERATED}="1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-0:0:1:0",
SYMLINK+="dvd1", ENV{GENERATED}="1"
ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-0:0:1:0",
SYMLINK+="dvdrw", ENV{GENERATED}="1"

Note You need to log in before you can comment on or make changes to this bug.