Killing the systemd user session on logout
Bernie Innocenti
bernie at codewiz.org
Mon Jul 13 20:15:50 BST 2020
On 13/07/2020 17.48, David Edmundson wrote:
>
>
> On Sun, Jul 12, 2020 at 5:29 PM Bernie Innocenti <bernie at codewiz.org
> <mailto:bernie at codewiz.org>> wrote:
>
> (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
> <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.
>
> Yes it's a problem.
> Pulseaudio deliberately tries to survive whilst a user is logged in, so
> that's fine
> The DBus services is a bit weird.
>
> Apparently gnome used to solve this problem by killing dbus-daemon
> explicitly :/
>
> I looked into plasma-workspace/startkde, and there's no hint of it
> starting "systemd --user" directly.
>
>
> >So I'm starting to think that it might be done implicitly via PAM
>
> (there's a pam_systemd module).
>
> That's exactly what happens.
>
> But, if a PAM module is starting "systemd
> --user", shouldn't the same PAM module also do the cleanup?
>
>
> IMHO yes, what I've been trying to do to solve this is to make the
> systemd user session aware of all our stuff.
> We've currently introduced cgroups round the apps, we're tackling the
> services slowly as part of the plasma boot.
>
> Then "all" we need to do is ship two drop-ins for app-* and plasma-*
> scopes and services.
> That include the line BindsTo=graphic-session.target
>
> Once that ends, it'll tear down everything in a controlled manner just
> like a system process.
> This is also what gnome is doing to do.
Do you have a work-in-progress patch I could see?
By the way, I've been looking into this other bug where starting a
Plasma session will eat a VT even after logging out:
https://github.com/sddm/sddm/issues/1200#issuecomment-657084636
I believe we're leaking the fd. Could you confirm that I'm on the right
track? This is my first tentative fix:
https://codewiz.org/pub/sddm-fd-leak.patch
I wasn't able to test it because I couldn't figure out how to run my own
sddm build without overwriting the system binaries.
> Some notes about that topic: https://systemd.io/DESKTOP_ENVIRONMENTS/
> <https://systemd.io/DESKTOP_ENVIRONMENTS/>
Interesting read.
> David
>
>
> --
> _ // Bernie Innocenti
> \X/ https://codewiz.org/ <https://codewiz.org/>
--
_ // Bernie Innocenti
\X/ https://codewiz.org/
More information about the Plasma-devel
mailing list