[LFS Trac] #2057: Udev-122

LFS Trac trac at linuxfromscratch.org
Wed May 21 19:00:55 PDT 2008


#2057: Udev-122
------------------------------------------+---------------------------------
 Reporter:  matthew at linuxfromscratch.org  |        Owner:  lfs-book at linuxfromscratch.org
     Type:  enhancement                   |       Status:  new                          
 Priority:  normal                        |    Milestone:  7.0                          
Component:  Book                          |      Version:  SVN                          
 Severity:  normal                        |   Resolution:                               
 Keywords:                                |  
------------------------------------------+---------------------------------
Comment (by Bryan Kadzban):

 Replying to [comment:36 alexander at linuxfromscratch.org]:
 > "udevadm test" explicitly says that it doesn't run programs specified in
 the RUN key

 Correct.

 > (and this applies to IMPORT, too)

 Hmm; not with udevtest from udev-110, or with "udevadm test" from
 udev-122.  I just deleted everything udev-related, installed -122, re-
 added my custom rules, and ran the test (I also ran it on -110 last
 night).  This was without a generated rule file present, since I didn't
 move it back:

 {{{
 # udevadm test /class/net/eth0
 This program is for debugging only, it does not run any program,
 specified by a RUN key. It may show incorrect results, because
 some values may be different, or not available at a simulation run.

 parse_file: reading '<bunch of files>' as rules file
 parse_file: reading '/etc/udev/rules.d/61-persistent-storage-edd.rules' as
 rules file
 parse_file: reading '/etc/udev/rules.d/75-cd-aliases-generator.rules' as
 rules file
 parse_file: reading '/etc/udev/rules.d/75-persistent-net-generator.rules'
 as rules file
 parse_file: reading '<bunch more files>' as rules file
 import_uevent_var: import into environment: 'INTERFACE=eth0'
 import_uevent_var: import into environment: 'IFINDEX=2'
 udevtest: looking at device '/devices/pci0000:00/0000:00:11.0/net/eth0'
 from subsystem 'net'
 match_rule: set ENV 'MATCHADDR=00:13:8f:a6:9e:2b'
 match_rule: set ENV 'MATCHIFTYPE=1'
 match_rule: set ENV 'COMMENT=PCI device 0x10b9:0x5263 (uli526x)'
 run_program: 'write_net_rules'
 run_program: '/lib/udev/write_net_rules' returned with status 0
 udev_rules_get_name: no node name set, will use kernel name 'eth0'
 udevtest: run: 'socket:@/org/kernel/udev/monitor'
 # udevadm test /class/net/eth0
 This program is for debugging only, it does not run any program,
 specified by a RUN key. It may show incorrect results, because
 some values may be different, or not available at a simulation run.

 parse_file: reading '<bunch of files>' as rules file
 parse_file: reading '/etc/udev/rules.d/61-persistent-storage-edd.rules' as
 rules file
 parse_file: reading '/etc/udev/rules.d/70-persistent-net.rules' as rules
 file
 parse_file: reading '/etc/udev/rules.d/75-cd-aliases-generator.rules' as
 rules file
 parse_file: reading '/etc/udev/rules.d/75-persistent-net-generator.rules'
 as rules file
 parse_file: reading '<bunch more files>' as rules file
 import_uevent_var: import into environment: 'INTERFACE=eth0'
 import_uevent_var: import into environment: 'IFINDEX=2'
 udevtest: looking at device '/devices/pci0000:00/0000:00:11.0/net/eth0'
 from subsystem 'net'
 udev_rules_get_name: rule applied, 'eth0' becomes 'eth0'
 udevtest: run: 'socket:@/org/kernel/udev/monitor'
 #
 }}}

 It didn't parse a 70-persistent-net.rules file on the first run, and it
 did run the write_net_rules script according to the output.  It did parse
 a 70-persistent-net.rules file on the second run, and the interface had a
 NAME assigned on the second run as well.  It looks like it works fine.
 :-)

 Now, it's possible they'll remove this support in the future, I'm not
 sure.  But since it does work for now, I'd feel slightly more comfortable
 using it than the test-udev binary.  (But only slightly.)

 I'm guessing that 2.6.18 is probably the minimum required kernel for this
 method as well, unless "udevadm test" is able to find the required
 information using the old method.  Unfortunately I don't have a bunch of
 kernels to test it on...

 (Actually, the "read from the uevent attribute" code wasn't added to the
 kernel until something more recent than 2.6.18.  But if needed, we should
 -- hopefully -- be able to work around that by setting INTERFACE manually
 before running udevadm.  Google seems to think that the minimum kernel for
 reading from uevent is 2.6.24; I don't have anything older than that
 available to test.)

-- 
Ticket URL: <http://wiki.linuxfromscratch.org/lfs/ticket/2057#comment:45>
LFS Trac <http://wiki.linuxfromscratch.org/lfs/>
Linux From Scratch: Your Distro, Your Rules.



More information about the lfs-book mailing list