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?
100 comes before 80, at least in filenames...
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 )
Last edited by x_puma_x (2013-08-22 18:00:23)
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"
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?
I couldn't tell you without you actually providing more information about what your system might be telling you.
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: 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