Bug#989317: systemd kill background processes after user logs out (#825394 regression)

Michael Biebl biebl at debian.org
Tue Jun 8 19:12:40 BST 2021


Am 07.06.2021 um 21:20 schrieb Matt Corallo:
> Is there any further information I can provide to help debug this (or 
> should it get a -moreinfo)?
> 
> Note that of interest may be that the workaround of spawning in a screen 
> session only works if lxc-start is passed the -F command which places it 
> in the foreground (though sshd still gets the -D option running inside 
> the container).


Let me elaborate a bit more what's happening here.

A systemd --user session (user session) is typically tied to a login 
session. As long as you have 1 (or more) login sessions you have a 
single (reference counted) user session.
Once the last login session stops (has no more processes) the associated 
user session is stopped as well (unless you enabled lingering [1]).

Now, if you start a screen session inside your login session, you 
artifically keep your login session alive after loggin out 
(KillUserProcesses=no prevents screen from being killed).

As a result, your user session also kept alive as well.

Hope this clarifies.

Michael


[1] Linger will start the user session when the system boots and keep it 
always active. Which is why it's not a good idea to enable this globally.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20210608/9005d4b9/attachment.sig>


More information about the Pkg-systemd-maintainers mailing list