You are not logged in.

#1 2013-08-22 17:23:32

x_puma_x
Member
Registered: 2010-03-20
Posts: 11

question regarding systemd/udev and PredictableNetworkInterfaceNames

Hey,

I want to enable WOL for my ethernet-card using a udev-rule and have some problems understanding udev's behaviour.
I've created the following file which works perfectly:

$ cat /etc/udev/rules.d/100-wol.rules
ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth0", RUN+="/usr/bin/ethtool -s %k wol g"

But /usr/lib/udev/rules.d/80-net-name-slot.rules renames the interface to enp3s0.
So my question is:
If 80-net-name-slot.rules renames the device to enp3s0 and my rules-file is executed afterwards (starts with 100), why does the above rule work. Shouldn't this one work?:

$ cat /etc/udev/rules.d/100-wol.rules
ACTION=="add", SUBSYSTEM=="net", KERNEL=="enp3s0", RUN+="/usr/bin/ethtool -s %k wol g"

Does anyone know why the first script works instead of the second one?

Offline

#2 2013-08-22 17:37:55

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: question regarding systemd/udev and PredictableNetworkInterfaceNames

100 comes before 80, at least in filenames... wink

Offline

#3 2013-08-22 17:59:42

x_puma_x
Member
Registered: 2010-03-20
Posts: 11

Re: question regarding systemd/udev and PredictableNetworkInterfaceNames

Oh. Hehe. Of course it does. *shame on me*

But the "problem" still exists after renaming 100-wol.rules to 99-wol.rules (which REALLY comes AFTER 80 big_smile )

Last edited by x_puma_x (2013-08-22 18:00:23)

Offline

#4 2013-08-22 18:14:32

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: question regarding systemd/udev and PredictableNetworkInterfaceNames

I do it by the driver of the card rather than the kernel name.  That way, no matter what the system wants to name the thing it will be matched.  So I have:

ACTION=="add", SUBSYSTEM=="net", DRIVERS=="r8168", RUN+="/usr/bin/ethtool -s %k wol d"

Offline

#5 2013-08-22 18:20:02

x_puma_x
Member
Registered: 2010-03-20
Posts: 11

Re: question regarding systemd/udev and PredictableNetworkInterfaceNames

@WonderWoofy:
I have a working solution, too.

But i just wondered why this is the way it is :-)

$ cat /etc/udev/rules.d/99-wol.rules
ACTION=="add", SUBSYSTEM=="net", KERNEL=="e*", RUN+="/usr/bin/touch /%k"

creates the file /enp3s0

I don't understand this. Is it some kind of race-condition thing or what is it?

Offline

#6 2013-08-22 18:27:09

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: question regarding systemd/udev and PredictableNetworkInterfaceNames

I couldn't tell you without you actually providing more information about what your system might be telling you.

Offline

#7 2013-08-22 18:30:11

x_puma_x
Member
Registered: 2010-03-20
Posts: 11

Re: question regarding systemd/udev and PredictableNetworkInterfaceNames

What info do you need? I don't really know what else to provide.

Does this help?:

$ dmesg | grep -E "enp3s0|eth0"
[    2.146664] sky2 0000:03:00.0 eth0: addr 00:23:8b:16:df:4c
[    2.430154] systemd-udevd[142]: renamed network interface eth0 to enp3s0
[    3.919376] sky2 0000:03:00.0 enp3s0: enabling interface
[    3.919453] IPv6: ADDRCONF(NETDEV_UP): enp3s0: link is not ready 

Offline

Board footer

Powered by FluxBB