Centos
這個 udev 規則有什麼問題?
我正在閱讀此連結以嘗試制定適當的規則以使 BSG 設備節點具有輪組所有權和 0660 權限。這是我擁有的規則:
[user@mylinux ~]$ cat /etc/udev/rules.d/bsg.rules NAME=="bsg/[0-9]:[0-9]:[0-9]:[0-9]", SUBSYSTEM=="bsg", GROUP=wheel, MODE=0660
但它不起作用,如下所示:
[user@mylinux ~]$ ls -l /dev/bsg total 0 crw-rw---- 1 root root 252, 0 Oct 30 06:02 0:0:0:0
udevadm info -q all -n /dev/bsg/0:0:0:0
這是我要去的輸出:P: /devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0 N: bsg/0:0:0:0 S: char/252:0 E: UDEV_LOG=3 E: DEVPATH=/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0 E: MAJOR=252 E: MINOR=0 E: DEVNAME=/dev/bsg/0:0:0:0 E: SUBSYSTEM=bsg E: DEVLINKS=/dev/char/252:0
現在,我假設該值
N: bsg/0:0:0:0
是udev 在規則文件中所期望的**NAME鍵。**最終,我需要讓這條規則足夠通用,以便任何數量的 BSG 設備都可以適當地更改權限。NAME="bsg/[0-9]*:[0-9]*:[0-9]*:[0-9]*"
。_ 那也行不通。萬一這很重要,這是在 CentOS 6.2 上。
更新問題以顯示
udevadm test
以下 slm 建議的輸出。我已將規則文件的名稱更改為/etc/udev/rules.d/80-bsg.rules
. 文件名似乎是唯一的。文件內容尚未更改。這是來自的輸出udevadm test
:parse_file: reading '/lib/udev/rules.d/10-console.rules' as rules file parse_file: reading '/lib/udev/rules.d/10-dm.rules' as rules file parse_file: reading '/lib/udev/rules.d/11-dm-lvm.rules' as rules file parse_file: reading '/lib/udev/rules.d/13-dm-disk.rules' as rules file parse_file: reading '/etc/udev/rules.d/40-hplip.rules' as rules file parse_file: reading '/lib/udev/rules.d/40-isdn.rules' as rules file parse_file: reading '/lib/udev/rules.d/40-libgphoto2.rules' as rules file parse_file: reading '/lib/udev/rules.d/40-multipath.rules' as rules file parse_file: reading '/lib/udev/rules.d/40-redhat.rules' as rules file parse_file: reading '/lib/udev/rules.d/50-firmware.rules' as rules file parse_file: reading '/lib/udev/rules.d/50-udev-default.rules' as rules file parse_file: reading '/etc/udev/rules.d/56-hpmud_support.rules' as rules file parse_file: reading '/lib/udev/rules.d/60-cdrom_id.rules' as rules file parse_file: reading '/etc/udev/rules.d/60-fprint-autosuspend.rules' as rules file parse_file: reading '/lib/udev/rules.d/60-net.rules' as rules file parse_file: reading '/etc/udev/rules.d/60-pcmcia.rules' as rules file parse_file: reading '/lib/udev/rules.d/60-persistent-alsa.rules' as rules file parse_file: reading '/lib/udev/rules.d/60-persistent-input.rules' as rules file parse_file: reading '/lib/udev/rules.d/60-persistent-serial.rules' as rules file parse_file: reading '/lib/udev/rules.d/60-persistent-storage-tape.rules' as rules file parse_file: reading '/lib/udev/rules.d/60-persistent-storage.rules' as rules file parse_file: reading '/lib/udev/rules.d/60-persistent-v4l.rules' as rules file parse_file: reading '/etc/udev/rules.d/60-raw.rules' as rules file parse_file: reading '/lib/udev/rules.d/61-mobile-action.rules' as rules file parse_file: reading '/lib/udev/rules.d/61-option-modem-modeswitch.rules' as rules file parse_file: reading '/lib/udev/rules.d/61-persistent-storage-edd.rules' as rules file parse_file: reading '/lib/udev/rules.d/64-device-mapper.rules' as rules file parse_file: reading '/lib/udev/rules.d/64-md-raid.rules' as rules file parse_file: reading '/lib/udev/rules.d/65-libsane.rules' as rules file parse_file: reading '/lib/udev/rules.d/65-md-incremental.rules' as rules file parse_file: reading '/lib/udev/rules.d/70-acl.rules' as rules file parse_file: reading '/lib/udev/rules.d/70-anaconda.rules' as rules file parse_file: reading '/etc/udev/rules.d/70-cups-libusb.rules' as rules file parse_file: reading '/lib/udev/rules.d/70-hid2hci.rules' as rules file parse_file: reading '/etc/udev/rules.d/70-persistent-net.rules' as rules file parse_file: reading '/lib/udev/rules.d/70-printers.rules' as rules file parse_file: reading '/lib/udev/rules.d/75-cd-aliases-generator.rules' as rules file parse_file: reading '/lib/udev/rules.d/75-net-description.rules' as rules file parse_file: reading '/lib/udev/rules.d/75-persistent-net-generator.rules' as rules file parse_file: reading '/lib/udev/rules.d/75-tty-description.rules' as rules file parse_file: reading '/lib/udev/rules.d/77-mm-ericsson-mbm.rules' as rules file parse_file: reading '/lib/udev/rules.d/77-mm-longcheer-port-types.rules' as rules file parse_file: reading '/lib/udev/rules.d/77-mm-pcmcia-device-blacklist.rules' as rules file parse_file: reading '/lib/udev/rules.d/77-mm-platform-serial-whitelist.rules' as rules file parse_file: reading '/lib/udev/rules.d/77-mm-simtech-port-types.rules' as rules file parse_file: reading '/lib/udev/rules.d/77-mm-usb-device-blacklist.rules' as rules file parse_file: reading '/lib/udev/rules.d/77-mm-zte-port-types.rules' as rules file parse_file: reading '/lib/udev/rules.d/77-nm-olpc-mesh.rules' as rules file parse_file: reading '/lib/udev/rules.d/78-sound-card.rules' as rules file parse_file: reading '/lib/udev/rules.d/79-fstab_import.rules' as rules file parse_file: reading '/etc/udev/rules.d/80-bsg.rules' as rules file parse_file: reading '/lib/udev/rules.d/80-drivers.rules' as rules file parse_file: reading '/lib/udev/rules.d/80-udisks.rules' as rules file parse_file: reading '/lib/udev/rules.d/85-regulatory.rules' as rules file parse_file: reading '/lib/udev/rules.d/88-clock.rules' as rules file parse_file: reading '/etc/udev/rules.d/90-alsa.rules' as rules file parse_file: reading '/etc/udev/rules.d/90-hal.rules' as rules file parse_file: reading '/lib/udev/rules.d/90-pulseaudio.rules' as rules file parse_file: reading '/etc/udev/rules.d/91-drm-modeset.rules' as rules file parse_file: reading '/lib/udev/rules.d/95-devkit-power-battery-recall-dell.rules' as rules file parse_file: reading '/lib/udev/rules.d/95-devkit-power-battery-recall-fujitsu.rules' as rules file parse_file: reading '/lib/udev/rules.d/95-devkit-power-battery-recall-gateway.rules' as rules file parse_file: reading '/lib/udev/rules.d/95-devkit-power-battery-recall-ibm.rules' as rules file parse_file: reading '/lib/udev/rules.d/95-devkit-power-battery-recall-lenovo.rules' as rules file parse_file: reading '/lib/udev/rules.d/95-devkit-power-battery-recall-toshiba.rules' as rules file parse_file: reading '/lib/udev/rules.d/95-devkit-power-csr.rules' as rules file parse_file: reading '/lib/udev/rules.d/95-devkit-power-hid.rules' as rules file parse_file: reading '/lib/udev/rules.d/95-devkit-power-wup.rules' as rules file parse_file: reading '/lib/udev/rules.d/95-dm-notify.rules' as rules file parse_file: reading '/lib/udev/rules.d/95-keymap.rules' as rules file parse_file: reading '/lib/udev/rules.d/95-udev-late.rules' as rules file parse_file: reading '/etc/udev/rules.d/98-kexec.rules' as rules file parse_file: reading '/etc/udev/rules.d/99-fuse.rules' as rules file parse_file: reading '/dev/.udev/rules.d/99-root.rules' as rules file udev_rules_new: rules use 141480 bytes tokens (11790 * 12 bytes), 29125 bytes buffer udev_rules_new: temporary index used 50200 bytes (2510 * 20 bytes) udev_device_new_from_syspath: device 0x89af120 has devpath '/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0' udev_device_new_from_syspath: device 0x89c7ac0 has devpath '/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0' udev_device_read_db: device 0x89c7ac0 filled with db symlink data '/dev/bsg/0:0:0:0' udev_rules_apply_to_event: LINK 'char/252:0' /lib/udev/rules.d/50-udev-default.rules:4 udev_device_new_from_syspath: device 0x89b0d48 has devpath '/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0' udev_rules_apply_to_event: RUN 'socket:@/org/freedesktop/hal/udev_event' /etc/udev/rules.d/90-hal.rules:2 udev_event_execute_rules: no node name set, will use kernel supplied name 'bsg/0:0:0:0' udev_device_update_db: create db link (bsg/0:0:0:0 char/252:0) udev_device_update_db: unable to create db file '/dev/.udev/db/bsg:0:0:0:0': No such file or directory udev_node_add: creating device node '/dev/bsg/0:0:0:0', devnum=252:0, mode=0660, uid=0, gid=0 udev_node_mknod: preserve file '/dev/bsg/0:0:0:0', because it has correct dev_t udev_node_mknod: preserve permissions /dev/bsg/0:0:0:0, 020660, uid=0, gid=0 node_symlink: preserve already existing symlink '/dev/char/252:0' to '../bsg/0:0:0:0' udevadm_test: UDEV_LOG=6 udevadm_test: DEVPATH=/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0 udevadm_test: MAJOR=252 udevadm_test: MINOR=0 udevadm_test: DEVNAME=/dev/bsg/0:0:0:0 udevadm_test: ACTION=add udevadm_test: SUBSYSTEM=bsg udevadm_test: DEVLINKS=/dev/char/252:0 udevadm_test: run: 'socket:@/org/freedesktop/hal/udev_event'
嘗試更改規則文件的名稱,使其以數字為前綴。也許是這樣的:
/etc/udev/rules.d/99-bsg.rules
您也可以使用以下方法測試您的規則文件
udevadm test
:$ udevadm test /devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0
參考