Skip to content
Snippets Groups Projects
Verified Commit 2e94ffbb authored by Jérôme Charaoui's avatar Jérôme Charaoui :telescope:
Browse files

systemd user units must have WantedBy=default.target

Using WantedBy=multi-user.target might work to start the unit at
boot-up, but the unit will not be started in other contexts such as
"systemctl restart user@<id>.service" which is useful in to restart
user services identified by needrestart.

From https://wiki.archlinux.org/title/systemd/User#How_it_works :

> When a systemd user instance starts, it brings up the per user target
default.target.
parent 205015d1
No related branches found
No related tags found
No related merge requests found
......@@ -401,7 +401,7 @@ also start it now. Finally we verify it is loaded and actively running.
ExecStart=/usr/bin/znc --foreground
[Install]
WantedBy=multi-user.target
WantedBy=default.target
ircbouncer@chives:~$ systemctl --user enable --now znc
Created symlink /home/ircbouncer/.config/systemd/user/multi-user.target.wants/znc.service → /home/ircbouncer/.config/systemd/user/znc.service.
ircbouncer@chives:~$ systemctl --user status znc
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment