Bug 27147 - Plasma sessions are not clean up after logoff, lead to after successive logins that plasmashell is not loaded properly.
Summary: Plasma sessions are not clean up after logoff, lead to after successive login...
Status: NEW
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: x86_64 Linux
Priority: release_blocker major
Target Milestone: Mageia 9
Assignee: KDE maintainers
QA Contact:
Keywords: IN_ERRATA8
Depends on:
Blocks: 17523
  Show dependency treegraph
Reported: 2020-08-20 11:34 CEST by Aurelien Oudelet
Modified: 2021-05-19 13:21 CEST (History)
3 users (show)

See Also:
Source RPM:
Status comment: kglobalaccel stuff still broken under Magiea 8

journalctl -b -1 output when doing tests (69.39 KB, application/x-xz)
2020-08-20 11:34 CEST, Aurelien Oudelet
ksysguard: still running process belonging to no longer connected user (325.68 KB, image/png)
2020-08-24 00:00 CEST, Aurelien Oudelet

Description Aurelien Oudelet 2020-08-20 11:34:01 CEST
Created attachment 11812 [details]
journalctl -b -1 output when doing tests

Today with Cauldron up to date, I do tests following:

1 - Login from sddm (graphical.target) on user1 (uid 1000), desktop 
environment is Plasma 5.
2- Do something within desktop (open app for example).
3- Logout from menus as usual. And go back to sddm.
4- Log on user2 (uid 1001), Plasma session and do something inside like open 
5- Log out and go back sddm.
6- Put system to sleep with icon in sddm.
7- Wait several minutes and put system runs with press any key.
8- sddm displays his menu.
9- Log on user1 (uid 1000)
10- See plasmashell not running: black background, mouse OK, autostart apps 
like Konversation open without window decoration, unmovable, KRunner (alt-F2) 
is OK to run apps but they can't be moved.

What I see in journal each time I do plasmashell in Konsole:
plasmashell[8896]: requesting unexisting screen -1
plasmashell[8896]: requesting unexisting screen -1

Ctrl+alt+Backspace 2 times repeated well Zap Xorg server and go well back on 

Rebooting system their is a complain:
user2 still logged on seat0
user3 still logged on seat0
Do systemctl reboot -i to ignore inhibitors.

I rebooted there after and after reboot, first session runs fine. Sleep and 
Resume is OK if I don't log out my account.

I can retry this behavior at every try. If system goes to sleep with only sddm 
at tty1, every plasma session launched after don't permit plasmashell from 

Operating System: Mageia 8
KDE Plasma Version: 5.19.4
KDE Frameworks Version: 5.73.0
Qt Version: 5.15.0
Kernel Version: 5.8.2-desktop-2.mga8
OS Type: 64-bit
Processors: 4 × Intel® Core™ i5-6600K CPU @ 3.50GHz
Memory: 15.6 Gio of RAM
Graphics Processor: GeForce GTX 1660 Ti/PCIe/SSE2

Nvidia nonfree drivers are running version

I see this behavior after each system sleep when there is only sddm on tty1:
background of sddm is no longer blurry and each user log on results of no 
plasmashell running when session is opened.

Assigning to sddm maintainers (KDE team) and even basesystem for additional forensics.
Comment 1 Aurelien Oudelet 2020-08-23 23:56:14 CEST
After carefully reading my logs... I see sessions are not properly closed.

$ loginctl list-sessions
     c2 1000 aurelien seat0    
     c4 1002 enfants  seat0    
     c6 1000 aurelien seat0    

Normally c2 and c4 sessions must be closed and no longer seen while c6 exists.
I am not using fast-userswitching here.

systemd misconfiguration? sddm was c1, c3 and c5 session.
Added attachment from Ksysguard.
Comment 2 Aurelien Oudelet 2020-08-24 00:00:04 CEST
Created attachment 11825 [details]
ksysguard: still running process belonging to no longer connected user

In Ksysguard:

There are running process belonging to no longer connected user.
In this case, they belong to user "enfant" who is no longer connected to what ever TTY.

TTY1 (graphical) is user 1000 (aurelien) and no other TTY has a graphical session.
Comment 3 José Jorge 2020-08-24 08:58:31 CEST
I confirm this bug. After closing a user session, I have to kill the following processes manually :
- /usr/lib/systemd/systemd --user
- gpgagent
- sshagent
- /usr/libexec/geoclue-2.0/demos/agent

CC: (none) => lists.jjorge

Aurelien Oudelet 2020-10-29 16:13:22 CET

Blocks: (none) => 17523

Aurelien Oudelet 2020-12-26 16:53:11 CET

Source RPM: sddm-0.18.1-4.mga8.src.rpm => sddm-0.19.0-3.mga8.src.rpm

Comment 4 Aurelien Oudelet 2021-01-11 11:17:25 CET
I do think the issue is in how Plasma handles a logout. Instead of killing definitely all Plasma applications, some are still here and wait for X11 server...

Also, some don't properly die on exit.
This is in process to be managed by systemd scope in Plasma 5.21 (Optional).

Also, this upstream fixed bug:

this is still present in our distribution.
Comment 5 Aurelien Oudelet 2021-01-11 11:25:55 CET
I also wonder why X server complains about missing logind integration when running sddm although this not affect GDM and GNOME.

In /var/log/Xorg.0.log

[    19.081] (II) systemd-logind: logind integration requires -keeptty and -keeptty was not provided, disabling logind integration

If this is provided, a logout in Plasma results of properly handle all remaining user process.

CC: lists.jjorge => (none)
Target Milestone: --- => Mageia 8
Source RPM: sddm-0.19.0-3.mga8.src.rpm => kglobalaccel-5.76.0-1.mga8.src.rpm

Comment 6 Aurelien Oudelet 2021-01-28 10:02:48 CET
Partially fixed.
kglobalaccel5 will no longer trigger a relaunch of itself will session is logged out. Fix backported by David Geiger. Thank you so much.

If you boot your system, log on to the first time via sddm to Plasma Desktop, your session is seen by systemd/logind as session "c2".

If you logout, or trigger "Ctrl + Alt + Backspace" twice :
Some process remains actives to the session c2 like:

- baloo_file (/etc/xdg/autostart/baloo_file.desktop)
which is owned by baloo-5.76.0-2.mga8.src.rpm

- geoclue (/etc/xdg/autostart/geoclue-demo-agent.desktop)
which is owned by geoclue-2.5.7-1.mga8.src.rpm

These two process are not killed when the Plasma session is logged off.

But, as far as I can see, the new Plasma session no longer make sooo loong time to startup next time.

Not as a side effect, that if you do a Ctrl + Alt + Backspace twice, this will deactivate the Plasma compositor on next logon. Even if you reactivate it under Plasma Systemsettings5 => Hardware => Display and Monitor => Compositor. You don't have full 3D accelerated session. This is the desired upstream behavior. You need to restart your session again...
Comment 7 Morgan Leijström 2021-02-05 20:44:05 CET
Added this bug to errata in a simple way, for now.

Keywords: (none) => IN_ERRATA8
CC: (none) => fri

Comment 8 Morgan Leijström 2021-02-22 18:58:06 CET
So for us who dont care about baloo or geoclue, we can simply remove that two .desktop files from autostart/ ?
Comment 9 Aurelien Oudelet 2021-02-22 19:12:38 CET
(In reply to Morgan Leijström from comment #8)
> So for us who dont care about baloo or geoclue, we can simply remove that
> two .desktop files from autostart/ ?

I think.
But something that normally cleans up the session at logout does not do its job.
I do think this is due to logind integration that is not working for Plasma.
If you see /var/log/Xorg.0.log you can see a complain about -keeptty not present and that logind integration is not enabled.
Comment 10 Aurelien Oudelet 2021-04-10 14:50:35 CEST
Additional fixes are landing in this:


The kglobalaccel5 daemon can no longer block re-login by crashing on the previous log-out and then getting stuck (David Edmundson, Plasma 5.22 or Frameworks 5.82; whichever one you get first)
Comment 11 Giuseppe Ghibò 2021-04-29 13:22:31 CEST
I tried the workaround suggested in bug https://bugs.kde.org/show_bug.cgi?id=429426 under mga8 (plasma-workspace-5.20.4-5.mga8, kwin-5.20.4-3.mga8), by adding:

cat <<EOF > /etc/X11/xinit.d/99-reset-failed-user-service
# to be sourced
systemctl --user reset-failed
chmod 755 /etc/X11/xinit.d/99-reset-failed-user-service


cat <<EOF > /etc/X11/xinit/xinitrc.d/99-reset-failed-user-service
# to be sourced
systemctl --user reset-failed
chmod 755 /etc/X11/xinit/xinitrc.d/99-reset-failed-user-service

it mitigated a bit, but after 4-5 subsequent X11-Zapping (Ctrl-Alt-Backspace-Backspace) the plasma desktop hung at the progress bar of the splash screen as usual. Chances are higher if you press Ctrl-Alt-Backspace-Backspace as soon as you see the "panel" bar in the desktop screen.

To narrow stuff, you can also try without any desktop manager (sddm, etc.), using startx (as described in https://bugs.mageia.org/show_bug.cgi?id=27362#c16).

CC: (none) => ghibomgx

Comment 12 Giuseppe Ghibò 2021-04-29 14:35:35 CEST
I did a further experiment: build a plasma-workspace-5.20.4 with reverting these two upstream commits (the one cited in the RH bug):



the resulting desktop mitigated further, however in my case after 12 Ctrl-Alt-Backspace-Backspace subsequent logins in a row, at 13th the plasma desktop timed out at the splash progress bar as usual.

IMHO the locking problems happens in different places.

Note that apparently kwin_x11 is not involved. A Plasma session can start even without a window manager. You might try this just renaming the binary /usr/bin/kwin_x11 to /usr/bin/kwin_x11_, and then start plasma. You get a full desktop starting with the panel bar (apart that windows can't be resized/moved), however after a certain amount of X11 subsequent zapping the hang on splash progress bar occur anyway.
Comment 13 Aurelien Oudelet 2021-05-19 13:21:23 CEST
In facts, the kglobalaccel5 stuff is the emerged part of the iceberg.

The Plasma session in his Mageia 8 implementation is broken. Not our fault, it is how Plasma handles background services/applications.

In current form, it loads them but they escape ksmserver/kdeinit server manager and they belong to systemd --user which is still running after a logoff.
When Plasma die on logoff, some binaries remain active (gpg-agent, at-spi stuff,...) All that need X11 are died properly (or not for kglobalaccel5 which respawn again 6 times).

This is silly. This leads to remaining sessions to consume resources and to conflict with later session as some background stuff can't properly register with the newer session.

BUT: great news: Plasma 5.21.5 and 5.22 have all of these fixed as soon as we use Plasma systemd start by issuing:

$ kwriteconfig5 --file startkderc --group General --key systemdBoot true

Rebooting and boh. All logoff are properly handle. Session is properly closed and there is no longer any remaining process.

Currently, upstream does not seem to fix the "classic" way to load Plasma which hacky but give a session... as long as user does not successive logoff/logon.

Side note/remark: The net_applet is properly handled in systemd starting way but his menu is still missing on Plasma X11. Will add more in its bug report.

Source RPM: kglobalaccel-5.76.0-1.mga8.src.rpm => (none)
Target Milestone: Mageia 8 => Mageia 9
Priority: Normal => release_blocker
Status comment: (none) => kglobalaccel stuff still broken under Magiea 8
Summary: Multi-users successive logins, plasmashell no longer runs log on to whatever user after going into sleep => Plasma sessions are not clean up after logoff, lead to after successive logins that plasmashell is not loaded properly.

Note You need to log in before you can comment on or make changes to this bug.