How to check if a udev rule fired?

With udev / systemd version 241 and similar, as root:

udevadm control --log-priority=debug
journalctl -f

Or to make it permanent, again as root:

vi /etc/udev/udevd.conf
systemctl restart systemd-udevd
journalctl -f

PS: the most frequent yet IMHO wrong answer looks like:

udevadm -d test /devices/where/is/my/device |& less

... but this has a number of issues. The main ones:

  • where/is/my/device ? Tedious, complicated and error-prone.

  • Comparing old answers to recent udev version 241 output, udevadm test seems to show less information that it used to.

  • udevadm -d test is only a simulation! Every time it warns:

    This program is for debugging only, it does not run any program specified by a RUN key. It may show incorrect results, because some values may be different, or not available at a simulation run.

udevadm test is for developing a new rule, it's not for troubleshooting broken, missing or overridden rules.


udevadm test $(udevadm info --query=path --name=device_name) should tell you which commands would be executed on a device plug in, citing the udev rules involved. For instance:

# udevadm test /block/sdd
...
udev_rules_apply_to_event: PROGRAM '/sbin/multipath -c /dev/sdd' /lib/udev/rules.d/40-multipath.rules:11
...

I'm pretty sure this should work. Did you reload your udev rules after editing your rules?

udevadm control --reload-rules && udevadm trigger as root.


I'm running kernel 3.0.35, but the following works for me.

To get the path for the device you can do something like this:

udevadm info --name /dev/sda1 --query all

You will get more information than you need but you're interested in the DEVPATH. Then to see what udev rules are executed you run this:

udevadm test DEVPATH

I don't think this actually executes the rules, the documentation says this 'simulates' the events for the given device. To get more information, check out this man page: https://www.freedesktop.org/software/systemd/man/udevadm.html


You can give a command as root like this:

udevadm monitor

It will show when a rule has fired.