Killing the systemd user session on logout

Bernie Innocenti bernie at codewiz.org
Sun Jul 12 17:29:37 BST 2020


(re-posting because most subscribers might have missed my previous post 
due to an excessively strict DKIM policy applied by my domain).


I'm trying to fix this longstanding bug where there are dangling user 
processes after the desktop session exists:

   https://bugs.kde.org/show_bug.cgi?id=359651

This is reproducible every time on multiple distributions and KDE 
versions. It also causes subsequent logins to fail or behave 
surprisingly due to the presence of extraneous dbus services, pulseaudio 
clients, etc.

I looked into plasma-workspace/startkde, and there's no hint of it 
starting "systemd --user" directly.

Then I thought that perhaps SDDM starts the systemd session, but 
couldn't find the exact spot in the code. I see communication about the 
session with login1, but not an explicit CreateSession:

   https://github.com/sddm/sddm/blob/develop/src/daemon/Display.cpp

So I'm starting to think that it might be done implicitly via PAM 
(there's a pam_systemd module).

I guess the fix for this bug might involve sending a KillSession message 
after startplasma-x11 or startplasma-wayland has exited. Maybe from 
HelperApp::sessionFinished? But, if a PAM module is starting "systemd 
--user", shouldn't the same PAM module also do the cleanup?

-- 
_ // Bernie Innocenti
\X/  https://codewiz.org/


More information about the Plasma-devel mailing list