Here is a simple rule I created in /etc/udev/rules.d/21-persistent-local.rules for my Seagate 500 GB expansion drive which uses a USB interface on a Debian machine running inside a VM. ACTION==add, ENV{DEVTYPE}==usb_device, ATTRS{ID_SERIAL_SHORT}==NA453QQS, SUBSYSTEM==usb, HOTPLUG == 1, \RUN+=/usr/local/bin/run.shAfter saving this, I run I run udevadm trigger. Finally, I plug in my drive and run udevadm monitor --env to verify if expansion drive is correctly loaded which is indeed the case. Now I define the rule that on the add action, run.sh should run. run.sh has nothing except two sudo insmod foo.ko and sudo rmmod foo.ko. But the script fails to run. Concretely, nothing is printed in dmesg against the script run.sh. The module I load in the kernel prints messages which should be visible when exiting and entering the kernel.What can be the possible reason for this problem?P.S.: In the above rules file, I used both of these against the ATTRS{...}ID_SERIAL=Seagate_Expansion_NA453QQSID_SERIAL_SHORT=NA453QQS
udev rules fail to run a script on addition of usb device
debian;ubuntu;udev;hot plug