38

I've written a udev rule which is run each time my device is mounted/dismounted.

However, in which Linux (Debian) error log should I check when debugging such rules?

Karlson
  • 5,845
  • 32
  • 51
eoinoc
  • 1,841
  • 7
  • 23
  • 30

2 Answers2

30

You can change logging priority to "info" level or even "debug" by:

udevadm control --log-priority=info

Then you should see all logs in your system log. If you don't, then rsyslogd may not be configured to read kernel logs and you may still view the kernel logs using dmesg.

When you are done, bring it to default "err". See in /etc/udev/udev.conf what is your default logging level.

Chris Hunt
  • 309
  • 3
  • 10
Michał Šrajer
  • 2,808
  • 17
  • 17
  • I am confused why there are two points of configuration for logging priority. Care to explain how `udevadm control --log-priority=info` is different from setting `udev_log="err"` in `/etc/udev/udev.conf`? Thanks – silvernightstar Aug 29 '15 at 10:16
  • 5
    The `udevadm`method is to change the logging priority of the _running_ `udevd`; `udev.conf` is for permanently changing it. – boycy Sep 06 '15 at 15:25
  • Log priority `info` was not sufficient for me to see logs in `journalctl`; I needed to bump it to `debug`. – Joe Dec 29 '22 at 19:16
12

unbuffer udevadm monitor --environment The use of unbuffer is optional, but when piping output to grep saves you a headache. By default output is buffered in 4k blocks, nothing will be printed until that buffer is full.

You didn't forget to reload the rules? sudo udevadm control --reload

jippie
  • 13,756
  • 10
  • 44
  • 64
  • 1
    Should be noted that `unbuffer` is not installed by default on Debian. – enzotib Apr 11 '12 at 19:14
  • 2
    That's correct, it is in the expect-dev package. It can be installed by `sudo apt-get install expect-dev` un Debian/Ubuntu. – jippie Apr 11 '12 at 19:21