[systemd-devel] Which udev action is run on boot for my device?

Lennart Poettering lennart at poettering.net
Mon Oct 26 10:19:33 UTC 2020


On So, 25.10.20 18:56, Marcin Kocur (marcin2006 at gmail.com) wrote:

> W dniu 25.10.2020 o 18:36, Marcin Kocur pisze:
> > Hello,
> >
> > as the topic states, I want to know which action(s) from "add",
> > "remove", "change", "move", "online", "offline", "bind", and "unbind"
> > were triggered on my device. Is there any way to check that?
> >
> > At the beginning of  /usr/lib/udev/rules.d/49-sane.rules there is:
> >
> > ACTION!="add", GOTO="libsane_rules_end"
> >
> > Udevadm info doesn't show libsane_matched property for my scanner.
> >
> > If I trigger the device manually with action "change", the variable is
> > still not there, as per the rule.
> >
> > But if I trigger it with "add", the variable is there and also uaccess
> > rule gets executed.
> >
> > So the ultimate quesiton is: what kind of trigger was executed on my
> > device on boot time?
> >
> Okay, it seems that "bind" is the action executed. I just edit the ACTION
> rule and restarted my PC until I found it.

The introduction of "bind" and "unbind" is some major kernel API
fuck-up btw. It's the main reason why packages should check for
!="remove" rather than =="add|change" or so. udev rules written for
old kernels simple didn't have to take "bind" and "unbind" into
account. The fact that kernel just added that willy-nilly breaks rules
all over the place. (that said, sane's apparent use of =="add" was
always broken, i.e. the omission of "change", so even without the
kernel bind/unbind mess the sane rules already were broken)

Also see the NEWS note on the upcoming systemd version 247:

https://github.com/systemd/systemd/blob/master/NEWS#L5

> Is this intended? Should I report bug to systemd or sane? The scanner is
> connected to my PC all the time.

sane.

Ask them to run their rules on ACTION!="remove", i.e. on all actions
but "remove". And that includes add, bind, change, unbding and
everything else that might be added one day.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list