Systemd user services
Suvayu Ali
fatkasuvayu+linux at gmail.com
Sun Jul 19 11:56:30 UTC 2015
Hi,
I wanted to run systemd user services, in linger mode, meaning they run
as a regular user and hang around without an active session. This
worked nicely for the default target. When I changed to a different
target however, the systemd user is not working anymore. Any thoughts?
This is what I did step by step:
- Enable linger mode and reboot:
# loginctl enable-linger user
- Now from a console login when I do:
$ systemctl --user status
I see systemd user service is running.
- I add a service like this:
$ systemctl --user enable emacs
$ systemctl --user start emacs
Looking at the status now, I see emacs is running as expected.
This was just a test, I actually want to run mpd, but I was not getting
any sound without a graphical session, so temporarily I switched to a
graphical target with:
# systemctl isolate graphical.target # my default is runlevel3
IIUC, when I do this all services get restarted. So I wasn't surprised
when there was not running emacs (checked with pgrep). I was surprised
however to see I cannot query the user session anymore.
$ systemctl --user enable emacs.service
Failed to get D-Bus connection: No such file or directory
It is even more surprising since the systemd user service is still running!
$ ps -uf -p 14301
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
lightdm 14301 0.0 0.1 45004 4864 ? Ss 10:18 0:00 /usr/lib/systemd/systemd --user
What is wrong? Am I mistaken somewhere, or is this a bug?
Thanks for any thoughts.
--
Suvayu
Open source is the future. It sets us free.
More information about the users
mailing list