Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use Gentoo. I write a udev rule.

localhost biergaizi # cat /etc/udev/rules.d/91-change-schduler.rules 
#SUBSYSTEMS=="usb", KERNEL=="sd??", ACTION=="add", RUN+="echo deadline > /sys/block/%k/queue/scheduler" 
ACTION=="add", KERNEL=="sd??", RUN+="/usr/local/bin/USB" 

localhost biergaizi # cat /usr/local/bin/USB 
echo 'Hello World!' >>"/home/biergaizi/udev.out" 

localhost biergaizi # ls -l /usr/local/bin/USB 
-rwxr-xr-x 1 root root 66 10月  1 11:55 /usr/local/bin/USB 

But when I plugin a USB device, udev doesn't run the script. Why?

share|improve this question
What are those question marks doing there? – Tom Wijsman Oct 1 '12 at 15:17
up vote 2 down vote accepted

KERNEL=="sd??" matches to the device with a partition table (/dev/sda1) only. If your device doesn't have a partition table (/dev/sda), the rule isn't working.

You can change your rule to KERNEL=="sd?" to detect all kind of device.

share|improve this answer

Your Answer


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.