[systemd-devel] Should pam-activated systemd --user daemon quit after session has been closed?

Armin K. krejzi at email.com
Fri Jan 22 14:43:58 PST 2016


On 22.01.2016 23:35, Kai Krakow wrote:
> Am Fri, 22 Jan 2016 23:19:11 +0100
> schrieb "Armin K." <krejzi at email.com>:
> 
>> I have a following problem on my system and it has been bothering me
>> for some time.
>>
>> I use KDE Plasma 5 and lightdm as a display manager to login to the
>> session. Once logged in, the lightdm (I guess it's using
>> pam_systemd.so) login service will also start systemd user session
>> and a session dbus daemon. The rest of Plasma follows.
>>
>> The problem is, that whenever I log out from Plasma, the systemd user
>> session isn't terminated and as such leaves the user bus daemon and
>> lots of services around, which makes shutdown hang (if I initiated
>> the shutdown, which will first initiate log out) for some time (90
>> seconds by default until it's forcibly killed by systemd) which I
>> rather find annoying. I can see the systemd user session is the
>> culprit, because I can see "Waiting for session for user 1000 to
>> terminate [timer]" or something like that.
>>
>> When I just log out, I can manually stop the systemd user session
>> using loginctl kill-user/kill-session (I am not sure which one I used
>> last time), which will terminate user bus and all the other services
>> from that session.
>>
>> Now, to the original question: Once PAM closes the session (once
>> logout is received), should systemd --user daemon terminate as well?
>> Currently, that's not the case on my system.
>>
>> Let me know if I can provide any additional info.
> 
> Have you tried SDDM instead of LightDM... SDDM is recommended for KDE
> Plasma 5 afaik. I had similar issues with shutdown when I still used
> LightDM. Tho I never tracked it back due to an orphan user session -
> good catch.
> 

I've tried SDDM, but due to bug that's present up to this day [1], I was
unable to continue using it. Lightdm is the only viable alternative it
seems.

Now, again to my problem. I have just set KillUserProcesses=yes in
/etc/systemd/logind.conf and can confirm that the user processes are killed
after I log out.

But the original problem persists. The systemd --user daemon and (sd-pam)
process still remain running after logout for some 20 seconds, after which
it will terminate itself cleanly. Not a big issue (certainly beats hanging
forever), but still an annoying one as it would block shutdown for that
amount of time.

I can understand why KillUserProcesses=yes isn't set by default, but is
it possible to add a parameter to pam_systemd.so when used for certain
service to kill all the processes? I think I saw something a good while
ago, but can't find anything in pam_systemd(8).

[1] https://github.com/sddm/sddm/issues/286 (yes, I use gnome-keyring in KDE)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20160122/2d484570/attachment.sig>


More information about the systemd-devel mailing list