Bug 488853

Summary: Plasma X11 with Session Restore enabled fails to shutdown/logout/restart, keeps hanging at black screen with mouse cursor
Product: [Plasma] plasmashell Reporter: Ham L. <thetechguy1011>
Component: Session ManagementAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: asturm, breakingspell, carlosdemaine, gj.eldering, jr, kde, keplicz, mwoodj, natalie_clarius, nate, neon-bugs, nylle, qydwhotmail, root, stevee, svkatz80, thetechguy1011
Priority: VHI Keywords: regression
Version: 6.1.4   
Target Milestone: 1.0   
Platform: Neon   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=487912
https://bugs.gentoo.org/show_bug.cgi?id=938925
Latest Commit: Version Fixed In: 6.2.0
Sentry Crash Report:

Description Ham L. 2024-06-21 01:41:38 UTC
***
If you're not sure this is actually a bug, instead post about it at https://discuss.kde.org

If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

SUMMARY
In KDE Neon 6.1, when I'm trying to make use of X11 instead of Wayland, I cannot logout, shutdown, or restart normally. Wayland is NOT impacted.

STEPS TO REPRODUCE
1. Upon reaching the login screen, specify the Plasma (X11) desktop environment.
2. Complete the login process, activating aforementioned desktop environment.
3. Attempt to logout, shutdown, or restart.

OBSERVED RESULT
Black screen with cursor still present. The kwin/ksmserver process does not appear to terminate at all, leaving the default tty2 unusable.

EXPECTED RESULT
kwin/ksmserver should terminate gracefully and swiftly instead of hanging and not doing anything else, completing the logout/shutdown/restart action.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE Neon
KDE Plasma Version: 6.1.0
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.0

ADDITIONAL INFORMATION

WORKAROUNDS USED
To complete the process, I either need to send a SIGHUP, SIGTERM, or SIGKILL to /usr/bin/ksmserver to achieve a logout, or pass the `reboot` or `shutdown` commands to another tty session.
Comment 1 nyl 2024-06-21 09:36:42 UTC
can confirm this x11 arch linux kde plasma 6.1 kwin, logout prompt failing see here:
https://0x0.st/XTdh.txt
full session journal:
https://0x0.st/XTdO.txt
Comment 2 Darius 2024-06-22 20:30:41 UTC
I can also confirm this, same log as @nyl
Comment 3 VK 2024-06-22 21:02:04 UTC
Same problem on amdgpu, but no such problem on nvidia.
Comment 4 nyl 2024-06-23 02:34:20 UTC
(In reply to VK from comment #3)
> Same problem on amdgpu, but no such problem on nvidia.

I can confirm problem DOES exist on nvidia
Comment 5 VK 2024-06-27 10:54:37 UTC
On plasma-workspace 6.1.1-1 and 6.1.0-1 the problem still exists.
Comment 6 Michael Wood 2024-06-28 07:20:25 UTC
I am running Plasma 6.1.1 with nvidia 555 driver. Logout fails on x11 but works properly with wayland.
Comment 7 Piotr Keplicz 2024-07-18 11:48:35 UTC
I experience similar problems. Session doesn't end when logging out, leaves a blank screen with the mouse cursor. I'm using X11, happens with and without the external screen attached.

Using KDE neon with Plasma 6.1.2, problems started after an upgrade to 6.1.0.
Comment 8 VK 2024-08-02 16:24:13 UTC
On plasma-workspace 6.1.3-1 the problem still exists.
Comment 9 VK 2024-08-02 16:43:49 UTC
In System settings > Session > Desktop Session, select 'Start with an empty session' and reboot. 
The problem disappears: plasma 'Restart' and 'Shut down' work as expected.
Comment 10 Ham L. 2024-08-09 13:24:00 UTC
So this bug exists across all graphical environments (Intel, nVidia, AMD) and still exists on the latest version of Plasma, breaking session saving. Can we get this escalated somehow?
Comment 11 Gerrit Jan 2024-08-09 14:55:06 UTC
On openSUSE Slowroll i have the same problem.
When I activate “manually saved session”, the shutdown fails.
However, if I set it to “at last logout” everything works fine.
The latest Slowroll, did not solved the problem!
Comment 12 Andreas Sturmlechner 2024-09-05 11:44:32 UTC
Reverting https://invent.kde.org/plasma/plasma-workspace/-/commit/0857d18dfc3fc870a7f768731fdf46dc3abc5f8f was shown to "fix" this problem, but of course it is no solution.
Comment 13 Bug Janitor Service 2024-09-05 14:44:12 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4684
Comment 14 Fushan Wen 2024-09-05 14:45:27 UTC
Any affected user can test https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4684 ?
Comment 15 Bug Janitor Service 2024-09-20 03:47:00 UTC
🐛🧹 ⚠️ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME.

For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging.

Thank you for helping us make KDE software even better for everyone!
Comment 16 Bug Janitor Service 2024-09-20 12:36:56 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4731
Comment 17 Fushan Wen 2024-09-20 13:01:41 UTC
Git commit 9bd2dcc8a785d977cdf67a7cbb467423803e3327 by Fushan Wen, on behalf of David Edmundson.
Committed on 20/09/2024 at 13:01.
Pushed by fusionfuture into branch 'master'.

startkde: Disable session management in our session management

We have two types of session restore, ksmserver for ICE clients and a
small fallback app that runs after ksmserver for any stragglers.

This fallback app is a gui application, as such it will try and connect
to ksmserver. This isn't useful and can cause a block.

M  +1    -0    startkde/session-restore/restore.cpp
M  +1    -0    startkde/session-restore/save.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/9bd2dcc8a785d977cdf67a7cbb467423803e3327
Comment 18 Steve Evans 2024-09-20 13:26:17 UTC
I just tried https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4684 and it did /not/ work. I did this after building with the patch:

1. Create a new user so there is no old user cruft to confuse things.
2. Log on.
3. Log off. This worked
4. Logged on again.
5. Changed the Session Restore setting to When session was manually saved.
6. Added a konsole to the desktop.
7. Saved the session.
8. Log off. This hung. I waited 30 minutes, it still hadn't logged off so I killed ksmserver and the logoff then completed.

I will now try the new patch https://invent.kde.org/plasma/plasma-workspace/-/commit/9bd2dcc8a785d977cdf67a7cbb467423803e3327
Comment 19 Fushan Wen 2024-09-20 13:33:28 UTC
Git commit 792586f26e532dc049fc2f613d9a77db976f9054 by Fushan Wen.
Committed on 20/09/2024 at 13:02.
Pushed by fusionfuture into branch 'Plasma/6.2'.

startkde: Disable session management in our session management

We have two types of session restore, ksmserver for ICE clients and a
small fallback app that runs after ksmserver for any stragglers.

This fallback app is a gui application, as such it will try and connect
to ksmserver. This isn't useful and can cause a block.


(cherry picked from commit 9bd2dcc8a785d977cdf67a7cbb467423803e3327)

Co-authored-by: David Edmundson <kde@davidedmundson.co.uk>

M  +1    -0    startkde/session-restore/restore.cpp
M  +1    -0    startkde/session-restore/save.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/792586f26e532dc049fc2f613d9a77db976f9054
Comment 20 Steve Evans 2024-09-20 14:13:44 UTC
The patch https://invent.kde.org/plasma/plasma-workspace/-/commit/9bd2dcc8a785d977cdf67a7cbb467423803e3327 worked for me. Thanks.