Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm reading through this link in trying to make the appropriate rule to make the BSG device nodes have group ownership of wheel and permissions of 0660. This is the rule that I have:

[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

But it's not working, as this shows:

[user@mylinux ~]$ ls -l /dev/bsg
total 0
crw-rw---- 1 root root 252, 0 Oct 30 06:02 0:0:0:0

Here's the output from udevadm info -q all -n /dev/bsg/0:0:0:0 on which I'm going:

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

Now, I'm assuming that the value N: bsg/0:0:0:0 is the NAME key that udev is expecting in the rule file. Ultimately, I need to have this rule generic enough that any number of BSG devices will be appropriately changed for permissions. The NAME="bsg/[0-9]*:[0-9]*:[0-9]*:[0-9]*". That wasn't working either.

In case it matters, this is on CentOS 6.2.


Updating question to show output of udevadm test as suggested by slm below. I have changed the name of my rules file to /etc/udev/rules.d/80-bsg.rules. The file name seems to be unique. No changes as yet to the file contents. Here's the output from 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'
share|improve this question

1 Answer 1

Try changing the name of your rule file so that it is prefixed with a number. Perhaps something like this:

/etc/udev/rules.d/99-bsg.rules

Also you can test your rule file using udevadm test:

$ udevadm test /devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0

References

share|improve this answer
    
I was thinking about this because all other rule files had a numerical prefix. Interestingly, the test directive to udevadm did find the rule file without this prefix. I've renamed it anyway. However, how am I supposed to know what udevadm is telling me? It appears to be ignoring my rule. Here's some output: udev_node_add: creating device node '/dev/bsg/0:0:0:0', devnum=252:0, mode=0660, uid=0, gid=0 The mode is set correctly (coincidence actually) but the gid is still that of root. –  Andrew Falanga Oct 31 '13 at 18:36
    
@AndrewFalanga - I thought I read somewhere that they needed to contain numbers. –  slm Oct 31 '13 at 18:46
    
@AndrewFalanga - can you update your Q w/ these results? I don't understand what you're saying in the comment. –  slm Oct 31 '13 at 18:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.