0

I have two udev rules :

ls -l /etc/udev/rules.d/
total 16
lrwxrwxrwx 1 root root   73 23.01.2018 10:37 95-monitor-hotplug.rules -> /home/remi/projects/github_gists/monitor_hotplug/95-monitor-hotplug.rules
-rw-r--r-- 1 root root  123 30.01.2018 19:32 95-monitor-hotplug-test.rules

with these contents :

cat /etc/udev/rules.d/95-monitor-hotplug-test.rules
ACTION=="change", KERNEL=="card[0-9]", SUBSYSTEM=="drm", RUN+="/bin/bash -c \"/usr/bin/date > /tmp/monitor_hotplug_date\""

cat /etc/udev/rules.d/95-monitor-hotplug.rules 
#/etc/udev/rules.d/95-monitor-hotplug.rules
ACTION=="change", KERNEL=="card[0-9]", SUBSYSTEM=="drm", RUN+="/usr/bin/bash -c  \"/usr/bin/date > /tmp/monitor_hotplug_log && /usr/bin/systemctl start monitor_hot_plug >> /tmp/monitor_hotplug_log 2>&1\""

After plugging a new screen I can see :

cat /tmp/monitor_hotplug_date 
Tue Feb  6 09:54:52 CET 2018

As you can see, /tmp/monitor_hotplug_log does not exist, rule pointing to symlink is not executed. But sometimes it is executed. 95-monitor-hotplug-test.rules is always executed. How can we explain that?

Moreover, how can I trace executed rules? I'm on arch. I cannot see in journalctl some udev logs giving info about triggered rules.

  • You can use the udevadm utility to test the trigger. – Raman Sailopal Feb 6 '18 at 9:57
  • with udevadm monitor I can get udev and kernel events, but it doesn't log rule execution. I can see kernel change events for card 0, but no logs indicates 95-monitor-hotplug-test.rules has been executed. – rem Feb 6 '18 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.