_NOTE: Do not submit anything other than bug reports or RFEs via the issue tracker!_
… systemd 229-3
_NOTE: Do not submit bug reports about anything but the two most recently released systemd versions upstream!_
… Arch Linux
In case of bug report: Expected behaviour you didn't see
… logout terminating running user processes
In case of bug report: Unexpected behaviour you saw
… logout leaves running user processes
In case of bug report: Steps to reproduce the problem
…
1) logout
2) login
After, for instance, running and exiting from KDE, there is:
$ ps lU 1000
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
4 1000 12915 1 20 0 33960 4428 ep_pol Ss ? 0:00 /usr/lib/systemd/systemd --user
5 1000 12921 12915 20 0 105628 2080 - S ? 0:00 (sd-pam)
4 1000 12926 12908 20 0 16696 4536 wait Ss tty1 0:00 -bash
0 1000 12966 12915 20 0 33052 3908 ep_pol Ss ? 0:00 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activat
ion
0 1000 13050 12915 20 0 479028 13228 poll_s Sl ? 0:00 /usr/lib/telepathy/mission-control-5
0 1000 13060 12915 20 0 748068 35624 poll_s Sl ? 0:00 /usr/lib/gnome-online-accounts/goa-daemon
0 1000 13067 12915 20 0 270808 5348 poll_s Ssl ? 0:00 /usr/lib/gvfs/gvfsd
0 1000 13072 12915 20 0 404444 7340 futex_ Sl ? 0:00 /usr/lib/gvfs/gvfsd-fuse /run/user/1000/gvfs -f -o big_writes
0 1000 13080 12915 20 0 280964 6524 poll_s Sl ? 0:00 /usr/lib/gnome-online-accounts/goa-identity-service
0 1000 13097 12915 20 0 176596 4904 poll_s Sl ? 0:00 /usr/lib/dconf/dconf-service
0 1000 13137 12915 9 -11 448752 12320 poll_s S
0 1000 13150 12915 20 0 60676 5108 poll_s S ? 0:00 /usr/lib/GConf/gconfd-2
0 1000 13688 12915 20 0 339880 7536 poll_s Ssl ? 0:00 /usr/lib/at-spi2-core/at-spi-bus-launcher
0 1000 13715 13688 20 0 32576 3136 ep_pol S ? 0:00 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofo
rk --print-address 3
1 1000 20461 1 20 0 165076 824 poll_s Ss ? 0:01 gpg-agent --homedir /home/james/.gnupg --use-standard-socket --daemon
0 1000 21518 12915 20 0 304952 7728 poll_s Ssl ? 0:00 /usr/lib/gvfs/gvfs-udisks2-volume-monitor
0 1000 27429 12915 20 0 187452 5344 poll_s Ssl ? 0:00 /usr/lib/gvfs/gvfsd-metadata
0 1000 30567 12926 20 0 32320 3128 - R+ tty1 0:00 ps lU 1000
Next, with no other sessions, run "exit" or "logout" from the virtual terminal. Then log in again, and run:
$ ps lU 1000
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
4 1000 12915 1 20 0 34048 4472 ep_pol Ss ? 0:00 /usr/lib/systemd/systemd --user
5 1000 12921 12915 20 0 105628 2080 - S ? 0:00 (sd-pam)
0 1000 12966 12915 20 0 33052 3908 ep_pol Ss ? 0:00 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activat
ion
0 1000 13050 12915 20 0 479028 13228 poll_s Sl ? 0:00 /usr/lib/telepathy/mission-control-5
0 1000 13060 12915 20 0 748068 35624 poll_s Sl ? 0:00 /usr/lib/gnome-online-accounts/goa-daemon
0 1000 13067 12915 20 0 270808 5348 poll_s Ssl ? 0:00 /usr/lib/gvfs/gvfsd
0 1000 13072 12915 20 0 404444 7340 futex_ Sl ? 0:00 /usr/lib/gvfs/gvfsd-fuse /run/user/1000/gvfs -f -o big_writes
0 1000 13080 12915 20 0 280964 6524 poll_s Sl ? 0:00 /usr/lib/gnome-online-accounts/goa-identity-service
0 1000 13097 12915 20 0 176596 4904 poll_s Sl ? 0:00 /usr/lib/dconf/dconf-service
0 1000 13150 12915 20 0 60676 5108 poll_s S ? 0:00 /usr/lib/GConf/gconfd-2
0 1000 13688 12915 20 0 339880 7536 poll_s Ssl ? 0:00 /usr/lib/at-spi2-core/at-spi-bus-launcher
0 1000 13715 13688 20 0 32576 3136 ep_pol S ? 0:00 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofo
rk --print-address 3
1 1000 20461 1 20 0 165076 824 poll_s Ss ? 0:01 gpg-agent --homedir /home/james/.gnupg --use-standard-socket --daemon
0 1000 21518 12915 20 0 304952 7728 poll_s Ssl ? 0:00 /usr/lib/gvfs/gvfs-udisks2-volume-monitor
0 1000 27429 12915 20 0 187452 5344 poll_s Ssl ? 0:00 /usr/lib/gvfs/gvfsd-metadata
4 1000 30581 30575 20 0 16564 4524 wait Ss tty1 0:00 -bash
0 1000 30585 30581 20 0 32320 3148 - R+ tty1 0:00 ps lU 1000
Note that bash, pulseaudio, /usr/lib/pulse/gconf-helper, and ps were terminated, but that all the other processes remain across logout.
Try killing "systemd --user":
$ ps lU 1000
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
1 1000 20461 1 20 0 165076 824 poll_s Ss ? 0:01 gpg-agent --homedir /home/james/.gnupg --use-standard-socket --daemon
4 1000 30581 30575 20 0 16696 4696 wait Ss tty1 0:00 -bash
0 1000 30616 30581 20 0 32320 2956 - R+ tty1 0:00 ps lU 1000
Then log out and log in:
$ ps lU 1000
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
1 1000 20461 1 20 0 165076 824 poll_s Ss ? 0:01 gpg-agent --homedir /home/james/.gnupg --use-standard-socket --daemon
4 1000 30629 30621 20 0 16564 4340 wait Ss tty1 0:00 -bash
0 1000 30633 30629 20 0 32320 3112 - R+ tty1 0:00 ps lU 1000
Note that "gpg-agent" is still running, but now, "systemd --user" has not been re-started. And, for instance, KDE will not run at all. "login" has failed to produce a working user session.
Try killing "gpg-agent", log out, and log in:
$ ps lU 1000
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
4 1000 30821 1 20 0 33956 4512 ep_pol Ss ? 0:00 /usr/lib/systemd/systemd --user
5 1000 30826 30821 20 0 105628 2116 - S ? 0:00 (sd-pam)
4 1000 30831 30817 20 0 16696 4752 wait Ss tty1 0:00 -bash
0 1000 30838 30831 20 0 32320 2956 - R+ tty1 0:00 ps lU 1000
This appears to be back to "normal".
Some of these "lurking" processes can cause subsequent problems when other programs are run, in particular, when re-running KDE.
Possibly, this is a problem with systemd-logind, but whatever, systemd needs to "clean-up" after user log-out.
this is not a bug, it's a feature!
have a look into /etc/systemd/logind.conf
Ah! Thanks for that.
KillUserProcesses=
Takes a boolean argument. Configures whether the processes of a user should be killed when the user completely logs out (i.e. after the user's last session ended). Defaults to "no".
KillExcludeUsers=
Processes of users listed in KillExcludeUsers= are excluded from being killed. KillExcludeUsers= defaults to "root" and takes precedence over KillOnlyUsers=, which defaults to the empty list.
Hmm - well then, IÂ have to say, it seems that "KillUserProcesses=" should default to "yes", since there is a lot of cruft that can accumulate, and there is a simple "KillExcludeUsers=" that can be applied to force exclusions when needed. For instance, starting and then exiting from KDE, there are a dozen GNOME and other services left running, which are ''not'' killed on logout. Further, the original "/usr/lib/systemd/systemd --user", when left running, can have strange interactions with KDE, which, then, cannot be cured by a simple log-out and log-in. A naive user would be forced to reboot the machine to restore state.
Well, KillUserProcesses= breaks "tmux" and "screen" which makes this political to turn on by default. But yes, I think we should turn it on by default.
Related is the discussion in #3005 where it currently is being discussed whether we should be more agressive there in the future.
Anyway, closing this one here, let's continue in #3005.
Most helpful comment
Ah! Thanks for that.
KillUserProcesses=
Takes a boolean argument. Configures whether the processes of a user should be killed when the user completely logs out (i.e. after the user's last session ended). Defaults to "no".
KillExcludeUsers=
Processes of users listed in KillExcludeUsers= are excluded from being killed. KillExcludeUsers= defaults to "root" and takes precedence over KillOnlyUsers=, which defaults to the empty list.
Hmm - well then, IÂ have to say, it seems that "KillUserProcesses=" should default to "yes", since there is a lot of cruft that can accumulate, and there is a simple "KillExcludeUsers=" that can be applied to force exclusions when needed. For instance, starting and then exiting from KDE, there are a dozen GNOME and other services left running, which are ''not'' killed on logout. Further, the original "/usr/lib/systemd/systemd --user", when left running, can have strange interactions with KDE, which, then, cannot be cured by a simple log-out and log-in. A naive user would be forced to reboot the machine to restore state.