Bug 485011

Summary: Can't log out of Plasma 6
Product: [Plasma] plasmashell Reporter: Synthetic451 <bugs.kde.org.facelift226>
Component: Session ManagementAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: danilo.luvizotto, mike.cloaked, mss, omarhanykasban706, sitter, web
Priority: NOR    
Version: 6.0.3   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=484864
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: logs after triggering a logout
journal that includes lines for logout fail from plasma 6

Description Synthetic451 2024-04-04 05:28:06 UTC
Created attachment 168126 [details]
logs after triggering a logout

SUMMARY
I can't seem to log out of a Plasma 6 session properly. Pretty sure logout was working fine with Plasma 5. In Wayland, clicking Ok on the fullscreen log out dialog does nothing. In X11, the screen goes blank and all I can see is my mouse cursor.

I get the following messages in journalctl:
```
Apr 03 21:52:46 arch-nas systemd[1]: Stopping User Runtime Directory /run/user/972...
Apr 03 21:52:46 arch-nas systemd[1]: run-user-972.mount: Deactivated successfully.
Apr 03 21:52:46 arch-nas systemd[1]: user-runtime-dir@972.service: Deactivated successfully.
Apr 03 21:52:46 arch-nas systemd[1]: Stopped User Runtime Directory /run/user/972.
Apr 03 21:52:46 arch-nas systemd[1]: Removed slice User Slice of UID 972.
Apr 03 21:52:46 arch-nas systemd[1]: user-972.slice: Consumed 1.564s CPU time.
Apr 03 21:52:47 arch-nas systemd[1]: dbus-:1.2-org.kde.kded.smart@0.service: Deactivated successfully.
Apr 03 21:52:47 arch-nas systemd[1]: dbus-:1.2-org.kde.powerdevil.discretegpuhelper@0.service: Deactivated successfully.
Apr 03 21:52:47 arch-nas systemd[1]: dbus-:1.2-org.kde.powerdevil.backlighthelper@0.service: Deactivated successfully.
Apr 03 21:52:48 arch-nas systemd[1]: dbus-:1.2-org.kde.powerdevil.chargethresholdhelper@0.service: Deactivated successfully.
Apr 03 21:52:54 arch-nas systemd[4500]: Created slice Slice /app/dbus-:1.2-org.kde.LogoutPrompt.
Apr 03 21:52:54 arch-nas systemd[4500]: Started dbus-:1.2-org.kde.LogoutPrompt@0.service.
Apr 03 21:52:54 arch-nas ksmserver-logout-greeter[5553]: qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
Apr 03 21:52:54 arch-nas ksmserver-logout-greeter[5553]: kf.windowsystem: static bool KX11Extras::compositingActive() may only be used on X11
Apr 03 21:52:54 arch-nas plasmashell[5079]: qt.qpa.wayland: eglSwapBuffers failed with 0x300d, surface: 0x0
Apr 03 21:52:55 arch-nas systemd[4500]: Created slice Slice /app/dbus-:1.2-org.kde.Shutdown.
Apr 03 21:52:55 arch-nas systemd[4500]: Started dbus-:1.2-org.kde.Shutdown@0.service.
Apr 03 21:52:55 arch-nas systemd[4500]: Stopped target plasma-workspace-wayland.target.
Apr 03 21:52:55 arch-nas systemd[4500]: Stopped target KDE Plasma Workspace.
Apr 03 21:52:55 arch-nas systemd[4500]: Requested transaction contradicts existing jobs: Transaction for graphical-session.target/stop is destructive (drkonqi-coredump-pickup.service has 'start' job queued, but 'stop' is included in transaction).
Apr 03 21:52:55 arch-nas systemd[4500]: graphical-session.target: Failed to enqueue stop job, ignoring: Transaction for graphical-session.target/stop is destructive (drkonqi-coredump-pickup.service has 'start' job queued, but 'stop' is included in transaction).
Apr 03 21:52:55 arch-nas systemd[4500]: Stopped target KDE Plasma Workspace Core.
Apr 03 21:52:55 arch-nas systemd[4500]: Stopped target Startup of XDG autostart applications.
Apr 03 21:52:55 arch-nas systemd[4500]: Stopped target Session services which should run early before the graphical session is brought up.
Apr 03 21:52:55 arch-nas systemd[4500]: dbus-:1.2-org.kde.LogoutPrompt@0.service: Main process exited, code=exited, status=1/FAILURE
Apr 03 21:52:55 arch-nas systemd[4500]: dbus-:1.2-org.kde.LogoutPrompt@0.service: Failed with result 'exit-code'.
```

STEPS TO REPRODUCE
1. Log in
2. Click Logout from Kicker
3. Click OK to log out

OBSERVED RESULT
User is not logged out.

EXPECTED RESULT
User is logged out and SDDM shows up

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
SDDM: 0.21.0
Qt Version: 6.6.3
Kernel Version: 6.8.3-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 24 × AMD Ryzen 9 3900X 12-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3090/PCIe/SSE2
Product Name: X570 Taichi
Comment 1 Malte S. Stretz 2024-04-07 17:34:59 UTC
*** Bug 485129 has been marked as a duplicate of this bug. ***
Comment 2 Malte S. Stretz 2024-04-07 17:37:32 UTC
I see the same issue. Looks like a deadlock in systemd caused by drkonqi-coredump-processor.

This started after an update of KDE Neon from 6.0.2 to 6.03. 

Apr 07 19:22:07 xxx plasmashell[1886]: file:///usr/share/plasma/plasmoids/org.kde.plasma.kickoff/contents/ui/ApplicationsPage.qml:202: TypeError: Cannot
 call method 'forceActiveFocus' of null
Apr 07 19:22:10 xxx dbus-daemon[1269]: [session uid=1001 pid=1269] Activating service name='org.kde.LogoutPrompt' requested by ':1.27' (uid=1001 pid=1886 comm="/usr/bin/plasmashell --no-respawn " label="unconfined")
Apr 07 19:22:10 xxx dbus-daemon[1269]: [session uid=1001 pid=1269] Successfully activated service 'org.kde.LogoutPrompt'
Apr 07 19:22:11 xxx ksmserver-logout-greeter[2238]: qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
Apr 07 19:22:11 xxx ksmserver-logout-greeter[2238]: kf.windowsystem: static bool KX11Extras::compositingActive() may only be used on X11
Apr 07 19:22:13 xxx dbus-daemon[1269]: [session uid=1001 pid=1269] Activating service name='org.kde.Shutdown' requested by ':1.48' (uid=1001 pid=2238 comm="/usr/lib/x86_64-linux-gnu/libexec/ksmserver-logout" label="unconfined")
Apr 07 19:22:13 xxx dbus-daemon[1269]: [session uid=1001 pid=1269] Successfully activated service 'org.kde.Shutdown'
Apr 07 19:22:13 xxx kded6[1863]: Service  ":1.43" unregistered
Apr 07 19:22:13 xxx systemd[1222]: Stopped target plasma-workspace-wayland.target.
Apr 07 19:22:13 xxx systemd[1222]: Stopped target KDE Plasma Workspace.
Apr 07 19:22:13 xxx systemd[1222]: Requested transaction contradicts existing jobs: Transaction for graphical-session.target/stop is destructive (drkonqi-coredump-pickup.service has 'start' job queued, but 'stop' is included in transaction).
Apr 07 19:22:13 xxx systemd[1222]: graphical-session.target: Failed to enqueue stop job, ignoring: Transaction for graphical-session.target/stop is destructive (drkonqi-coredump-pickup.service has 'start' job queued, but 'stop' is included in transaction).
Apr 07 19:22:13 xxx systemd[1222]: Stopped target KDE Plasma Workspace Core.
Apr 07 19:22:13 xxx systemd[1222]: Stopped target Startup of XDG autostart applications.
Apr 07 19:22:13 xxx systemd[1222]: Stopped target Session services which should run early before the graphical session is brought up.


Operating System: KDE neon 6.0
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.3
Kernel Version: 6.5.0-26-generic (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i5-6300U CPU @ 2.40GHz
Memory: 7,6 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 520
Manufacturer: LENOVO
Product Name: 20F5S1H800
System Version: ThinkPad X260
Comment 3 Synthetic451 2024-04-08 01:18:19 UTC
Yes, it seems like drkonqi is the culprit here. If I uninstall it (along with plasma-meta which depends on it), then log outs work fine every time. Reinstalling drkonqi immediately causes the issue to come back.
Comment 4 MikeC 2024-04-08 07:41:13 UTC
I can also confirm that uninstalling drkonqi and plasma-meta leads to the logout problem no longer occurring. Hopefully this will allow the underlying cause of this bug to be fixed so that installing fixed a fixed version of drkonqi will allow logout to complete without problems again.
Comment 5 Malte S. Stretz 2024-04-08 07:48:58 UTC
Instead of uninstalling drkonqi these command should be enough to work around the issue:

systemctl --user stop drkonqi-coredump-pickup.service
systemctl --user mask drkonqi-coredump-pickup.service

Don't forget to execute this once the issue is fixed:

systemctl --user unmask drkonqi-coredump-pickup.service
Comment 6 Synthetic451 2024-04-08 08:10:25 UTC
Should this bug be reassigned to drkonqi or are the relevant people already aware of this?
Comment 7 Malte S. Stretz 2024-04-08 08:25:29 UTC
I added Harald Sitter to the CC list but am not really sure if DrKonqi is really the root cause or just triggering another systemd dependency issue. Why are the other jobs stopped (eg. "Stopped target KDE Plasma Workspace.") even though something is wrong and do not really end the session and thus throw the whole session management into disorder?

Some oddities I see here:
1. This affects only one of my two Notebooks running Neon 6.0.3
2. On the affected one only one user is affected. I cans till switch the session to another user and restart the system normally.
3. It is also not reliably affecting that user, maybe 80% of the cases.
4. The first time this happens I see the logout confirmation screen (I guess that is org.kde.LogoutPrompt) but when I confirm there nothing happens (I guess that should be handled by org.kde.Shutdown).
5. Once this happened once I don't ever see that confirmation screen for this user again and the logout button just doesn't do anything.
Comment 8 Harald Sitter 2024-04-08 08:34:31 UTC
This is https://bugs.kde.org/show_bug.cgi?id=484864 isnt it?
Comment 9 Malte S. Stretz 2024-04-08 08:41:26 UTC
Looks very much like that one, yes. Shall we mark this as a duplicate or is there a deeper issue in the session handling itself which should be looked into? Couldn't other units break this as well?
Comment 10 Malte S. Stretz 2024-04-08 08:47:41 UTC
I found this:

> systemd has a minimal transaction system: if a unit is requested to start up or shut down it will add it and all its dependencies to a temporary transaction. Then, it will verify if the transaction is consistent (i.e. whether the ordering of all units is cycle-free). If it is not, systemd will try to fix it up, and removes non-essential jobs from the transaction that might remove the loop. Also, systemd tries to suppress non-essential jobs in the transaction that would stop a running service. Finally it is checked whether the jobs of the transaction contradict jobs that have already been queued, and optionally the transaction is aborted then. If all worked out and the transaction is consistent and minimized in its impact it is merged with all already outstanding jobs and added to the run queue. Effectively this means that before executing a requested operation, systemd will verify that it makes sense, fixing it if possible, and only failing if it really cannot work.
Source: https://www.freedesktop.org/software/systemd/man/latest/systemd.html

The root cause here seems to be that all units are transitioned to stopped except graphical-session which makes the whole session more or less a zombie. Maybe if the stopping of graphical-session could be marked as an essential job somehow the whole transaction would fail which should be a better outcome than this.
Comment 11 Malte S. Stretz 2024-04-08 08:51:19 UTC
systemctl has a --job-mode switch for this and the shutdown/halt commands set the equivalent to "replace-irreversibly" according to the man page.
Comment 12 Harald Sitter 2024-04-08 08:52:51 UTC
I suppose we should at least surface an error in the UI.
Comment 13 Malte S. Stretz 2024-04-08 09:18:20 UTC
I digged a bit and it looks like the job is already run in "fail" mode but unless I miss something then the result of the returned job object is never checked:
https://invent.kde.org/plasma/plasma-workspace/-/blob/v6.0.3/startkde/plasma-shutdown/shutdown.cpp?ref_type=tags#L126

There should probably some error message here, yes.
Comment 14 MikeC 2024-04-08 09:25:10 UTC
Created attachment 168282 [details]
journal that includes lines for logout fail from plasma 6

Journal log including logout fail lines prior to masking the drkonqi-coredump-pickup.service
Comment 15 Synthetic451 2024-04-17 19:56:55 UTC
This seems to have been fixed with Plasma 6.0.4
https://invent.kde.org/plasma/drkonqi/-/commit/45fcd31c993cfa518e5957f4dcff51ffeb0d7405
https://bugs.kde.org/show_bug.cgi?id=484864

I can no longer reproduce this. Closing.
Comment 16 Omar Hany Kasban 2024-11-23 12:57:47 UTC
i get `ksmserver-logout-greeter[5072]: kf.windowsystem: static bool KX11Extras::compositingActive() may only be used on X11` on 6.2.3
please reopen it its not fixed
Comment 17 Omar Hany Kasban 2024-11-23 13:04:24 UTC
(In reply to Omar Hany Kasban from comment #16)
> i get `ksmserver-logout-greeter[5072]: kf.windowsystem: static bool
> KX11Extras::compositingActive() may only be used on X11` on 6.2.3
> please reopen it its not fixed

masking drkonqi / removing drkonqi, doesn't work this time
Comment 18 Malte S. Stretz 2024-11-23 13:47:51 UTC
(In reply to Omar Hany Kasban from comment #17)
> (In reply to Omar Hany Kasban from comment #16)
> > i get `ksmserver-logout-greeter[5072]: kf.windowsystem: static bool
> > KX11Extras::compositingActive() may only be used on X11` on 6.2.3
> > please reopen it its not fixed
> 
> masking drkonqi / removing drkonqi, doesn't work this time

This looks like a different/new bug. Can you please report a new one?
Comment 19 Omar Hany Kasban 2024-11-23 13:49:07 UTC
fixed it was lan-mouse
Comment 20 Omar Hany Kasban 2024-11-23 13:49:35 UTC
(In reply to Malte S. Stretz from comment #18)
> (In reply to Omar Hany Kasban from comment #17)
> > (In reply to Omar Hany Kasban from comment #16)
> > > i get `ksmserver-logout-greeter[5072]: kf.windowsystem: static bool
> > > KX11Extras::compositingActive() may only be used on X11` on 6.2.3
> > > please reopen it its not fixed
> > 
> > masking drkonqi / removing drkonqi, doesn't work this time
> 
> This looks like a different/new bug. Can you please report a new one?

https://github.com/feschber/lan-mouse/issues/237
it was lan-mouse problem