Killing the systemd user session on logout

David Edmundson david at davidedmundson.co.uk
Thu Jul 16 14:25:32 BST 2020


On Mon, Jul 13, 2020 at 8:15 PM Bernie Innocenti <bernie at codewiz.org> wrote:

> 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?
>
> The actual scoping of applications is already merged (see systemd-cgls on
Plasma 5.19).
Scoping of the background services is on review and scattered around the
place.

Then we need these drop-ins to scope them to the lifespan of the session.
https://invent.kde.org/davidedmundson/systemd-dropins

Let me know if that makes a difference, it seems to be working nicely for
me.

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20200716/d95df36b/attachment.htm>


More information about the Plasma-devel mailing list