You are not logged in.

#1 2015-10-07 02:40:33

nbd
Member
Registered: 2014-08-04
Posts: 389

[SOLVED] Can't get user systemd service automatically start

Cannot get a systemd user service to start automatically at system boot without user logging. The 'linger' is enabled for the user. Manually with 'systemctl start' the service starts OK. Systemd manual for "loginctl enable-linger" reads:

Enable/disable user lingering for one or more users. If enabled for a specific user, a user manager is spawned for the user at boot and kept around after logouts. This allows users who are not logged in to run long-running services.

Does the phrase marked in bold mean that all user's services are automatically started at the system boot when lingering is enabled? If so, what could be the cause that the service doesn't start?

Last edited by nbd (2015-10-07 06:32:42)


bing different

Offline

#2 2015-10-07 04:34:21

hydracone
Member
Registered: 2015-06-25
Posts: 24

Re: [SOLVED] Can't get user systemd service automatically start

Lingering means that the service would remain active even if the user of that service logs out of all his/her sessions. You have to log in once for the service to start. If you want the service to start on boot, then you'll have to create a system service and not a user service.

EDIT : Got it wrong... ignore what I said.

Last edited by hydracone (2015-10-07 10:24:26)

Offline

#3 2015-10-07 05:01:36

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: [SOLVED] Can't get user systemd service automatically start

Well, it seemed to me that if systemd has a way to keep a service AFTER user's login, it's logically to have a way to start a service BEFORE login. Why then "a user manager is spawned for the user at boot" and not at first login? Anyways, maybe someone advise if there is a way to start a user service apart from with 'su' by root?


bing different

Offline

#4 2015-10-07 05:46:57

ayekat
Member
Registered: 2011-01-17
Posts: 1,625

Re: [SOLVED] Can't get user systemd service automatically start

hydracone, the whole point of lingering is to allow user services to start without a user having to log in each time (e.g. a multi-user server). Also, nbd highlighted it from the manpage.

nbd wrote:

Manually with 'systemctl start' the service starts OK.

Have you enabled the service?

systemctl --user enable $yourservice

Otherwise, after I saw your post, I was like "oh, I've got the same issue", and I noticed how user services whose symlinks were in multi-user.target.wants would not start automatically, but symlinks in default.target.wants do. Perhaps you should check where the symlinks are placed after enabling them (I don't know why it's like this, though).

Last edited by ayekat (2015-10-07 05:48:14)


pkgshackscfgblag

Offline

#5 2015-10-07 06:31:57

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: [SOLVED] Can't get user systemd service automatically start

ayekat:

yes, that's was the issue: the service was enabled under a wrong target. After setting the correct target it starts OK. Thanks for the helping.


bing different

Offline

#6 2015-10-07 10:15:52

hydracone
Member
Registered: 2015-06-25
Posts: 24

Re: [SOLVED] Can't get user systemd service automatically start

Oh yeah.... I didn't read through the man page thoroughly.... sorry about that nbd!!! tongue

Offline

Board footer

Powered by FluxBB