-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
systemd --user services are not starting automatically #2690
Comments
Have you enabled linger? |
There is no |
@daurnimator I don't see the reason why I should enable linger for this issue? I mean linger is for the case if I logout. So that my services are still running after logging out. @keszybz even if I use default.target it's not working. The services are not starting automatically at login |
Linger is required to bring up user instances on boot; but I guess you didn't explicitly say you wanted that. |
OK, so let's debug this:
|
@daurnimator I want to bring them up only when I login not on boot. Output of:
Output of
You can see my 4 default units. 1 timer (dwupdate.timer) and 3 services. If i check a status of a service I get this:
You can see that the service is enabled.
Here is for example my
When I start the service manually it's working:
|
If it's red, than it means that the service was started, and failed. You should look at the logs ( |
@keszybz I've checked the logs. There is nothing in the logs. Systemd has even not tried to start the services. Could some other user with systemd v229 could please test this scenario?:
|
This is true for the command |
You are right, |
OK, I see something is wrong. |
@keszybz after using There are also different people on the arch-general mailinglist who complain about --user services: https://lists.archlinux.org/pipermail/arch-general/2016-February/040797.html but seems like they have other problems.. Just want to mention that here. I wrote them that they should open an issue here. |
I can reproduce this bug by having a timer with Persistent=true (I guess BootSec=0 would also trigger). If the service the timer triggers was supposed to run, and with Persistent=true is most likely the case, systemd will start the manager for the user and reach the default target, and will start the timers/services. But after some seconds pam will complain about timeout and the manager service for the user will die with SIGRTMIN+24. I need to manually login as root, stop the processes and logout/login again. For now I removed the Persistent=true flag. But I believe that if I happen to login at the exact time the timer was supposed to be run, this issue will still happen. And issuing two (or more) reenable's does not help as it did with @shibumi.
|
@shibumi: so the problem at hand appears to be that "systemctl enable --user" is borked somehow? Any chance you can find a way to reproduce the issue? @grazzolini sounds like a different problem. The systemd --user instance that is running in user@.service informs the system systemd instance about being ready as soon as it's job queue ran empty for the first time. Now, if you have a timer unit that (due to Persistant=yes) is triggered immediately at boot it might happen that the long running service it starts is immediately added to this job queue and thus means the job queue stays busy for a long time and the ready notification never happens. There's a bug open somewhere to change the ready notification to be triggered already as soon as default.target is reached, or when the queue runs empty, whatever comes first. Anyway, that's a different topic, so let's not continue discussin about this here. Thanks. |
@poettering Your description fits exactly into my problem, the services being triggered are indeed long running processes. Good to know that this already is a known issue. |
@poettering Not sure If i could reproduce this error. I will setup a new machine the next days. Maybe I can reproduce the issue there |
OK, will close this here now. If you manage to reproduce this, please reopen or comment here! Thanks! |
it must be wanted by default.target. See systemd/systemd#2690 (comment)
I was having a problem where I'd start my computer but the script wasn't restarting audomatically, and after some searching I found this: systemd/systemd#2690 (comment) It looks like we should be using `default.target` instead of `multi-user.target`.
I was having a problem where I'd start my computer but the script wasn't restarting audomatically, and after some searching I found this: systemd/systemd#2690 (comment) It looks like we should be using `default.target` instead of `multi-user.target`.
* because there is no multi-user.target in --user mode * systemd/systemd#2690 (comment)
`WantedBy` should be `default.target` for `--user` mode to let service start on system boot. Based on this comment: systemd/systemd#2690 (comment)
Same issue,
but the service is not getting started on boot?! |
`WantedBy` should be `default.target` for `--user` mode to let service start on system boot. Based on this comment: systemd/systemd#2690 (comment)
Hello,
I have different
service
-files in/etc/systemd/user/
. I have enabled them viasystemctl --user enable <myService>.service
, but they are not starting automatically.Here is an example of one of my services:
You can see that the service should start urxvt-daemon if multi-user.target is reached (I have some other services with graphical.target this doesn't work also). This is already reached when I login via TTY. (Hint: I am not using a loginmanager. I login via TTY and start my X-Server manually via
startx
if I need it). The problem is is that this service (and some others) are not starting automatically. If I checkoutjournalctl --user
I can't even see a try to start the service. If I start the service manually it's working fine.I have by the way the same behaviour for timers. They are also not started automatically when I have enabled them as user-service.
For me this is a bug (maybe I am doing something wrong, please correct me).
My systemd version is the following:
The text was updated successfully, but these errors were encountered: