udev rules in /etc/udev/rules.d/ ignored/not-loaded on boot; exec manually OK at shell ?
Lennart Poettering
lennart at poettering.net
Fri Dec 22 13:07:41 UTC 2023
On Fr, 22.12.23 07:34, pgnd (pgnd at dev-mail.net) wrote:
> > ANY valid rule I add -- there -- fails to be read / loaded ...
>
> e.g.,
>
> cat /etc/udev/rules.d/99-test.rules
> ACTION=="add|bind|change", SUBSYSTEM=="net", KERNEL=="enp5s0", RUN+="/bin/touch /etc/test-touch.txt"
"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.
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list