udev rules in /etc/udev/rules.d/ ignored/not-loaded on boot; exec manually OK at shell ?

František Šumšal frantisek at sumsal.cz
Fri Dec 22 14:11:29 UTC 2023


I mean, the output you sent shows that your rule file (99-test.rules) is _not_ in the initrd, so that would explain why it's not applied.

On 12/22/23 14:54, pgnd wrote:
>> Did you regenerate your initrd(s) after adding that rule? I.e. `sudo lsinitrd | grep 99-enp5s0-sysctl.rules ` should show it to make stuff work properly.
> 
> yes, each time.
> 
> cat /etc/udev/rules.d/99-test.rules
>      ACTION!="remove", SUBSYSTEM=="net", KERNEL=="enp5s0", RUN+="/bin/touch /etc/test-touch.txt"
> 
> ls -al /boot/initramfs-$(uname -r).img
>      -rw------- 1 root root 124M Dec 22 08:15 /boot/initramfs-6.6.7-200.fc39.x86_64.img
> 
> (regenerate initramfs)
> ls -al /boot/initramfs-$(uname -r).img
>      -rw------- 1 root root 124M Dec 22 08:51 /boot/initramfs-6.6.7-200.fc39.x86_64.img
> 
> lsinitrd | grep -Ei "rules|test"
>      udev-rules
>      drwxr-xr-x   2 root     root            0 Nov 15 19:00 etc/udev/rules.d
>      -rw-r--r--   1 root     root          142 Dec 24  2022 etc/udev/rules.d/11-dm.rules
>      -rw-r--r--   1 root     root          680 Nov 15 19:00 etc/udev/rules.d/59-persistent-storage-dm.rules
>      -rw-r--r--   1 root     root          853 Nov 15 19:00 etc/udev/rules.d/59-persistent-storage-md.rules
>      -rw-r--r--   1 root     root          297 Nov 15 19:00 etc/udev/rules.d/59-persistent-storage.rules
>      -rw-r--r--   1 root     root         1030 Nov 15 19:00 etc/udev/rules.d/61-persistent-storage.rules
>      -rw-r--r--   1 root     root         1308 Dec 24  2022 etc/udev/rules.d/64-lvm.rules
>      -rw-r--r--   1 root     root         1455 Dec 24  2022 etc/udev/rules.d/65-md-incremental-imsm.rules
>      -rwxr-xr-x   1 root     root         1148 Dec 24  2022 usr/lib/dracut/hooks/pre-udev/50-ifname-genrules.sh
>      -rw-r--r--   1 root     root         5584 Nov 15 19:00 usr/lib/modules/6.6.7-200.fc39.x86_64/kernel/crypto/async_tx/raid6test.ko.xz
>      drwxr-xr-x   2 root     root            0 Nov 15 19:00 usr/lib/udev/rules.d
>      -rw-r--r--   1 root     root         7218 Aug  1 20:00 usr/lib/udev/rules.d/10-dm.rules
>      -rw-r--r--   1 root     root         2424 Aug  1 20:00 usr/lib/udev/rules.d/11-dm-lvm.rules
>      -rw-r--r--   1 root     root         2217 Aug  1 20:00 usr/lib/udev/rules.d/13-dm-disk.rules
>      -rw-r--r--   1 root     root         5268 Nov 15 19:00 usr/lib/udev/rules.d/50-udev-default.rules
>      -rw-r--r--   1 root     root          703 Nov 15 19:00 usr/lib/udev/rules.d/60-block.rules
>      -rw-r--r--   1 root     root         1071 Nov 15 19:00 usr/lib/udev/rules.d/60-cdrom_id.rules
>      -rw-r--r--   1 root     root         8677 Nov 15 19:00 usr/lib/udev/rules.d/60-persistent-storage.rules
>      -rw-r--r--   1 root     root         2631 Jul 19 20:00 usr/lib/udev/rules.d/63-md-raid-arrays.rules
>      -rw-r--r--   1 root     root          616 Nov 15 19:00 usr/lib/udev/rules.d/64-btrfs.rules
>      -rw-r--r--   1 root     root         2259 Nov 15 19:00 usr/lib/udev/rules.d/64-md-raid-assembly.rules
>      -rw-r--r--   1 root     root         3311 Nov 15 19:00 usr/lib/udev/rules.d/70-uaccess.rules
>      -rw-r--r--   1 root     root          995 Jul 18 20:00 usr/lib/udev/rules.d/71-biosdevname.rules
>      -rw-r--r--   1 root     root         3818 Nov 15 19:00 usr/lib/udev/rules.d/71-seat.rules
>      -rw-r--r--   1 root     root          643 Nov 15 19:00 usr/lib/udev/rules.d/73-seat-late.rules
>      -rw-r--r--   1 root     root          452 Nov 15 19:00 usr/lib/udev/rules.d/75-net-description.rules
>      -rw-r--r--   1 root     root          600 Nov 15 19:00 usr/lib/udev/rules.d/80-drivers.rules
>      -rw-r--r--   1 root     root          295 Nov 15 19:00 usr/lib/udev/rules.d/80-net-setup-link.rules
>      -rw-r--r--   1 root     root         2013 Aug  9 12:04 usr/lib/udev/rules.d/85-nm-unmanaged.rules
>      -rw-r--r--   1 root     root          518 Nov 15 19:00 usr/lib/udev/rules.d/90-vconsole.rules
>      -rw-r--r--   1 root     root          483 Aug  1 20:00 usr/lib/udev/rules.d/95-dm-notify.rules
>      -rw-r--r--   1 root     root         5117 Nov 15 19:00 usr/lib/udev/rules.d/99-systemd.rules
> 
> 


More information about the systemd-devel mailing list