[blfs-support] perms and devices for CDs and DVDs with recent udev versions

Ken Moffat zarniwhoop at ntlworld.com
Tue Aug 27 20:41:03 PDT 2013


 At the weekend I responded to a message on lfs-support about
cdroms, eject, etc and it became clear that I had at least one issue
on a mostly LFS-7.4-rc system [ but with eudev instead of Bruce's
systemd-udev ] : /dev/sr0 was owned by root:root, so eject didn't
work for a user.  I've now sorted it, but the implications are more
likely to impact people in BLFS than LFS so I'll detail it here.

 I used to have a rule in /etc/udev/rules.d to create cdrom and
dvd symlinks with mode 0660 and owned by the cdrom group.  That has
been part of my build for some time, I forget when and why I
originally added it.  Worked fine with my previous builds in late
April.

 Removing that rule from the 7.4 builds solves the ownership problem
(i.e. it becomes root:cdrom) and leaves a /dev/cdrom symlink.  But
it doesn't create a /dev/dvd symlink.

 I have three visual media players : xine, parole, and vlc.  For
xine I'm fairly sure that it doesn't use /dev/sr0.  For parole I've
no idea.  I see that vlc now has an option to choose /dev/sr0
instead of /dev/dvd.  But unfortunately, vlc has never worked well
for me when playing an encrypted DVD - it plays for a few seconds,
pauses, then plays a little more - so it won't be my primary means
of playing DVDs.

 Long story short - upstream systemd removed the cdrw, dvd, dvdrw
symlinks after someone complained that they didn't work.  If I've
understood the references (didn't see the actual discussion), with
multiple CD/DVD devices the order of appearance is random and the
links might get assigned to inappropriate devices (e.g. a dvdrw link
on a cdrom).

 Fortunately, I found a post from someone at Suse regretting this
decision, and a reference to mageia applying a rule change from
openSUSE.  Now that I know where the openSUSE srpms can be found, I
downloaded their systemd-206-3.1.src.rpm.  Within that is a patch
which creates cdrw, dvd, dvdrw symlinks for /dev/sr0.  I've attached
it in case it is useful to anyone (apply it before installing "udev"
or "gudev").

 I only want a /dev/dvd symlink for /dev/sr0 and that can be created
with a sed (a long line is added, your mail client might reformat it)

sed -i '/SYMLINK.*cdrom/ a\
KERNEL=="sr0", ENV{ID_CDROM_DVD}=="1", SYMLINK+="dvd", OPTIONS+="link_priority=-100"' \
 /lib/udev/rules.d/60-cdrom_id.rules

 AFAICS either fix ought to work on the LFS udev-systemd
combination.

ĸen, still kidding myself I'll get to bed at a sensible time one of
these nights :)
-- 
das eine Mal als Tragödie, dieses Mal als Farce
-------------- next part --------------
From: Robert Milasan <rmilasan at suse.com>
Date: Tue, 12 Feb 2013 09:16:23 +0000
Subject: create default links for primary cd_dvd drive

cdrom_id: created links for the default cd/dvd drive (bnc#783054).
---
 rules/60-cdrom_id.rules | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- systemd-206.orig/rules/60-cdrom_id.rules
+++ systemd-206/rules/60-cdrom_id.rules
@@ -15,6 +15,9 @@ ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdr
 # enable the receiving of media eject button events
 IMPORT{program}="cdrom_id --lock-media $devnode"
 
-KERNEL=="sr0", SYMLINK+="cdrom", OPTIONS+="link_priority=-100"
+KERNEL=="sr0", ENV{ID_CDROM}=="1", SYMLINK+="cdrom", OPTIONS+="link_priority=-100"
+KERNEL=="sr0", ENV{ID_CDROM_CD_RW}=="1", SYMLINK+="cdrw", OPTIONS+="link_priority=-100"
+KERNEL=="sr0", ENV{ID_CDROM_DVD}=="1", SYMLINK+="dvd", OPTIONS+="link_priority=-100"
+KERNEL=="sr0", ENV{ID_CDROM_DVD_RW}=="1", SYMLINK+="dvdrw", OPTIONS+="link_priority=-100"
 
 LABEL="cdrom_end"


More information about the blfs-support mailing list