Gentoo Archives: gentoo-user

From: "David M. Fellows" <fellows@×××.ca>
To: gentoo-user@l.g.o, Mark Knecht <markknecht@×××××.com>
Subject: Re: [gentoo-user] Re: 4 machines - no /dev/cdrom or /dev/dvd anymore
Date: Sat, 05 Jan 2013 23:02:35
Message-Id: 201301052300.r05N0ltV016453@iapetus.its.unb.ca
In Reply to: [gentoo-user] Re: 4 machines - no /dev/cdrom or /dev/dvd anymore by Mark Knecht
1 On Sat, 5 Jan 2013 12:44:07 -0800
2 Mark Knecht wrote -
3 > On Sat, Jan 5, 2013 at 11:53 AM, Mark Knecht <markknecht@×××××.com> wrote:
4 > > I think I touched on this a couple of weeks ago but never had time to
5 > > dig in. At that time I thought this problem was only on one machine
6 > > but now I see it's on every machine I've looked at this morning. Not a
7 > > single machine has /dev/cdrom anymore, nor /dev/dvd or any of the
8 > > other incantations that have existed forever.
9 > >
10 > <SNIP>
11 >
12 > OK, this is solved using udevadm and changing the
13 > 70-persistent-cd.rules file to key off a different identifier.
14 >
15 > Old way:
16 > #SUBSYSTEM=="block", ENV{ID_CDROM}=="?*",
17 > ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-0:0:0:0", SYMLINK+="cdrom",
18 > ENV{GENERATED}="1"
19 >
20 > New way:
21 > SUBSYSTEM=="block", ENV{ID_CDROM}=="?*",
22 > ENV{ID_MODEL}=="Optiarc_DVD_RW_AD-7241S", SYMLINK+="cdrom",
23 > ENV{GENERATED}="1"
24
25
26 I had the same problem. Came to a different solution. Following for
27 your amusement and edifcation are my notes taken as I debugged.
28 ------------
29 ==2012-11-26
30
31 udev is not creating /dev/cdrom symlinks so all my scripts that use
32 /dev/cdrom or attempt to moun /dev/cdrom fail.
33 Not sure when this actually started happening. I last burned a dvd on Oct
34 23 so it was OK then. /etc/udev/roules.d/70-persistent-cdrom.rules is dated
35 Oct 30. It looks plausible.
36
37 Documentation implies that removing said file and rebooting will cause udev
38 to recreate it "correctly". I was unable to cause it to be rebuilt,
39 correctly or otherwise, in this manner.
40
41 ==2012-11-27
42 Created /dev/cdrom -> /dev/sr0 symlink manually because burn script wants
43 to mount /dev/cdrom on /mnt/cdrom.
44
45 This time the backup copy/burn went flawlessly. I think udev is also
46 causing problems.
47
48 70-persistent-cd.rules may be wrong for my current kernel
49 I don't think the ID_PATH has scsi as a path anymore.
50
51 ==2012-12-04
52 I syncd on Friday(Dec 1), but did not do emerge.
53
54 Doing the regular upgrade emerge.
55 new virtual/udev-171 I guess this is prep for the proposed udev fork.
56 open-rc goes from 0.11.5 to 0.11.6 This might bear on cd.rules issue.
57 But apparently not, there seems to be no change.
58
59 No config files
60 revdep-rebuild was clean
61 udev should be restarted. (reboot might be better)
62
63 On reboot 70-persistent-net.rules was created. It was the same as the old
64 one. No cd rules file.
65
66 I then inserted my memorex usb stick that has a "cdrom" partition on it.
67 Lo! a 70-persistent-cd.rules file appeared with 2 lines for the memorex.
68 plus /dev/cdrom /dev/cdrw symlinks to sr1.
69
70 If I pull the stick sr1, cdrom, and cdrw go away. They come back if I
71 reinsert it. 70*cd.rules remains unchanged.
72
73 Note: Running udevadm control --log-priority=info
74 puts copious amounts of stuff into /var/log/everything/current
75 Debug even more
76 Remember to reset it to err when not experimenting.
77
78 Findings:
79
80 /lib/udev/rules.d/75-cd-aliases-generator.rules
81 invokes
82
83 /lib/udev/write_cd_rules
84 to actually write the /etc/udev/rules.d/70-persistent-cd.rules file.
85
86 for usb cdroms it calls it with "by-id" as an arg. Non usb device no arg
87 which defaults to "by-path" in the callee.
88
89 by-path requires $ID_PATH variable to have a value. Turns out that
90 udevadm info --query=all --name=/dev/sr0
91 shows that for the built -in drive there is no BY_PATH variable set.
92 (it is set for sr1 the usb stick!)
93 So it looks like the write_cd_rules script bails with return code of 1
94 without actually writing anything.
95
96 Solution to try:
97 Copy /lib/udev/rules.d/75-cd-aliases-generator.rules to /etc/udev/rules.d
98 and edit it there to invoke /write_cd_rules with "by-id" in both cases
99 and see what happens.
100
101 ==2012-12-05
102 Yess!
103 Did above and it "just worked".
104 ----------------
105 My 70-persistent-cd.rules file now contains:
106
107 # HL-DT-ST_DVDRAM_GH22NS70 ()
108 SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_SERIAL}=="HL-DT-ST_DVDRAM_GH22NS70_K24B5GJ2632", SYMLINK+="cdrom", ENV{GENERATED}="1"
109 SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_SERIAL}=="HL-DT-ST_DVDRAM_GH22NS70_K24B5GJ2632", SYMLINK+="cdrw", ENV{GENERATED}="1"
110 SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_SERIAL}=="HL-DT-ST_DVDRAM_GH22NS70_K24B5GJ2632", SYMLINK+="dvd", ENV{GENERATED}="1"
111 SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_SERIAL}=="HL-DT-ST_DVDRAM_GH22NS70_K24B5GJ2632", SYMLINK+="dvdrw", ENV{GENERATED}="1"
112
113 # TD_ID_UFD_301B (pci-0000:00:1d.0-usb-0:1.2:1.0-scsi-0:0:0:0)
114 SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_SERIAL}=="Memorex_TD_ID_UFD_301B_07630E9000EB-0:0", SYMLINK+="cdrom1", ENV{GENERATED}="1"
115 SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_SERIAL}=="Memorex_TD_ID_UFD_301B_07630E9000EB-0:0", SYMLINK+="cdrw1", ENV{GENERATED}="1"
116
117 Modifying 75-cd-aliases-generator.rules has an advantage over Mark's solution
118 in that it will automatically catch all installed cdrom- type devices and it
119 should add the dvd rules as appropriate to the device's capabilities.
120
121 Dave F