Bug 445449

Summary: Shutting down from Plasma Wayland causes shutdown to be delayed while stopping SDDM
Product: [Plasma] kwin Reporter: Jon Voss <jonvoss>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: CLOSED UPSTREAM    
Severity: normal CC: 4wy78uwh, albertocollado, aleixpol, asvqmnmd, christian.vedtofte, hello, hgabreu, indecisiveautomator, kde.isolating320, kdudka, Lamdarer, martin, matt.fagnani, matthew.adie, michal.dybczak, michiel, miku84, nate, openmail+kde, postix, rafael.linux.user, rdieter, rm, sam, saveurlinux, scalvin, sonichedgehog_hyperblast00, tdawson, tim, timothyadams, tobi.goergens, winblocker
Priority: NOR Keywords: wayland
Version: 5.23.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
URL: https://github.com/sddm/sddm/issues/1476
See Also: https://bugs.kde.org/show_bug.cgi?id=374538
https://bugs.kde.org/show_bug.cgi?id=456713
Latest Commit: Version Fixed In:
Attachments: picture of issue
tail of journal where issue occurred

Description Jon Voss 2021-11-13 23:46:49 UTC
Created attachment 143523 [details]
picture of issue

SUMMARY
When issuing a shutdown or restart from within a Plasma Wayland session, there is a 1 min. 30 sec. delay while waiting for systemd to stop Simple Desktop Display Manager. This times out and forces a SIGKILL to sddm and associated processes.

If I log out of my session and shutdown/reboot directly from sddm, this issue does not occur. Shutdown is instantaneous.

I cannot reproduce in the X11 session. It only occurs in Wayland. It also did not occur prior to 5.23.3.
A relevant portion of my shutdown log is attached. Not much to see, unfortunately.

Let me know if I can help in any way.

STEPS TO REPRODUCE
1. Log in to Plasma Wayland
2. Applcation Launcher -> Shutdown (or Restart)

OBSERVED RESULT
Shutdown hangs on SDDM.

EXPECTED RESULT
Shutdown should be instantaneous.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.23.3
KDE Frameworks Version: 5.87.0
Qt Version: 5.15.2
Kernel Version: 5.15.2-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 5800X 8-Core Processor
Memory: 15.6 GiB of RAM
Graphics Processor: AMD Radeon RX 6700 XT

ADDITIONAL INFORMATION

Does this fix?
https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1177
Comment 1 Jon Voss 2021-11-13 23:47:29 UTC
Created attachment 143524 [details]
tail of journal where issue occurred
Comment 2 Schlaefer 2021-11-14 11:37:00 UTC
> SUMMARY
> When issuing a shutdown or restart from within a Plasma Wayland session,
> there is a 1 min. 30 sec. delay while waiting for systemd to stop Simple
> Desktop Display Manager. This times out and forces a SIGKILL to sddm and
> associated processes.

Same here.

The issue started using the 15.15 kernel. Check with 5.10-LTS seems fine.

Just switching to a new session (strg+alt+F-key) and back immediately successfully stops SDDM.

Operating System: EndeavourOS
KDE Plasma Version: 5.23.3
KDE Frameworks Version: 5.88.0
Qt Version: 5.15.2
Kernel Version: 5.15.2-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Graphics Processor: AMD Radeon RX 5500 XT
Comment 3 Jon Voss 2021-11-14 14:59:08 UTC
(In reply to Schlaefer from comment #2)
> > SUMMARY
> > When issuing a shutdown or restart from within a Plasma Wayland session,
> > there is a 1 min. 30 sec. delay while waiting for systemd to stop Simple
> > Desktop Display Manager. This times out and forces a SIGKILL to sddm and
> > associated processes.
> 
> Same here.
> 
> The issue started using the 15.15 kernel. Check with 5.10-LTS seems fine.
> 

Confirmed. I downgraded to kernel 5.14.16 and the issue went away. Shutdown is immediate.
Comment 4 asvqmnmd 2021-11-14 17:28:42 UTC
I am having the same issue with xorg - https://bugs.kde.org/show_bug.cgi?id=445385
Comment 6 Aleix Pol 2021-11-23 23:17:48 UTC
Would you be able to test git master there? f377696bff39e35ae0f7ae6104d8732b3856744e could help address this issue.

Otherwise, could you try enabling systemd boot for Plasma and see if it addresses the problem for you?
https://invent.kde.org/plasma/plasma-workspace/-/wikis/Plasma-and-the-systemd-boot
Comment 7 Nate Graham 2021-11-24 19:32:25 UTC
.
Comment 8 asvqmnmd 2021-11-25 08:09:54 UTC
(In reply to Aleix Pol from comment #6)
> Would you be able to test git master there?
> f377696bff39e35ae0f7ae6104d8732b3856744e could help address this issue.
> 
> Otherwise, could you try enabling systemd boot for Plasma and see if it
> addresses the problem for you?
> https://invent.kde.org/plasma/plasma-workspace/-/wikis/Plasma-and-the-
> systemd-boot

I am facing the same problem as I mentioned in my bug - https://bugs.kde.org/show_bug.cgi?id=445385
 This is my shutdown log - http://ix.io/3G3o
Comment 9 asvqmnmd 2021-11-25 08:51:02 UTC
People having the same issue here I think it is a sddm issue or a kwin issue - https://bbs.archlinux.org/viewtopic.php?id=259577
Comment 10 Jon Voss 2021-11-27 05:38:07 UTC
(In reply to Aleix Pol from comment #6)
> Would you be able to test git master there?
> f377696bff39e35ae0f7ae6104d8732b3856744e could help address this issue.
> 
> Otherwise, could you try enabling systemd boot for Plasma and see if it
> addresses the problem for you?
> https://invent.kde.org/plasma/plasma-workspace/-/wikis/Plasma-and-the-
> systemd-boot

Using systemd boot for the session doesn't fix. Will that MR be included in 5.23.4? If so, I will let you know if it resolves when it hits the repo next week.
Comment 11 Jon Voss 2021-11-30 17:38:23 UTC
Reporting back that 5.23.4 does not fix the issue.
Comment 12 asvqmnmd 2021-12-03 16:03:54 UTC
(In reply to Jon Voss from comment #11)
> Reporting back that 5.23.4 does not fix the issue.

I think it is a kwin (compositor bug). Systemd is not able to kill kwin. Thats why it takes time to shutdown.
Comment 13 Alberto 2021-12-04 09:18:49 UTC
With another display manager there is no delay in shutdown.
The problem is caused by SDDM,
Comment 14 asvqmnmd 2021-12-04 19:40:08 UTC
(In reply to Alberto from comment #13)
> With another display manager there is no delay in shutdown.
> The problem is caused by SDDM,

Anyways I fixed my problem. I am using cinnamon with sddm. I completely removed kde and it works fine. Kde has a lot of bugs and they don't fix it so I switched to cinnamon and it works like a charm. The best way to fix a problem is to file a bug report and if they don't fix it just simply move to a new display manager or a new desktop environment.
Comment 15 asvqmnmd 2021-12-04 19:47:35 UTC
Cinaamon is much better than plasma and they have dont have serious bugs like kde. Cinnamon is a bit ugly but u can change it if u want.
Comment 16 asvqmnmd 2021-12-04 19:49:00 UTC
Don't have *
Comment 17 Roke Julian Lockhart Beedell 2021-12-11 19:47:04 UTC
For me, this problem was present during approximately two months before 2021-12-11, whcih was when I was utilising Manjaro KDE, and subsequently Rawhide of Fedora Kinoite, and subsequently Rawhide of Fedora KDE Plasma Desktop. This problem did not affect my subsequent and recent installation of Debian 12, although my lack of utilisation of that installation may have been why it did not affect it. Additionally, this problem has not affected my current installation of Rawhide of Fedora KDE Plasma Desktop by version of the installer of Fedora Server that had been submitted from Rawhide. I have not manually installed new drivers since my current installation of Fedora KDE Plasma Desktop, and I have extensively utilised this computer. Consequently, is anybody that is utilising the most new version of their distribution able to verify that this is occurring for them?
Comment 18 Alberto 2021-12-12 09:39:09 UTC
This bug is also in OpenSuse Tumbleweed
Comment 19 Jon Voss 2021-12-13 13:57:57 UTC
I was able to compile git master and it appears this may be fixed there. I haven't tested extensively, but a couple of reboots didn't hang.
Comment 20 Vlad Zahorodnii 2021-12-13 14:49:58 UTC
From my quick debugging session, it appears like sddm is stopped, but then sddm restarts for some unknown reason.
Comment 21 winblocker 2022-01-06 20:54:21 UTC
Tested on OpenSuse Tumbleweed Krypton (Git) on January 2nd and the problem still is present. The timer can be worked around when the keys for the session are pressed (ctrl + f7 OpenSuse / ctrl + f1 arch).
Comment 22 Vlad Zahorodnii 2022-01-10 09:26:39 UTC
Can somebody report this issue to SDDM developers? SDDM stops X11 and then restarts it for some reason, which causes a hang. kwin_wayland is gone by that time.
Comment 23 Vlad Zahorodnii 2022-01-18 10:24:47 UTC
FTR, with wayland greeter, I can't reproduce the issue. As a workaround you could use

[General]
DisplayServer=wayland

[Wayland]
CompositorCommand=weston --shell=fullscreen-shell.so
EnableHiDPI=true

make sure that you have weston installed, you could also use kwin_wayland
Comment 24 Aleix Pol 2022-01-18 16:34:05 UTC
Here's the issue in SDDM: https://github.com/sddm/sddm/issues/1476
Comment 25 Nate Graham 2022-03-21 23:41:58 UTC
*** Bug 445385 has been marked as a duplicate of this bug. ***
Comment 26 Nate Graham 2022-03-21 23:42:02 UTC
*** Bug 451065 has been marked as a duplicate of this bug. ***
Comment 27 Tobias G. 2022-04-02 00:26:27 UTC
I also have this issue with Plasma 5.24.3 on Manjaro, using the wayland session and kernel 5.16
Comment 28 steve 2022-04-06 07:13:51 UTC
I also have this issue with Plasma 5.24.4 on Arch, using the wayland session and kernel 5.17.
Comment 29 indecisiveautomator 2022-04-09 16:12:08 UTC
I have this issue with Plasma 5.24.4 on Arch with Kernel 5.17.1, on my laptop and my desktop with the same OS.
Comment 30 Matthew Adie 2022-04-25 19:31:15 UTC
I also have this issue with Plasma 5.24.4 on Arch, using the wayland session and kernel 5.17.4
Comment 31 steve 2022-04-25 19:34:12 UTC
(In reply to steve from comment #28)
> I also have this issue with Plasma 5.24.4 on Arch, using the wayland session
> and kernel 5.17.

Edit: I have found the most convenient workaround right now is to logout the user before shutting down/rebooting.
Comment 32 Troy Dawson 2022-04-25 21:26:33 UTC
What was the real problem with this?  Why was this kernel related?
I haven't seen anything relating to the real problem, just work around so things don't take long to shut down.

We are seeing the same thing (Slow SDDM shutdown) and worse on CentOS Stream 8.  All of it is fine with an older kernel, but the newer kernel is having issues.
Note:  We are seeing a blank screen on SDDM startup.  If you use a different desktop manager, then ksplash is blank.  And then if you lock your screen, you never get a password prompt to unlock it.
Comment 33 postix 2022-04-26 08:30:06 UTC
(In reply to steve from comment #31)
> Edit: I have found the most convenient workaround right now is to logout the
> user before shutting down/rebooting.

I think I can confirm this workaround: 5 s shutting down (once logged out after 2 s) vs 3 minutes waiting.
Comment 34 Christian 2022-11-04 15:01:21 UTC
I can confirm that this bug still exists for me, but that the workaround with logging out before shutting down works.
My system is Plasma 5.26.2 on Arch, using the wayland session and kernel version 6.0.6-arch1-1 (64-bit)
Comment 35 postix 2022-11-04 16:19:53 UTC
The upstream bug was closed without a general solution on Jun 15.

FWIW I keep experiencing it on Plasma 5.26.2 Wayland on openSUSE TW with kernel 6.0.6 and systemd-boot.
The relevant part of journalctl is the following:

```
16:35:11 systemd[1]: user-1000.slice: Consumed 2min 4.592s CPU time.

<--------------------------------------------------------------------------------------->

16:36:40 systemd[1]: display-manager.service: State 'stop-sigterm' timed out. Killing.
16:36:40 systemd[1]: display-manager.service: Killing process 2011 (sddm) with signal SIGKILL.
16:36:40 display-manager[1989]: Starting service sddm
16:36:40 systemd[1]: display-manager.service: Main process exited, code=killed, status=9/KILL
16:36:40 systemd[1]: display-manager.service: Failed with result 'timeout'.
16:36:40 systemd[1]: display-manager.service: Unit process 8024 (Xorg.bin) remains running after unit stopped.
16:36:40 systemd[1]: Stopped X Display Manager.
16:36:40 systemd[1]: display-manager.service: Triggering OnFailure= dependencies.
16:36:40 systemd[1]: Requested transaction contradicts existing jobs: Transaction for plymouth-quit.service/start is destructive (srv.mount has 'stop' job queued, but 'start' is included in transaction).
16:36:40 systemd[1]: display-manager.service: Failed to enqueue OnFailure= job, ignoring: Transaction for plymouth-quit.service/start is destructive (srv.mount has 'stop' job queued, but 'start' is included in transaction).
16:36:40 systemd[1]: Starting Show Plymouth Reboot Screen...
16:36:40 systemd[1]: Stopping User Login Management...
```

Does the proposed workaround in comment 23 only work for sddm git master? Is there any known ETA for a new release?
openSUSE TW comes with SDDM 0.19.0-7.1 and despite setting wayland as the display server, sddm keeps sticking to X11.
Comment 36 Nate Graham 2022-11-04 16:26:49 UTC
The problem is that SDDM needs a new release with the fix in it. I've talked to the SDDM folks and they're going to try to do one soon.
Comment 37 hello 2022-12-06 12:58:35 UTC
I had the same issue on Arch, installing sddm-git from AUR fixed the problem.
Comment 38 Michał Dybczak 2023-03-01 09:40:49 UTC
I confirm that issue on Plasma 5.27 on Wayland on Manjaro. With X11 shutdown is quick, with Wayland it's 1,5 minute delayed.
Comment 39 timadams 2023-05-09 11:28:28 UTC
I also have this problem with Plasma 5.27.4 on Tumbleweed, on a computer running nouveau and on another with the nvidia driver.  Normal shutdown with X-11, 90 second delay with Wayland.  Wayland runs perfectly in other respects.
Comment 40 Tim Richardson 2023-07-20 03:33:16 UTC
I'm using kubuntu 23.04 with backports (plasma 5.27.6) . I get this logout hang with kernel 6.4 (Liquorix) but not with the distro's 6.2 kernel.
Comment 41 Rafael Linux User 2023-10-05 09:05:18 UTC
Using kernel 6.5.4 (in openSUSE) and similar issue. Each time I shutdown, applications are closed, but a black screen remains forever and system doesn't switch off.
Comment 42 Josh 2023-11-23 10:13:55 UTC
Hi, I have the same issue and I believe the problem started after a recent kernel update. My versions:

Operating System: Kubuntu 23.04
KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.104.0
Qt Version: 5.15.8
Kernel Version: 6.2.0-37-generic (64-bit)
Graphics Platform: Wayland
Comment 43 Rafael Linux User 2023-11-23 11:09:41 UTC
(In reply to Josh from comment #42)
> Hi, I have the same issue and I believe the problem started after a recent
> kernel update. My versions:
> 
> Operating System: Kubuntu 23.04
> KDE Plasma Version: 5.27.4
> KDE Frameworks Version: 5.104.0
> Qt Version: 5.15.8
> Kernel Version: 6.2.0-37-generic (64-bit)
> Graphics Platform: Wayland

My issue is yet gone, but I'm not sure if after a kernel update or a total reinstallation of my distro.
Comment 44 Nate Graham 2023-11-29 19:48:37 UTC
When this happens, hit the Escape key and you'll be able to see what exactly is causing shutdown to be slow.

If it's SDDM, then make sure your distro has SDDM 0.20, which fixed the issue

If it's not SDDM, then the issue is caused by something else hanging on quit.