Discussion:
What (probably in udev) controls symlink /dev/cdrom?
Add Reply
Robert Riches
2018-07-07 03:43:09 UTC
Reply
Permalink
Raw Message
What (probably in udev) controls symlink /dev/cdrom?

I have two optical drives on a Slackware 14.2 system. One is
used mostly for burning/writing. The other is used mostly for
reading. Symlink /dev/cdrom points at sr0, but I need it to
point at sr1 for this system.

As root, I can manually remove the symlink and create a new one
pointing to the correct-for-this-system device. However,
whenever I insert a disk or do some other operations on /dev/sr1,
something (probably udev) changes the symlink back to point at
sr0.

What rule or configuration file in udev determines which device
symlink /dev/cdrom points to?

Thanks,
--
Robert Riches
***@jacob21819.net
(Yes, that is one of my email addresses.)
Rich
2018-07-07 04:31:42 UTC
Reply
Permalink
Raw Message
Post by Robert Riches
What rule or configuration file in udev determines which device
symlink /dev/cdrom points to?
For reasonably modern Slackware versions, it is this file:

/etc/udev/rules.d/70-persistent-cd.rules
Henrik Carlqvist
2018-07-07 08:51:36 UTC
Reply
Permalink
Raw Message
Post by Rich
What rule or configuration file in udev determines which device symlink
/dev/cdrom points to?
/etc/udev/rules.d/70-persistent-cd.rules
My slackware 14.2 system does not have the file 70-persistent-cd.rules
and I can't find any startup file that creates it like
70-persistent-net.rules is created.

But I can see that the symlink /dev/cdrom is controlled by the script
/lib/udev/rules.d/60-cdrom_id.rules

That said, it is a better idea to write your own custom udev rules in
/etc/udev/rules.d than to mess around in the files in /lib/udev. The file
in /lib/udev might be a good starting point for your custom file which
should live in /etc/udev/rules.d and 70-persistent-cd.rules would not be
a bad name for that file if you don't want to add the rule to some other
existing file.

regards Henrik
Jerry Peters
2018-07-07 20:31:52 UTC
Reply
Permalink
Raw Message
Post by Henrik Carlqvist
Post by Rich
What rule or configuration file in udev determines which device symlink
/dev/cdrom points to?
/etc/udev/rules.d/70-persistent-cd.rules
My slackware 14.2 system does not have the file 70-persistent-cd.rules
and I can't find any startup file that creates it like
70-persistent-net.rules is created.
But I can see that the symlink /dev/cdrom is controlled by the script
/lib/udev/rules.d/60-cdrom_id.rules
That said, it is a better idea to write your own custom udev rules in
/etc/udev/rules.d than to mess around in the files in /lib/udev. The file
in /lib/udev might be a good starting point for your custom file which
should live in /etc/udev/rules.d and 70-persistent-cd.rules would not be
a bad name for that file if you don't want to add the rule to some other
existing file.
regards Henrik
A file in /etc/udev/rules.d overrides a the file with the same name in
/lib/udev/rules.d.

On 4.1, /lib/udev/rules.d/75-cd-aliases-generator.rules:
# these rules generate rules for the /dev/{cdrom,dvd,...} symlinks
Robert Riches
2018-07-08 03:35:46 UTC
Reply
Permalink
Raw Message
Post by Jerry Peters
Post by Henrik Carlqvist
Post by Rich
What rule or configuration file in udev determines which device symlink
/dev/cdrom points to?
/etc/udev/rules.d/70-persistent-cd.rules
My slackware 14.2 system does not have the file 70-persistent-cd.rules
and I can't find any startup file that creates it like
70-persistent-net.rules is created.
But I can see that the symlink /dev/cdrom is controlled by the script
/lib/udev/rules.d/60-cdrom_id.rules
That said, it is a better idea to write your own custom udev rules in
/etc/udev/rules.d than to mess around in the files in /lib/udev. The file
in /lib/udev might be a good starting point for your custom file which
should live in /etc/udev/rules.d and 70-persistent-cd.rules would not be
a bad name for that file if you don't want to add the rule to some other
existing file.
regards Henrik
A file in /etc/udev/rules.d overrides a the file with the same name in
/lib/udev/rules.d.
# these rules generate rules for the /dev/{cdrom,dvd,...} symlinks
Excellent! Thank you all very much for all the replies!

On my 14.2 system, I see /lib/udev/rules.d/60-cdrom_id.rules with
the line that creates the 'cdrom' symlink to 'sr0'. I'll plan to
copy that file to /etc/udev/rules.d and change that 'sr0' to
'sr1' with a comment to remind myself why I'm doing that.

Thanks!
--
Robert Riches
***@jacob21819.net
(Yes, that is one of my email addresses.)
Loading...