Bug 449948

Summary: After kwin_wayland crashes and restarts or is manually restarted, Reboot, shutdown and logout do not work due to ksmserver relying on XWayland which also died and did not come back.
Product: [Unmaintained] ksmserver Reporter: Patrick Silva <bugseforuns>
Component: generalAssignee: John Brooks <john>
Status: RESOLVED FIXED    
Severity: normal CC: agurenko, auxsvr, bernie, dev+kde, dkxls23, grasm, heri+kde, herzenschein, john, katze_942, kishore96, Linus, matejm98mthw, mistry01, nate, peter5leconte, pfyu817, pilotgi, plasma-bugs, post, postix, putr4.s, sebastian.pb31, tristang
Priority: NOR Keywords: wayland
Version: 5.24.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=442846
Latest Commit: Version Fixed In: 6.0
Sentry Crash Report:
Attachments: attachment-9976-0.html

Description Patrick Silva 2022-02-10 16:27:31 UTC
SUMMARY
I use systemd startup if it matters.

STEPS TO REPRODUCE
1. use Wayland session
2. restart kwin_wayland by running 'kwin_wayland --replace' with krunner
3. if Plasma is not automatically restarted, do it by running 'plasmashell --replace' with krunner
4. try to reboot, shutdown or logout  via kickoff

OBSERVED RESULT
nothing happens. journalctl log prints these messages after the last step:

fev 10 13:05:55 Arch-PC dbus-daemon[632]: [session uid=1003 pid=632] Activating service name='org.kde.LogoutPrompt' requested by ':1.175' (uid=1003 pid=7036 comm="/usr/bin/plasmashell --replace ")
fev 10 13:05:55 Arch-PC dbus-daemon[7617]: writing oom_score_adj error: Permission denied
^X@sdfev 10 13:06:06 Arch-PC kwin_wayland[6788]: This plugin does not support raise()
fev 10 13:06:06 Arch-PC kwin_wayland[6788]: This plugin does not support raise()

EXPECTED RESULT
power options always work

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.24.0
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2
Graphics Platform: Wayland
Comment 1 Vlad Zahorodnii 2022-02-10 19:30:55 UTC
When you run kwin_wayland --replace, Xwayland will go down together with kwin. Unfortunately, ksmserver still requires X11, so it also goes down after running kwin_wayland --replace, i.e. the shutdown screen may not work as desired. Hopefully, this will be fixed with crash resilience changes.
Comment 2 Nate Graham 2022-02-11 19:34:55 UTC
Sounds like the proper fix would be for ksmserver to not require x11; as there will never be a time when kwin_wayland will never crash.
Comment 3 Bernie Innocenti 2022-03-19 04:04:44 UTC
Could bug #448517 be related to this one?
Comment 4 Dennis Schridde 2022-03-26 22:57:19 UTC
(In reply to Nate Graham from comment #2)
> Sounds like the proper fix would be for ksmserver to not require x11; as
> there will never be a time when kwin_wayland will never crash.

I noticed that Flatpak apps using X11 also hang indefinitely. Deleting /tmp/.X11-unix/X1 (and restarting them) resolves that. Just having ksmserver not depend on X11 seems not enough: kwin_wayland might need to be able to restart XWayland.
Comment 5 Dennis Schridde 2022-03-27 11:37:42 UTC
P.S. Is there a workaround? Can I somehow restart XWayland manually and make Flatpak apps and the logout dialogue work again?
Comment 6 m1st0 2022-04-07 01:22:36 UTC
Created attachment 148011 [details]
attachment-9976-0.html

** Removed at the request of the author **
Comment 7 m1st0 2022-04-07 01:30:24 UTC
Any helpful relationship?

Xwayland crash in gdm as screen off and touchscreen detach.
https://bugs.launchpad.net/oem-priority/+bug/1948894
Comment 8 Ben Cooksley 2022-04-07 10:00:57 UTC
The content of attachment 148011 [details] has been deleted
Comment 9 Nate Graham 2022-04-16 19:16:13 UTC
*** Bug 448517 has been marked as a duplicate of this bug. ***
Comment 10 Nate Graham 2022-04-16 19:16:24 UTC
*** Bug 450716 has been marked as a duplicate of this bug. ***
Comment 11 Nate Graham 2022-04-16 19:16:31 UTC
*** Bug 446143 has been marked as a duplicate of this bug. ***
Comment 12 Dennis Schridde 2022-04-18 20:16:40 UTC
Something possibly related came up in https://bugs.kde.org/show_bug.cgi?id=442846#c25
Comment 13 David Edmundson 2022-04-19 07:52:38 UTC
>Sounds like the proper fix would be for ksmserver to not require x11

No. It's sole job is an X11 session manager.

Bigger question is why it being missing prevents shutdown, it shouldn't. How are you shutting down exactly?
Comment 14 Nate Graham 2022-04-19 15:00:47 UTC
Any method: click buttons in Kickoff or activate any of the session items from KRunner.
Comment 15 Nate Graham 2022-05-23 20:08:36 UTC
*** Bug 454071 has been marked as a duplicate of this bug. ***
Comment 16 Matej Mrenica 2022-05-24 08:13:19 UTC
Does installing xorg-xwayland-git from AUR fix this issue? It does for me.
Comment 17 Patrick Silva 2022-05-24 15:45:49 UTC
(In reply to Matej Mrenica from comment #16)
> Does installing xorg-xwayland-git from AUR fix this issue? It does for me.

Cannot confirm. The bug persists with xorg-xwayland-git from AUR.
Comment 18 Matej Mrenica 2022-05-24 15:55:06 UTC
(In reply to Patrick Silva from comment #17)
> (In reply to Matej Mrenica from comment #16)
> > Does installing xorg-xwayland-git from AUR fix this issue? It does for me.
> 
> Cannot confirm. The bug persists with xorg-xwayland-git from AUR.

Do you know the exact steps that always trigger the issue for you?
Comment 19 Patrick Silva 2022-05-24 15:58:18 UTC
1. start Plasma Wayland session
2. run 'kwin_wayland --replace' with krunner
Comment 20 Matej Mrenica 2022-05-24 16:04:38 UTC
(In reply to Patrick Silva from comment #19)
> 1. start Plasma Wayland session
> 2. run 'kwin_wayland --replace' with krunner

You are correct, the issue is NOT fixed by installing xorg-xwayland-git the steps above result in the issue described in OP.
Comment 21 Nate Graham 2022-07-13 19:51:14 UTC
*** Bug 456601 has been marked as a duplicate of this bug. ***
Comment 22 Bug Janitor Service 2022-11-25 17:45:44 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2364
Comment 23 Bug Janitor Service 2022-11-26 04:46:28 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2368
Comment 24 Bug Janitor Service 2022-11-26 13:49:33 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2369
Comment 25 Nate Graham 2022-12-22 22:50:26 UTC
Fixed by David Edmunsdon with https://invent.kde.org/plasma/plasma-workspace/-/commit/c593897b80c9962c575f10391cabe4cf8fbc1fe0 in Plasma 5.27!
Comment 26 Patrick Silva 2023-12-02 13:29:09 UTC
Can reproduce on Plasma 6 beta.

STEPS TO REPRODUCE
1. use Wayland session
2. restart kwin_wayland by running 'kwin_wayland --replace' with krunner
3. invoke the logout screen by pressing ctrl+alt+del
4. choose Log Out, or Restart, or Shut Down

Result: nothing happens

Operating System: Arch Linux 
KDE Plasma Version: 5.90.0
KDE Frameworks Version: 5.246.0
Qt Version: 6.6.1
Graphics Platform: Wayland
Comment 27 Patrick Silva 2023-12-03 02:48:13 UTC
*** Bug 477911 has been marked as a duplicate of this bug. ***
Comment 28 Bug Janitor Service 2023-12-08 22:35:09 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/3672
Comment 29 David Edmundson 2023-12-12 21:47:49 UTC
Git commit 015652168e7e2949efde4ab2707ac72ef934ce96 by David Edmundson.
Committed on 12/12/2023 at 22:32.
Pushed by davidedmundson into branch 'master'.

plasma-shutdown: Continue on ksmserver errors

If ksmserver fails to respond to a shutdown request it is more important
to continue the user's request of shutting down than it is to bail out.

This comes up more often the legitimate case wayland where an xwayland
crash would leave ksmserver not running, but does not log the user out.
We want to move in the direction of ksmserver being optional on wayland.

M  +2    -2    startkde/plasma-shutdown/shutdown.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/015652168e7e2949efde4ab2707ac72ef934ce96