4

I am modifying my working udev rule (/etc/udev/rules.d/10-local.rules):

SUBSYSTEM=="tty", ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1015", ATTRS{serial}=="000621000000", SYMLINK+="ttymkw"

to this (end of row):

SUBSYSTEM=="tty", ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1015", ATTRS{serial}=="000621000000", SYMLINK+="ttymkw", TAG+="systemd", SYSTEMD_WANTS="offnet-uart-log.service"

I have user service offnet-uart-log.service in ~/.config/systemd/user, which I can manually trigger, but I don't get this far yet.

With the added , TAG+="systemd", SYSTEMD_WANTS="offnet-uart-log.service" at the end of my udev rule, the symlink is not created (I reload with sudo udevadm control --reload-rules && sudo udevadm trigger).

This tells me that the rule is wrong, but I don't know why. Could be related to udev being owned by root, while the service is owned by the user? Did I misunderstand WANTS?

I've tried all four combinations of SYSTEM_USER_WANTS or SYSTEM_WANTS, and = or +=. Removing the *_WANTS makes the symlink appear, so the error is in the *_WANTS.

How do I make my tty device trigger the log service?


EDIT: as mentioned in my own answer below, modifying SYSTEM_USER_WANTS to ENV{SYSTEM_USER_WANTS} works. Why is it required?

1 Answer 1

3

This blog post does what I want, and thanks to it I replaced SYSTEMD_USER_WANTS with ENV{SYSTEMD_USER_WANTS}, which made it work.

I still don't understand why the ENV{} construct is needed, and why I haven't found it in the docs.

1
  • 5
    If you look at man 7 udev, you'll see that SYSTEMD_USER_WANTS isn't valid in a udev rule, while ENV sets a device property value (and systemd uses this property value for its purposes). Commented Nov 4, 2019 at 12:56

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.