Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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 am using libusb to contact with a printer. And I am writing a rule for udev to remove the printer when it is disconnected. I use symlink to indicate the device. But when removing, the rule is not triggered. What should I do?

ATTRS{manufacturer}=="Zebra Technologies", ACTION=="add", RUN+="/usr/local/bin/", SYMLINK+="usblp%k"
SYMLINK=="usblp%k", ACTION=="remove", RUN+="/usr/local/bin/"
share|improve this question
  • %k (variables) are not to be used in the rule matching condition.

    String substitutions

    When writing rules which will potentially handle multiple similar devices, udev's printf-like string substitution operators are very useful. You can simply include these operators in any assignments your rule makes, and udev will evaluate them when they are executed.

    Source: Writing udev rules by Daniel Drake (dsd)

  • Use directly same add condition (you have chosen a long path):

    ATTRS{manufacturer}=="Zebra Technologies", ACTION=="remove", RUN+="/usr/local/bin/"
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.