[systemd-devel] Using udev to notify application of device insertion/removal
Lennart Poettering
lennart at poettering.net
Fri Jul 13 14:38:55 UTC 2018
On Mo, 02.07.18 13:34, Paul D. DeRocco (pderocco at ix.netcom.com) wrote:
> System: Yocto-based RT Linux 4.10.17, systemd 232, 32-bit x86, no GUI.
>
> I've created the following "midiUSB.rules" file:
>
> ACTION=="add", KERNEL=="midiC*", SUBSYSTEM=="sound",
> SYMLINK+="snd/midi%b", RUN="/bin/touch /media/sda1/share/devchg"
> ACTION=="remove", KERNEL=="midiC*", SUBSYSTEM=="sound", RUN="/bin/touch
> /media/sda1/share/devchg"
This suggests the file you touch is located on removable media, which
makes me immediately wonder if maybe you are simply in some race,
where the removable media is not mounted at the time the touch runs.
Also, do note that systemd-udevd.service runs in its own mount
namespace, and mount propagation is somewhat limited.
> So it looks like it believes it's going to run my touch command when it's
> removed, but when I actually do it, I don't see the timestamp change.
>
> Any ideas on what's wrong, or how to debug this further?
Run "strace -p1 -f -s500" on udevd, and look for the touch command
being execve()'ed anywhere.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list