udev rules in /etc/udev/rules.d/ ignored/not-loaded on boot; exec manually OK at shell ?
pgnd
pgnd at dev-mail.net
Fri Dec 22 13:25:17 UTC 2023
> "enp5s0" is a predictable name how systemd/udev configures them, not
> the kernel. When a netif is renamed then this results in a "move"
> event, not "add" or "bind" or "change".
>
> Generally, in the vast majority of cases rules should be written with
> either a check of ACTION!="remove" or ACTION=="remove" depending on
> whether they should apply if the device is there, or when it goes
> away. The important part here is: don't list the many positive
> actions, but instead only specify the single negative action
> (i.e. "remove"). That's both more robust and safer for future actions
> to be added.
useful, thx.
but still, with
edit /etc/udev/rules.d/99-test.rules
- ACTION=="add|bind|change", SUBSYSTEM=="net", KERNEL=="enp5s0", RUN+="/bin/touch /etc/test-touch.txt"
+ ACTION!="remove", SUBSYSTEM=="net", KERNEL=="enp5s0", RUN+="/bin/touch /etc/test-touch.txt"
after boot, nothing done
ls -al /etc/test-touch.txt
(empty)
and nothing logged,
journalctl -b | grep 99-test
(empty)
but, MOVING the same rule to different location
mv /etc/udev/rules.d/99-test.rules /usr/lib/udev/rules.d/
reboot
then, it *IS* exec'd,
ls -al /etc/test-touch.txt
-rw-r--r-- 1 root root 0 Dec 22 08:20 /etc/test-touch.txt
but still NOT logged
journalctl -b | grep 99-test
(empty)
The questions remain:
Why does the rule FAIL to exec when in /etc/udev/rules.d path, but DOES exec when in /usr/lib/udev/rules.d/ ?
and
Why is the rule read/load not logged in journal ?
More information about the systemd-devel
mailing list