device name (symlink) stability

Michael Biebl biebl at debian.org
Tue Apr 25 17:22:28 BST 2017


Am 25.04.2017 um 16:09 schrieb Vincent Lefevre:
> 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?

I guess every sr0 can be considered a cdrom, but it's not necessarily a
dvd/cd writer.

> /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"


60-cdrom_id.rules is a rules provided by upstream,
80-debian-compat.rules a Debian specific file which we provide for
compat reasons.

I don't remember the details of 80-debian-compat.rules, but it's rather
ugly and it's maybe time to drop that hack early in the buster release
cycle.

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-systemd-maintainers/attachments/20170425/276dee26/attachment.sig>


More information about the Pkg-systemd-maintainers mailing list