The only thing necessary, from what I've seen, is to enable the service:
~ $ systemctl --user enable custom.service
and you said you've done that.
One way to check whether the start happened on reboot is to verify that there are no errors. You do that using the journalctl
command:
~ $ journalctl --user -u custom.service
Note: the -u
option stands for unit.
If nothing appears in there, you may have an invalid dependency, that is, the "wants" for user is default.target
. In your .service file it should look like so:
[Install]
WantedBy=default.target
Other targets are not likely to work and the auto-start will fail. That being said, the user has the targets listed by:
~ $ systemctl --user list-units --type=target
That does not include the multiuser, xsession, etc.
Finally, the X11 environment should be ready once the service starts, but I'm not 100% sure about that. In my .service file I also have an Environment=
definition that goes like this:
[Service]
Type=simple
Environment="DISPLAY=:0"
...snip...
I had problems where the service could not open an X-Window. With that small addition, it worked as expected.
One last thing, the User=...
and Group=...
parameters can't be used in a user service. Since it is specific to a user, you can't hope to use a specific user to run that application. Plus multiple users could be logged in the same computer and each need their own version of the service running in parallel. So other options may not be available to a user service. I would suggest you comment out most and then add one at a time to see what works and what doesn't in your situation. These errors, though, are the ones you'll see in the journal, so it should be relatively easy to fix once you bypass the few other steps.
Post Scriptum
The path where you want to save a User Service is:
~/.config/systemd/user/my-service.service
unless you want the service accessible to all users on that computer in which case you use:
/usr/lib/systemd/user/my-service.service
See this archlinux page for other details.
Note that I do not think that was your problem (wrong location) although it could have been. I have had difficulties before when I placed systemd files in the wrong place.