udev rule read but "RUN" command is not executed

Bug #1890836 reported by Bill Yikes
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Invalid
Undecided
Bill Yikes

Bug Description

The following was introduced as "/etc/udev/rules.d/99-harvest_camera.rules":

ACTION=="add", KERNEL=="sd*[!0-9]", ENV{ID_FS_UUID_ENC}=="C355-A42D", RUN+="/usr/bin/sudo -u bill /home/bill/scripts/harvest_camera.sh"

When the device is attached, it gets mounted but the harvest_camera.sh script does not execute. The udev_log=debug parameter is set in /etc/udev/udev.conf. Verbosity was also maximized by running "udevadm control --log-priority=debug". After running "udevadm monitor --environment --udev", the drive was attached. The output shows a device being created (/dev/sda1) and the UUID in the rule matches. But the script simply never executes. The /var/log/syslog file shows:

"
Reading rules file: /etc/udev/rules.d/99-harvest_camera.rules
Successfully forked off 'n/a' as PID 2201.
1-2.3: Worker [2201] is forced for rocessing SEQNUM=7973.
"

So the logs make it look as though the script was executed. The script is simply a stub that does a "touch /tmp/IhaveExecuted" and a call to zenity to give a popup announcement. But none of that happens (no popup and no new file in /tmp/). With maximum verbosity, there is no way to further diagnose this. Deeper detail is needed that shows which matching criteria in the rules is being tried and what the result is.

Revision history for this message
Dan Streetman (ddstreet) wrote :

this works for me on Bionic; what release are you using?

Changed in systemd (Ubuntu):
status: New → Incomplete
Revision history for this message
Bill Yikes (yik3s) wrote :

It fails for me on two different systems:

* Ubuntu 20.04 (Focal)
* Linux Mint 19.2 (Tina, which is based on Bionic)

Revision history for this message
Bill Yikes (yik3s) wrote :

It turns out the problem arises out of cargo cult programming on my part. The bang in KERNEL=="sd*[!0-9]" is what I copied out of stackexchange, and it's exactly what prevents the mount from matching. I suspected that early on, but ruled it out because when the device first connects it must connect as /dev/sda (as the partition table must be read before there can be an sda1). Now I'm figuring the sda gets replaced with sda1 before it reaches my custom rule.

In any case, the bug is not as I reported. I'm sorry this turned out to be a non-bug and I'm sorry I wasted your time Mr. Streetman. This can be closed.

I may open a new bug report to improve the debug output, because we shouldn't have to work in the dark and guess about what the matching criteria is doing.

Revision history for this message
Bill Yikes (yik3s) wrote :

PEBKAC

Changed in systemd (Ubuntu):
assignee: nobody → Bill Yikes (yik3s)
status: Incomplete → Invalid
Revision history for this message
Bill Yikes (yik3s) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.