Bug 179993

Summary: udev ruleset not working for DVB devices anymore
Product: [Fedora] Fedora Reporter: Peter Bieringer <pb>
Component: udevAssignee: Harald Hoyer <harald>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: 4CC: dedourek, ralston
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: FC5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-09-22 02:14:07 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Peter Bieringer 2006-02-04 11:46:35 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; de-DE; rv:1.7.12) Gecko/20060202 Fedora/1.0.7-1.2.fc4 Firefox/1.0.7

Description of problem:
udev ruleset for DVB devices doesn't work anymore since new version.



Version-Release number of selected component (if applicable):
udev-071-0.FC4.2 kernel-2.6.15-1.1830_FC4

How reproducible:
Always

Steps to Reproduce:
1. install some DVB cards
2. boot
3. check permissions of DVB devices
  

Actual Results:  udev definition for DVB devices is totally ignored.

# find /dev/dvb -ls
  3797    0 drwxr-xr-x   5 root     root          100 Feb  4 12:40 /dev/dvb
  4924    0 drwxr-xr-x   2 root     root          200 Feb  4 12:40 /dev/dvb/adapter2
  5089    0 crw-------   1 root     root              Feb  4 12:40 /dev/dvb/adapter2/frontend0
  5059    0 crw-------   1 root     root              Feb  4 12:40 /dev/dvb/adapter2/demux0
  5033    0 crw-------   1 root     root              Feb  4 12:40 /dev/dvb/adapter2/net0
  5010    0 crw-------   1 root     root              Feb  4 12:40 /dev/dvb/adapter2/osd0
  4987    0 crw-------   1 root     root              Feb  4 12:40 /dev/dvb/adapter2/ca0
  4964    0 crw-------   1 root     root              Feb  4 12:40 /dev/dvb/adapter2/audio0
  4937    0 crw-------   1 root     root              Feb  4 12:40 /dev/dvb/adapter2/video0
  4925    0 crw-------   1 root     root              Feb  4 12:40 /dev/dvb/adapter2/dvr0
  4635    0 drwxr-xr-x   2 root     root          200 Feb  4 12:40 /dev/dvb/adapter1
  4817    0 crw-------   1 root     root              Feb  4 12:40 /dev/dvb/adapter1/frontend0
  4774    0 crw-------   1 root     root              Feb  4 12:40 /dev/dvb/adapter1/net0
  4751    0 crw-------   1 root     root              Feb  4 12:40 /dev/dvb/adapter1/osd0
  4728    0 crw-------   1 root     root              Feb  4 12:40 /dev/dvb/adapter1/ca0
  4705    0 crw-------   1 root     root              Feb  4 12:40 /dev/dvb/adapter1/audio0
  4682    0 crw-------   1 root     root              Feb  4 12:40 /dev/dvb/adapter1/video0
  4659    0 crw-------   1 root     root              Feb  4 12:40 /dev/dvb/adapter1/dvr0
  4636    0 crw-------   1 root     root              Feb  4 12:40 /dev/dvb/adapter1/demux0
  3798    0 drwxr-xr-x   2 root     root          120 Feb  4 12:40 /dev/dvb/adapter0
  4006    0 crw-------   1 root     root              Feb  4 12:40 /dev/dvb/adapter0/demux0
  3872    0 crw-------   1 root     root              Feb  4 12:40 /dev/dvb/adapter0/net0
  3857    0 crw-------   1 root     root              Feb  4 12:40 /dev/dvb/adapter0/dvr0
  3799    0 crw-------   1 root     root              Feb  4 12:40 /dev/dvb/adapter0/frontend0


Expected Results:  At least permissions 0660, like defined in /etc/udev/rules.d/50-udev.rules

KERNEL=="dvb/*",               MODE="0660"
KERNEL=="dvb",                 MODE="0660"
KERNEL=="dvb/adapter*",                MODE="0660"


Additional info:

Note that related to 
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=177251

I have added a group named "video" to my system and also changed (after first tests) the udev ruleset to

KERNEL=="dvb/*",                GROUP="video", MODE="0660"
KERNEL=="dvb",                  GROUP="video", MODE="0660"
KERNEL=="dvb/adapter*",         GROUP="video", MODE="0660"

But now in addition to the MODE entry, the GROUP entry is also totally ignored.

Comment 1 James Ralston 2006-02-10 21:49:08 UTC
You probably need the last_rule option.  See:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=179841#c2


Comment 2 Peter Bieringer 2006-02-11 16:16:12 UTC
Didn't help here, strange

Next examples (from another system):

KERNEL=="isdn*",                MODE="0660"
KERNEL=="isdnctrl*",            MODE="0660"

# ll /dev/isdnctrl*
lrwxrwxrwx  1 root root       9 Feb  9 00:29 /dev/isdnctrl -> isdnctrl0
crw-------  1 root root 45,  64 Feb  9 00:29 /dev/isdnctrl0
crw-------  1 root root 45,  65 Feb  9 00:29 /dev/isdnctrl1
...

# ll /dev/isdn*
crw-------  1 root root 45,   0 Feb  9 00:29 /dev/isdn0
crw-------  1 root root 45,   1 Feb  9 00:29 /dev/isdn1
crw-------  1 root root 45,  10 Feb  9 00:29 /dev/isdn10


Looks like now every dedicated rule needs OPTIONS="last_rule" - and hopefully
works afterwards (can't test it currently for the ISDN devices)

Comment 3 Peter Bieringer 2006-02-11 16:33:27 UTC
a short why-this-don't work test shows, that it looks like that all permissions
in subdirectories in /dev/ are not proper set by udev.

Looks like the subdirectory matcher is broken. 

Check e.g. 
# ll /dev/input/
total 0
crw-------  1 root root 13, 64 Feb  9 00:28 event0
crw-------  1 root root 13, 65 Feb  9 00:28 event1
crw-------  1 root root 13, 66 Feb  9 00:29 event2
crw-------  1 root root 13, 63 Feb  9 00:28 mice
crw-------  1 root root 13, 32 Feb  9 00:28 mouse0

udev says:
# input devices
KERNEL=="input/*",              MODE="0660"



Comment 4 James Ralston 2006-02-11 20:23:07 UTC
Well, this is what 50-udev.rules says:

KERNEL="*", OWNER="root" GROUP="root", MODE="0600"
KERNEL=="input/*",		MODE="0660"
KERNEL=="mice",			NAME="input/%k"

Before udev-071, the second rule would match /dev/input/mice after the third
rule had been applied.  But now, the second rule never matches.

This smells like a bug to me.  Consider these entries, also from 50-udev.rules:

KERNEL="*", OWNER="root" GROUP="root", MODE="0600"
KERNEL=="dri/*",		MODE="0666"
KERNEL=="card*",		NAME="dri/card%n"

At least for me, the second line *does* get applied in this case:

$ ls -lsa /dev/dri
total 0
0 drwxr-xr-x   2 root root     60 Feb 10 11:40 ./
0 drwxr-xr-x  13 root root   3780 Feb 11 13:54 ../
0 crw-rw-rw-   1 root root 226, 0 Feb 10 11:40 card0

Harald, can you shed any light on this?


Comment 5 Peter Bieringer 2006-02-12 12:24:23 UTC
I got some time to play around with udev in debug mode and I *found* the reason
and a solution:

Current distributed by RPM:

# grep dvb /etc/udev/rules.d/50-udev.rules
KERNEL=="dvb/*",               MODE="0660"
KERNEL=="dvb",                 MODE="0660"
KERNEL=="dvb/adapter*",                MODE="0660"
KERNEL=="dvb*", PROGRAM=="/etc/udev/scripts/dvb.sh %k", NAME="%c"

First try, not working:
KERNEL=="dvb/*",                GROUP="video", MODE="0660"
KERNEL=="dvb",                  GROUP="video", MODE="0660"
KERNEL=="dvb/adapter[0-9]/*",         GROUP="video", MODE="0660"

Second try, *working*
KERNEL=="dvb*",          GROUP="video", MODE="0660"

So it looks like behavior change in lookup was done.
Prior update, the KERNEL== statements would be checked also after a NAME= run,
now, this no longer works and the adjustments have to match the original entry
before renaming (e.g. dvb0.frontend0 here).

So all entries in rules file (this means all subdirectory entries) which are
matching only the renamed devices need to be checked for proper working.

BTW: udev debug log didn't log anything about owner, group, mode changes at all
  - that's not nice.






Comment 6 James Ralston 2006-02-12 20:31:36 UTC
Yes; that's what I meant in comment 4: the KERNEL key will never match the
renamed device.

I find it hard to believe that this isn't a bug.  As far as I've been able to
determine, one of the reasons why the KERNEL key would match the device as
modified by the NAME key was so that you could have default
owners/groups/permissions for classes of devices, rather than having to repeat
them on every single line.

But regardless: either this is a bug with udev, and the rules in 50-udev.rules
are correct; or this is a intentional change in udev's behavior, and the rules
in 50-udev.rules are now wrong.


Comment 7 Peter Bieringer 2006-02-12 20:44:58 UTC
I changed severity to high to get more intention on this problem. Imho, if FC5
includes same udev new udev version, this would/should be a release-stopper
until this is proper fixed and well documented.

Comment 8 Harald Hoyer 2006-02-14 09:41:41 UTC
Ok, this should work on FC-5 and maybe with udev-071 on FC-4:

# DVB
KERNEL=="dvb",                  MODE="0660"
SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf
dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0660"  

Comment 9 Peter Bieringer 2006-02-15 18:00:09 UTC
Yes, this works, too.

Comment 10 Bill Nottingham 2006-09-22 02:14:07 UTC
Closing bugs in MODIFIED state from prior Fedora releases. If this bug persists
in a current Fedora release (such as Fedora Core 5 or later), please reopen and
set the version appropriately.