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?

2 Answers 2


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.

  • 4
    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).
    – dirkt
    Commented Nov 4, 2019 at 12:56

If you really just want to trigger a service, you would add

RUN{program}="/bin/systemctl --user start offnet-uart-log.service"

to your udev rule. This would require that your service is of type oneshot or exec, so that the call to systemd returns within the usual short timeframe allowed by udev (see e.g. discussions here How to run long time process on Udev event? and on other pages discussing udev and automatic mounts.

  • Thanks. I read this blog.fraggod.net/2012/06/16/… , which is doing what I'm trying. They advice against using systemctl start at the bottom, which I tend to agree with.
    – Gauthier
    Commented Nov 4, 2019 at 11:48
  • I agree, that looks like the more proper way to do it (although the approach I suggested worked for me so far).
    – AdminBee
    Commented Nov 4, 2019 at 12:09
  • 1
    I suggest tacking on --no-block. Udev does NOT like latency. And running systemctl has it's uses if you need something to run every time guaranteed, like display mirroring.
    – davolfman
    Commented Nov 4, 2019 at 17:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .