Page Contents
Monitor udev rules when devices are plugged/unplugged
udevadm monitor
Reload the udev rules without restart/logout
sudo udevadm control --reload
Note it might not seem like this is always necessary but if you skipp this command then you will get false positives and false negatives. After making changes to the .rule file, you should unplug the device first and then run the command second.
Print all debug to systemd logs
Useful if you have a secondary action tied to your udev rules and its failing to execute. This log output will show any internal/hidden error
udevadm control --log-priority=debug
journalctl -f
For example, if i have the following script (with execution perms):
chris@chris-MacBookPro:~$ cat /usr/local/bin/trigger.sh
#!/bin/bash
badcmd >> /tmp/udev.log
and the following udev rule:
chris@chris-MacBookPro:~$ cat /etc/udev/rules.d/99-foobar.rules
SUBSYSTEM=="usb", ACTION=="add", RUN+="/usr/local/bin/trigger.sh"
then I see the following output from the journelctl -f
command:
.....
Oct 09 22:24:41 chris-MacBookPro systemd-udevd[4682]: 3-1:1.1: Process '/usr/local/bin/trigger.sh' failed with exit code 127.
......
(Yes, I am runing Ubuntu on an old macbook)