web-dev-qa-db-ja.com

このudevルールの何が問題になっていますか?

私はこれを読んでいます link 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]*"。それもうまくいきませんでした。

重要な場合、これはCentOS6.2にあります。


以下のslmで提案されているように、質問を更新してudevadm testの出力を表示します。ルールファイルの名前を/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'
4
Andrew Falanga

ルールファイルの名前を変更して、接頭辞として番号を付けてみてください。おそらくこのようなもの:

/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

参考文献

0
slm