UDEV Rules Didn't Behave Like I Thought
beesnees at grm.net
Tue Mar 7 11:45:07 PST 2006
This may be long and convoluted, but please bear with me. I was
struggling with the age-old "I can't access my combo dvd/cdrom drive
unless I'm root" syndrome. The situation seemed simple: I needed two
different symlinks to point to, in my case, 'hdc' and establish a group
for hdc with 'rw' access. The solution was simple, but, along the way,
I ran into some UDEV things that I thought I understood but apparently
don't. My original set up were lines in /etc/udev/rules.d. Here are
the relevant parts:
and from /etc/udev/rules.d/25-lfs.rules
BUS=="ide", KERNEL=="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media",
RESULT="cdrom", NAME="%k", SYMLINK="cdrom"
The /dev/dvd symlink was created but the /dev/cdrom symlink was not. The
25-lfs.rules is from UDEV-71. In my other LFS distro I have UDEV-58 and
both symlinks were created. The only difference is the use of "==" in
UDEV-71 and just "=" in UDEV-58.
Anyway I discovered this thread in the archives:
in which Andrew Benton suggested this line in a udev rule
BUS="ide", KERNEL="hdc", GROUP="video", NAME="%k", SYMLINK="dvd" MODE="0660"
I added this to my 24-dvd.rules so that it would get processed before
anything else. I used GROUP="cdrom" and 'SYMLINK="dvd cdrom" to get
both. When I ran 'udevstart,' I had the two symlinks but /dev/hdc still
had group DISK. I changed the appropriate lines in 25-lfs.rules to read:
and I got what I wanted. Here's my question. I knew that UDEV
processed the first rule that used NAME and ignored others using NAME.
But, I also thought that UDEV rules worked in lexical order--once a
match was made, no further rules were processed for that particular
device. But that is apparently not the case, unless the use of "=="
changes things. Can some one fill me in?
More information about the blfs-support