Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
What's wrong with this short udev rules file?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
cboscari
n00b
n00b


Joined: 11 Jan 2018
Posts: 4

PostPosted: Sat Jan 13, 2018 2:11 am    Post subject: What's wrong with this short udev rules file? Reply with quote

I'm trying to learn udev rules scripting from Daniel Drake's how to, and I just don't understand why I'm not getting it.

My one rule file looks like this -
Code:
KERNEL=="sd*", SUBSYSTEMS=="scsi", ATTRS{model}=="Elements 107D   ", SYMLINK+="testdrive", GROUP="users"

from the output from this part of unvadm info -a -p /dev/sdb:


Code:
 looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.3/1-1.3:1.0/host10/target10:0:0/10:0:0:0':
    KERNELS=="10:0:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS=="sd"
    ATTRS{evt_soft_threshold_reached}=="0"
    ATTRS{evt_mode_parameter_change_reported}=="0"
    ATTRS{inquiry}==""
    ATTRS{evt_capacity_change_reported}=="0"
    ATTRS{vendor}=="WD      "
    ATTRS{timeout}=="30"
    ATTRS{evt_lun_change_reported}=="0"
    ATTRS{evt_media_change}=="0"
    ATTRS{queue_type}=="none"
    ATTRS{device_busy}=="0"
    ATTRS{eh_timeout}=="10"
    ATTRS{dh_state}=="detached"
    ATTRS{model}=="Elements 107D   "
    ATTRS{iocounterbits}=="32"
    ATTRS{queue_depth}=="1"
    ATTRS{type}=="0"
    ATTRS{evt_inquiry_change_reported}=="0"
    ATTRS{max_sectors}=="240"
    ATTRS{iodone_cnt}=="0x8c"
    ATTRS{state}=="running"
    ATTRS{iorequest_cnt}=="0x8c"
    ATTRS{rev}=="1065"
    ATTRS{ioerr_cnt}=="0x13"
    ATTRS{scsi_level}=="7"
    ATTRS{device_blocked}=="0"

The device label does not skow up in /dev. I'm aware about avoiding using attributes from different sections, I'm avoiding that but using different values from the same driver section still does not mount /dev/sdb at /dev/testdrive like I expect, let alone give me permissions. I unplug the USB drive between rule updates, I think that re-polls the device, but I might be wrong.
Thanks for any help. I never had to deal with anything more complicated than an fstab in the past...

[Moderator edit: added [code] tags to preserve output layout. -Hu]
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Sat Jan 13, 2018 4:01 am    Post subject: Reply with quote

"SUBSYSTEMS" looks like a typo, should be "SUBSYSTEM". Check the output of udevadm info /dev/sdb.
Back to top
View user's profile Send private message
cboscari
n00b
n00b


Joined: 11 Jan 2018
Posts: 4

PostPosted: Sat Jan 13, 2018 4:31 am    Post subject: Reply with quote

I changed it, but it didn't work. The output for the parent device, where the model name of the drive is located, says "SUBSYSTEMS=="scsi", but other devices use "SUBSYSTEM." I think I can only use attributes from the same device in a rule, but I'm still (trying) to learn how these rules file work. I'm off to a bad start.
Chris

UPDATE:

I used the command udevadm test --action="KERNEL" /sys/block/sdb as root and the rule *did* work. It seems to be a permissions issue? Why isn't udev processing this when the usb drive is inserted?

UPDATED: OK, I needed to run udevadm control reload. Now it is working. Also changed the KERNEL rule to ACTION=="add" so thanks everyone.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum