Bug 383320

Summary: udev creates wrong persistent net rules for wlan interfaces
Product: [openSUSE] openSUSE 11.0 Reporter: Christopher Stender <cstender>
Component: YaST2Assignee: Michal Zugec <mzugec>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Major    
Priority: P5 - None CC: casualprogrammer, mt
Version: Beta 1   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Christopher Stender 2008-04-24 12:26:48 UTC
After a fresh beta1 installation the persistent-net-rules file does not contain the ATTR{type}=="1". Without the attribute udev tries to rename wmaster0 to wlan0  while booting. This fails (because wlan0 is already there) and blocks the boot process for 30seconds.

/etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:19:d2:06:b5:2c", KERNEL=="wlan*", NAME="wlan0"

If I delete the wrong line in 70-persistent-net.rules and reload the iwl3945 module, udev creates the following new rule:

# PCI device 0x8086:0x4227 (iwl3945)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:19:d2:06:b5:2c", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"
Comment 1 Michal Zugec 2008-04-24 12:33:12 UTC
*** Bug 378758 has been marked as a duplicate of this bug. ***
Comment 2 Kay Sievers 2008-04-24 16:16:02 UTC
I guess it's Yast who adds these incomplete rules. It should better not do that at all, it will get far too complicated to duplicate all the logic we will have in udev.
Comment 3 Michal Zugec 2008-04-24 18:32:39 UTC
Kay: no, YaST just edit, not create that rules
Comment 4 Kay Sievers 2008-04-24 18:43:12 UTC
I do not think, that udev does create rules like this. :)

Isn't this:
  rules = add(rules, sformat("SUBSYSTEM==\"net\", \
  DRIVERS==\"?*\", %1==\"%2\", NAME=\"%3\"", \
  rule["rule"]:"", rule["value"]:"", rule["name"]:""));
in:
  /usr/share/YaST2/modules/LanUdevAuto.ycp
doing that?
Comment 6 Kay Sievers 2008-04-24 19:17:18 UTC
Why is the default install broken then? I do not see any reason for yast to rewrite udev's rules in that case.

Yast can "edit" the file, as long as "edit" means nothing else than changing the NAME= key.

No, there is no facility to compose rules outside of udev. We already needed to change the rule creation logic several times, and will probably need to continue to do so, because of new hardware, buses, which do weird things, we need to work around.
Comment 7 Michal Zugec 2008-04-24 19:29:26 UTC
... nothing else than changing the NAME= key.
or rule.

and yes, I see that mechanism should be changed

Comment 8 Michal Zugec 2008-05-06 15:25:27 UTC
I rewrited all that code but have some problems with udev:
- there is no "udevtest" tool anymore
- udev rules matches only by MAC address, no BusID (in 10.3 I used KERNELS for that)
- when I change NAME value, it's ignored and created new rule

Kay, can you help here?
Comment 9 Kay Sievers 2008-05-06 19:44:56 UTC
(In reply to comment #8 from Michal Zugec)
> I rewrited all that code but have some problems with udev:
> - there is no "udevtest" tool anymore

It is a debugging tool, it may change its output any time. Newer udev versions have only a single binary, which can be called as:
  /sbin/udevadm test <devpath>
But still, do not use it in any software, it's output is not stable in any sense.

> - udev rules matches only by MAC address, no BusID (in 10.3 I used KERNELS for
> that)
> - when I change NAME value, it's ignored and created new rule

If NAME= is set in any earlier rule, the udev persistent net generator should ignore the network interface completely.

I guess yast should create and maintain its own rules file, which comes before 70-persistent-net.rules, instead of patching the udev maintained one.
Comment 10 Michal Zugec 2008-05-07 06:47:32 UTC
Thanks for explanation.
udevtest - just to debug, I'm not use it in code

NAME - I have a typo, already fixed


>> I guess yast should create and maintain its own rules file, which comes before
>> 70-persistent-net.rules, instead of patching the udev maintained one.

I don't think we can change it for 11.0 (too late). Why there is comment "You can modify it, as long as you keep each rule on a single line."
But yast code is now much better, it keeps all and change only needed options (ATTR{address}, KERNELS and NAME)

There is only one issue - how to "match by BusID" instead of MAC address? This was probably changed from 10.3 (it works with KERNELS rule)
Comment 11 Kay Sievers 2008-05-07 08:16:49 UTC
It sh(In reply to comment #10 from Michal Zugec)
> Thanks for explanation.
> udevtest - just to debug, I'm not use it in code

Ah, good.

> NAME - I have a typo, already fixed

Fine.

> >> I guess yast should create and maintain its own rules file, which comes before
> >> 70-persistent-net.rules, instead of patching the udev maintained one.
> 
> I don't think we can change it for 11.0 (too late). Why there is comment "You
> can modify it, as long as you keep each rule on a single line."
> But yast code is now much better, it keeps all and change only needed options
> (ATTR{address}, KERNELS and NAME)
> 
> There is only one issue - how to "match by BusID" instead of MAC address? This
> was probably changed from 10.3 (it works with KERNELS rule)

It should still work the same way, if the rule still matches and sets NAME=. There is was no change regarding matching parent device properties.

But it's tricky, as there is hardware out, where the same device offers multiple interfaces with the same type. On such boxes, it might not work as expected without figuring out how to distinguish them properly. That's why we are adding all these keys with the new udev rules now.
Comment 12 Michal Zugec 2008-05-09 06:59:58 UTC
*** Bug 384660 has been marked as a duplicate of this bug. ***
Comment 13 Casual J. Programmer 2008-05-09 07:14:37 UTC
*** Bug 388439 has been marked as a duplicate of this bug. ***
Comment 14 Michal Zugec 2008-05-09 07:57:09 UTC
fixed on running system, but it needs to be fixed in AY-part (to be back-compatible). For AY I created bug #388593