I am trying to start a systemd service for a specific user (service name/goal is not relevant). I do that because I need to have a per user process of an application running at startup.
Here is what I achieved so far:
-
I create a unit file in /etc/systemd/user/
-
And then did the following:
~ $ systemctl –user enable custom.service
-
Then as said in https://wiki.archlinux.org/index.php/Systemd/User#Automatic_start-up_of_systemd_user_instances enabled lingering to have said service running even with no user session running.
~ $ loginctl enable-linger $USER
But when I reboot the service does not seem to start and there is nothing to be seen in journalctl for said service. But the status said that the service is enabled:
~ $ systemctl –user status transmission-daemon
● custom.service – Custom Daemon
Loaded: loaded (/etc/systemd/user/custom.service;
enabled; vendor preset: enabled)Active: inactive (dead)
Also I can run it manually with no issue by running
~ $ systemctl –user start custom.service
As anyone any idea what I did wrong?
Best Answer
I dont know if this is your case but i could solve it with the answer of https://unix.stackexchange.com/questions/251211/why-doesnt-my-systemd-user-unit-start-at-boot The problem was i had
WantedBy=multi-user.target
and had to change it toWantedBy=default.target
and it worked.Another thing, i have my service file in
~/.config/systemd/user