im trying to create a udev symlink rule:
Here is what i have written so far which doesnt seem to work:
ACTION=="add", SUBSYSTEM=="block", ATTR{size}=="60626944", ATTRS{model}=="USB DISK 2.0 ", SYMLINK+="integralusb"
The device i am trying to create a SYMlink on upon plugging in is a USB thumb-drive. Here is the output of udevadm info --query=all /dev/sdb
udevadm info --query=all /dev/sdb
P: /devices/pci0000:00/0000:00:10.0/usb2/2-3/2-3:1.0/host2/target2:0:0/2:0:0:0/block/sdb
N: sdb
L: 0
S: disk/by-id/usb-_USB_DISK_2.0_900074BF37B00367-0:0
S: disk/by-path/pci-0000:00:10.0-usb-0:3:1.0-scsi-0:0:0:0
E: DEVPATH=/devices/pci0000:00/0000:00:10.0/usb2/2-3/2-3:1.0/host2/target2:0:0/2:0:0:0/block/sdb
E: DEVNAME=/dev/sdb
E: DEVTYPE=disk
E: MAJOR=8
E: MINOR=16
E: SUBSYSTEM=block
E: USEC_INITIALIZED=5783303806
E: ID_VENDOR_ENC=\x20\x20\x20\x20\x20\x20\x20\x20
E: ID_VENDOR_ID=26bd
E: ID_MODEL=USB_DISK_2.0
E: ID_MODEL_ENC=USB\x20DISK\x202.0\x20\x20\x20\x20
E: ID_MODEL_ID=9917
E: ID_REVISION=PMAP
E: ID_SERIAL=_USB_DISK_2.0_900074BF37B00367-0:0
E: ID_SERIAL_SHORT=900074BF37B00367
E: ID_TYPE=disk
E: ID_INSTANCE=0:0
E: ID_BUS=usb
E: ID_USB_INTERFACES=:080650:
E: ID_USB_INTERFACE_NUM=00
E: ID_USB_DRIVER=usb-storage
E: ID_PATH=pci-0000:00:10.0-usb-0:3:1.0-scsi-0:0:0:0
E: ID_PATH_TAG=pci-0000_00_10_0-usb-0_3_1_0-scsi-0_0_0_0
E: ID_PART_TABLE_TYPE=dos
E: DEVLINKS=/dev/disk/by-id/usb-_USB_DISK_2.0_900074BF37B00367-0:0 /dev/disk/by-path/pci-0000:00:10.0-usb-0:3:1.0-scsi-0:0:0:0
E: TAGS=:systemd:
I have no idea what i have done wrong, i am new to creating udev rules but this looks okay to me.
udevadm info --attribute-walk /dev/sdb
to extract the matching part of your udev rule. If not, please check if there are any inadvertant typos. If you debug your rule e.g. by replacing theSYMLINK
directive with something likeRUN="/usr/bin/touch /tmp/rule_processed.txt"
, do you see that this temporary file is created when you add the device?udevadm info -a /dev/sdb
, this showsATTR{size}=="468862128"
for me, with sda. To debug also use "udevadm monitor ...". (I found my RUNs only failed in journalctl ;).udevadm info --attribute-walk
is the correct approach to get the necessary info for writing a udev rule. My first comment was only meant in case you had obtained the attribute values by some other means so that you could check with the output ofudevadm
if maybe there is some trivial typo. BTW, doesjournalctl
show any udev error messages when you plug in the device (which might hint at syntax errors or similar)?