[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: device name (symlink) stability



Hi,

On 2017-04-25 12:14:30 +0200, Michael Biebl wrote:
> Am 25.04.2017 um 10:53 schrieb Vincent Lefevre:
[...]
> > In particular, it is strange that all the symlinks point to sr0
> > except cdrw, which now points to sr1.
> 
> The udev rules responsible for creating those symlinks is
> /lib/udev/rules.d/80-debian-compat.rules or
> 
> https://anonscm.debian.org/cgit/pkg-systemd/systemd.git/tree/debian/extra/rules/80-debian-compat.rules#n18
> 
> See the comment in there:
> 
> # These rules will create symlinks for CD/DVD drives, to help old
> # programs which are unable to automatically discover the devices.
> # The first detected device gets the symlink, but this is not stable across
> # reboots.
> 
> So, yes, what you see can happen depending on the order devices are
> discovered.

OK, but if sr0 is discovered first, then it should have all the
symlinks, and if sr1 is discovered first, then it should have all
the symlinks. But why do I get sr1 for only one of them?

lrwxrwxrwx  1 root root           3 2017-04-24 10:05:16 cdrom -> sr0
lrwxrwxrwx  1 root root           3 2017-04-24 10:05:16 cdrw -> sr1
lrwxrwxrwx  1 root root           3 2017-04-24 10:05:16 dvd -> sr0
lrwxrwxrwx  1 root root           3 2017-04-24 10:05:16 dvdrw -> sr0

And why isn't there the same rule for cdrom?

/lib/udev/rules.d/80-debian-compat.rules contains:

# These rules will create symlinks for CD/DVD drives, to help old
# programs which are unable to automatically discover the devices.
# The first detected device gets the symlink, but this is not stable across
# reboots.
ENV{ID_CDROM_CD_RW}=="?*", \
  PROGRAM="/bin/sh -c 'ln -s %k /run/udev/link.cdrw 2>/dev/null; [ `readlink /run/udev/link.cdrw` = %k ]", \
  SYMLINK+="cdrw", OPTIONS+="link_priority=-100"
ENV{ID_CDROM_DVD}=="?*", \
  PROGRAM="/bin/sh -c 'ln -s %k /run/udev/link.dvd 2>/dev/null; [ `readlink /run/udev/link.dvd` = %k ]", \
  SYMLINK+="dvd", OPTIONS+="link_priority=-100"
ENV{ID_CDROM_DVD_RW}=="?*", \
  PROGRAM="/bin/sh -c 'ln -s %k /run/udev/link.dvdrw 2>/dev/null; [ `readlink /run/udev/link.dvdrw` = %k ]", \
  SYMLINK+="dvdrw", OPTIONS+="link_priority=-100"

but /lib/udev/rules.d/60-cdrom_id.rules contains:

KERNEL=="sr0", SYMLINK+="cdrom", OPTIONS+="link_priority=-100"

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


Reply to: