0

I have enabled and started a user service (systemctl --user enable serviceName... etc.). But when I log off, the service stops. Why? I have made a similar user service on Fedora 22 before, but that doesn't stop when I log off. Is there any workaround for this?

1

It might be even better:

The systemd user instance is started after the first login of a user and killed after the last session of the user is closed. Sometimes it may be useful to start it right after boot, and keep the systemd user instance running after the last session closes, for instance to have some user process running without any open session. Lingering is used to that effect. Use the following command to enable lingering for specific user:

# loginctl enable-linger username

https://wiki.archlinux.org/index.php/Systemd/User

0

Systemd user services only last as long as a user's session does. This means you must be logged in for a user service to operate successfully.

In Ubuntu, your session ends when you log out of X, and all terminals (TTYs, local, and remote). I would assume Fedora kept a user session open for you.

For Ubuntu, I would suggest that you create a system-level service and then tell it to run as a specific user. You can do this by setting User= and Group= in the [Service] section of your file. If you want to just have write access on that user account, I would suggest you set appropriate file permissions.

Finally, if you want to make it so that a service starts only when a user tells it to, you can use the instructions from this AU post.

  • Not quite. Per-user services only last as long as the per-user service manager does, an important distinction. That might be only as long as there's any login session for that user. But one can configure systemd-logind so that that is not the case. – JdeBP Dec 16 '16 at 1:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.