udev 在重启后不会自动加载规则

udev 在重启后不会自动加载规则

我有一条规则应该应用于/dev/ipmi0更改其组和模式。当我重新启动时,该节点显示为 root:root,但如果我运行“测试”,它会成功应用它:

$ cat /etc/udev/rules.d/99-ipmi-nonroot.rules
SUBSYSTEM=="ipmi", KERNEL=="ipmi0", GROUP="adm", MODE="0660"

$ ls -l /dev/ipmi*
crw------- 1 root root 244, 0 Jul  6 16:57 /dev/ipmi0

$ sudo udevadm test /sys/class/ipmi/ipmi0
....
Reading rules file: /lib/udev/rules.d/97-dmraid.rules
Reading rules file: /etc/udev/rules.d/99-ipmi-nonroot.rules
Reading rules file: /lib/udev/rules.d/99-systemd.rules
rules contain 49152 bytes tokens (4096 * 12 bytes), 14763 bytes strings
2054 strings (26612 bytes), 1334 de-duplicated (12570 bytes), 721 trie nodes used
GROUP 4 /etc/udev/rules.d/99-ipmi-nonroot.rules:1
MODE 0660 /etc/udev/rules.d/99-ipmi-nonroot.rules:1
handling device node '/dev/ipmi0', devnum=c244:0, mode=0660, uid=0, gid=4
preserve permissions /dev/ipmi0, 020660, uid=0, gid=4
preserve already existing symlink '/dev/char/244:0' to '../ipmi0'
ACTION=add
DEVNAME=/dev/ipmi0
...

$ ls -l /dev/ipmi*
crw-rw---- 1 root adm 244, 0 Jul  6 17:00 /dev/ipmi0

我也试过udev trigger 正如在这个答案中看到的那样。它还会将组更改为adm,但重启后也不会“保留”。我应该将规则置于/lib而不是 之下吗/etc?感觉不对。

相关内容