Bug 439096

Summary: kscreenlocker broken with error message on wayland
Product: [Plasma] kscreenlocker Reporter: Cane Kostovski <trekjunky>
Component: greeterAssignee: Plasma Bugs List <plasma-bugs>
Status: CLOSED FIXED    
Severity: normal CC: 677ee1vp, bhush94, gustavo.schenkel, g_fretes, horen, kde, ljs80808, marc.collin, matejm98mthw, nate, noloader, nortexoid, postix, trekjunky, vikts
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=438839
Latest Commit: Version Fixed In: 5.23
Sentry Crash Report:
Attachments: Journalctl output
Journal entries during a single boot

Description Cane Kostovski 2021-06-24 03:57:16 UTC
SUMMARY
The screen locker is broken and unlocking is not possible anymore. In order to unlock switch to a virtual terminal(Ctrl+Alt+F2), login and execute the command loginctl unlock-session 2. Afterwards switch back to the running session (Ctrl+Alt+F1)

STEPS TO REPRODUCE
1. Lock screen
2. Turn off TV/Monitor
3. Turn on TV/Monitor

OBSERVED RESULT
error message displayed and loginctl unlock_sessions does not work

EXPECTED RESULT
To type my password and have the session unlock

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 5.22.0
(available in About System)
KDE Plasma Version: 5.22.0
KDE Frameworks Version: latest
Qt Version: latest

ADDITIONAL INFORMATION
Comment 1 Victoria 2021-06-26 09:07:21 UTC
I have the same situation on Arch.

Operating System: Arch Linux
KDE Plasma Version: 5.22.2
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Kernel Version: 5.12.12-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 2600X Six-Core Processor
Memory: 15.6 GiB of RAM
Graphics Processor: Radeon RX 580 Series
Comment 2 Cane Kostovski 2021-06-29 00:07:10 UTC
Original Poster updated versions
Operating System: OpenSuSE Tumbleweed
KDE Plasma Version: 5.22.1
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Kernel Version: 5.12.12-1-default (64-bit)
Graphics Platform: Wayland
Processors: 8-Core AMD FX 8350 Black Box Processor
Memory: 31.3 GiB of RAM
Graphics Processor: Radeon RX 570 Series
Comment 3 Cane Kostovski 2021-06-30 08:33:34 UTC
Original Poster updated versions
Operating System: OpenSuSE Tumbleweed
KDE Plasma Version: 5.22.2
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Kernel Version: 5.12.13-1-default (64-bit)
Graphics Platform: Wayland
Processors: 8-Core AMD FX 8350 Black Box Processor
Memory: 31.3 GiB of RAM
Graphics Processor: Radeon RX 570 Series
kscreenlocker-5.22.2.1-1.1.x86_64.rpm
Comment 4 horen@mac.com 2021-07-04 16:12:42 UTC
Same problem on Fedora rawhide.
Comment 5 Zamundaaa 2021-07-07 13:10:45 UTC
*** Bug 439261 has been marked as a duplicate of this bug. ***
Comment 6 Michael D 2021-07-07 13:16:51 UTC
We seem to all be using Radeon graphics:
Operating System: Manjaro Linux
KDE Plasma Version: 5.22.3
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Kernel Version: 5.13.0-2-MANJARO (64-bit)
Graphics Platform: Wayland
Processors: 6 × AMD Ryzen 5 4500U with Radeon Graphics
Memory: 14.5 GiB of RAM
Graphics Processor: AMD RENOIR
Comment 7 horen@mac.com 2021-07-07 14:08:07 UTC
In my case Plasma 5.22.2
Framework 5.83.0
Qt: 5.15.2
Kernel 5.13.0-58
Graphics: Wayland
Graphics: Radeon RX 5700 XT
Comment 8 Cane Kostovski 2021-07-08 04:46:15 UTC
Operating System: openSUSE Tumbleweed 20210704
KDE Plasma Version: 5.22.2
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Kernel Version: 5.12.13-1-default (64-bit)
Graphics Platform: Wayland
Processors: 8 × AMD FX(tm)-8350 Eight-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: Radeon RX 570 Series
Comment 9 horen@mac.com 2021-07-08 12:07:49 UTC
Same behavior with KDE 5.22.3 

Operating System: Arch Linux
KDE Plasma Version: 5.22.3
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Kernel Version: 5.12.14-arch1-1(64-bit)
Graphics Platform: Wayland
Processors: 64 × AMD Ryzen Threadripper 3970X-32-Core
Memory: 94.2 GiB of RAM
Graphics Processor: AMD Radeon RX 5700 XT
Comment 10 Cane Kostovski 2021-07-09 07:23:13 UTC
Operating System: openSUSE Tumbleweed 20210706
KDE Plasma Version: 5.22.2
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Kernel Version: 5.13.0-1-default (64-bit)
Graphics Platform: Wayland
Processors: 8 × AMD FX(tm)-8350 Eight-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: Radeon RX 570 Series
Comment 11 David Edmundson 2021-07-09 08:03:10 UTC
There isn't a lot to go on from these comments. Journalctl output after the event?

I suspect this is the same cause as 438839.
Comment 12 Victoria 2021-07-09 08:32:09 UTC
Created attachment 139965 [details]
Journalctl output

Crash around 10:10
Comment 13 Cane Kostovski 2021-07-09 08:50:01 UTC
Jul 09 04:25:33│kernel│kscreenlocker_g[5270]: segfault at 18 ip 00007fa9e35df53b sp 00007ffff62879a0 error 4 in libLayerShellQtInterface.so.5.22.2[7fa9e35de000+2000]                               │
 │Jul 09 04:27:19│kernel│kscreenlocker_g[5313]: segfault at 0 ip 00007f2fb0692516 sp 00007ffea4aeb950 error 4 in libwayland-client.so.0.3.0[7f2fb068e000+5000]
Comment 14 David Edmundson 2021-07-09 09:44:39 UTC
Ok, not quite the same as 438839 but similar.

We're getting the placeholder screen.

That gets into 

```
    init(shell->get_layer_surface(window->waylandSurface()->object(), window->waylandScreen()->output(), interface->layer(), interface->scope()));

```

This then obviously crashes.
Comment 15 Cane Kostovski 2021-07-12 07:49:33 UTC
What priority is it to fix this issue? How soon will it be fixed? Sorry about my impatience.
Comment 16 David Edmundson 2021-07-12 09:22:54 UTC
Don't do that please.

If you want to help please confirm the blind theory above with some debug on your system that reproduces it.
Comment 17 Gustavo Brondani Schenkel 2021-07-13 18:00:54 UTC
I have the same problem, but what I can add to this bug report is it happens when my Monitor is using the Deep Sleep function, which is like a standby function. In this mode the OS needs do a power cycle on video adapter to wake the monitor up. I have tried just turn off the option but was in vain, because I reinstalled the system(moved to f2fs on a NVME SSD) few day ago and forgot to add the kernel instruction on the bootloader for optimize power on my AMD RDNA2 (amdgpu.aspm=1). This is the 3rd day I test it and the problem can be avoided doing this.

Neither Kernel 5.11.x to 5.13.x can wake up the monitor in this state, which covers all new AMD Cards (Big Navi / RX 6000 / Navi 2x / RDNA2)), at least not using open source drivers. On Windows it work.

An issue still related is soon after I unlock the session I can notice all my KDE Apps reside to another shape, Konsole, Dolphin, Konversation are examples.

My theory is when the machine enters in a state of "standby"(not hibernating or suspended) the video adapter sleep, and Wayland can't find any available display to handle the session to unlock the screen, also resizing to small resolution.

Maybe what we need in here is to a dummy video adapter to exist and handle stuff while none are available, changing back to the first available adapter after.

Just for observation, using X.Org this issue of unlocking session doesn't happen, the other however still exist.


https://www.phoronix.com/scan.php?page=news_item&px=AMDGPU-Linux-5.12-More-Fixes

Operating System: Slackware 15.0-beta
KDE Plasma Version: 5.22.3
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.2
Kernel Version: 5.12.16 (64-bit)
Graphics Platform: Wayland
Processors: 28 × Intel® Xeon® CPU E5-2697 v3 @ 2.60GHz
Memory: 125.7 GiB of RAM
Graphics Processor: AMD Radeon RX 6800 XT
Comment 18 Cane Kostovski 2021-07-21 02:30:58 UTC
Operating System: openSUSE Tumbleweed 20210718
KDE Plasma Version: 5.22.3
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.2
Kernel Version: 5.13.2-1-default (64-bit)
Graphics Platform: Wayland
Processors: 8 × AMD FX(tm)-8350 Eight-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: Radeon RX 570 Series
Comment 19 Cane Kostovski 2021-07-21 02:33:08 UTC
How do I get debug info from kscreenlocker?
Comment 20 Cane Kostovski 2021-07-21 04:07:21 UTC
Created attachment 140225 [details]
Journal entries during a single boot

Jul 20 23:33:17 is when I started KScreenLocker, Turned Off My TV, And Turned it back on to see the problem
Comment 21 Cane Kostovski 2021-07-29 04:14:19 UTC
Operating System: openSUSE Tumbleweed 20210726
KDE Plasma Version: 5.22.3
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.2
Kernel Version: 5.13.4-1-default (64-bit)
Graphics Platform: Wayland
Processors: 8 × AMD FX(tm)-8350 Eight-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: Radeon RX 570 Series
Comment 22 Cane Kostovski 2021-07-30 08:39:51 UTC
2021-06-24 I reported the bug.
I don't know the date this bug was confirmed.

It is now 2021-07-30. How patient need I be? Should I have a six pack beer every day to help me get to the day it is fixed?

I asked how to get the debug report for kscreenlocker on 2021-07-21, but I did not get an answer. I guess it is not needed from me.

Please give me a rough estimate for when it will be fixed?
Comment 23 David Edmundson 2021-07-30 08:59:31 UTC
I do not need any further info.

I do need you to not spam my bug tracker. It makes it hard to find the comments that do add value. 

To post an update: There was a patch for layershell-qt that got merged. That might fix the issue on it's own, but ideally we need to refactor kscreenlocker code to handle screens in a more sane way then add a guard for the null geometry that we would get from Qt's placeholder screen.
Comment 24 Cane Kostovski 2021-07-30 23:41:02 UTC
# zypper search *layershell-qt*
Loading repository data...
Reading installed packages...
No matching items found.
Comment 25 postix 2021-07-31 17:20:30 UTC
Just to answer this question to Cane Kostovski from comment #24 
If you intend the determine version of the package and to figure out if it contains the patch, you've searched wrong, use regex for those cases:
``` zypper search layer | grep -iE "(shell|qt)" ```

> i+ | layer-shell-qt5 | wlr-layer-shell integration for Qt 5

Here's the changelog by the way: https://opensuse.pkgs.org/tumbleweed/kde-frameworks-5-x86_64/layer-shell-qt5-5.22.4-8.2.x86_64.rpm.html
Comment 26 Cane Kostovski 2021-07-31 23:52:21 UTC
(In reply to postix from comment #25)
> Just to answer this question to Cane Kostovski from comment #24 
> If you intend the determine version of the package and to figure out if it
> contains the patch, you've searched wrong, use regex for those cases:
> ``` zypper search layer | grep -iE "(shell|qt)" ```
> 
> > i+ | layer-shell-qt5 | wlr-layer-shell integration for Qt 5
> 
> Here's the changelog by the way:
> https://opensuse.pkgs.org/tumbleweed/kde-frameworks-5-x86_64/layer-shell-qt5-
> 5.22.4-8.2.x86_64.rpm.html

thanks so much!
~> zypper search layer | grep -iE "(shell|qt)"
   | QtAV-players                       | QtAV/QML players                                                                 | package
   | gtk-layer-shell                    | Library to create desktop components for Wayland                                 | srcpackage
   | gtk-layer-shell-devel              | Development files for gtk-layer-shell                                            | package
   | layer-shell-qt                     | wlr-layer-shell integration for Qt                                               | srcpackage
i  | layer-shell-qt5                    | wlr-layer-shell integration for Qt 5                                             | package
   | layer-shell-qt5-devel              | wlr-layer-shell integration for Qt 5 - development files                         | package
   | libgtk-layer-shell0                | Library to create desktop components for Wayland                                 | package
   | typelib-1_0-GtkLayerShell-0_1      | Library to create desktop components for Wayland                                 | package
   | xt7-player-mpv                     | Qt/Gambas gui to mpv                                                             | package
   | xt7-player-mpv                     | Qt/Gambas gui to mpv                                                             | srcpackage
Comment 27 Cane Kostovski 2021-08-01 02:26:02 UTC
(In reply to postix from comment #25)
> Just to answer this question to Cane Kostovski from comment #24 
> If you intend the determine version of the package and to figure out if it
> contains the patch, you've searched wrong, use regex for those cases:
> ``` zypper search layer | grep -iE "(shell|qt)" ```
> 
> > i+ | layer-shell-qt5 | wlr-layer-shell integration for Qt 5
> 
> Here's the changelog by the way:
> https://opensuse.pkgs.org/tumbleweed/kde-frameworks-5-x86_64/layer-shell-qt5-
> 5.22.4-8.2.x86_64.rpm.html

# zypper search shell | grep  -iE "(layer|qt)"
   | gtk-layer-shell                              | Library to create desktop components for Wayland                      | srcpackage
   | gtk-layer-shell-devel                        | Development files for gtk-layer-shell                                 | package
   | layer-shell-qt                               | wlr-layer-shell integration for Qt                                    | srcpackage
i  | layer-shell-qt5                              | wlr-layer-shell integration for Qt 5                                  | package
   | layer-shell-qt5-devel                        | wlr-layer-shell integration for Qt 5 - development files              | package
   | libgtk-layer-shell0                          | Library to create desktop components for Wayland                      | package
   | libqt5-kwayland-shellplugin                  | A Qt platform integration plugin                                      | package
   | typelib-1_0-GtkLayerShell-0_1                | Library to create desktop components for Wayland                      | package
Comment 28 postix 2021-08-07 13:30:08 UTC
*** Bug 440522 has been marked as a duplicate of this bug. ***
Comment 29 Bug Janitor Service 2021-08-15 20:28:52 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kscreenlocker/-/merge_requests/46
Comment 30 David Edmundson 2021-08-16 09:34:28 UTC
Git commit e31b987ba64c74f563fc0f071eda117d99913f15 by David Edmundson.
Committed on 15/08/2021 at 20:27.
Pushed by davidedmundson into branch 'master'.

Avoid creating windows for placeholder screens.

Unfortuantely QPlatformScreen::isPlaceholder is not exposed so we need a
heuristic. On wayland all placeholder screens have a null geometry. We
also know that any real screen must have a geometry so we don't need to
watch that QScreen for changes.

M  +3    -0    greeter/greeterapp.cpp

https://invent.kde.org/plasma/kscreenlocker/commit/e31b987ba64c74f563fc0f071eda117d99913f15
Comment 31 Marc Collin 2021-08-30 14:31:51 UTC
i installed layer-shell-qt5-5.22.4-8.2.x86_64.rpm from

https://opensuse.pkgs.org/tumbleweed/kde-frameworks-5-x86_64/layer-shell-qt5-5.22.4-8.2.x86_64.rpm.html

with only one screen i still have this issue.
Comment 32 Nate Graham 2021-08-30 14:57:51 UTC
Are you using kscreenlocker from git master? Because that's where the KDE part of the fix is.
Comment 33 Marc Collin 2021-08-31 23:33:24 UTC
i only took layer-shell-qt5, if i also need kscreenlocker, i will wait, thanks
Comment 34 Cane Kostovski 2021-09-03 09:32:49 UTC
I wonder if they don't verify it for version 5.23 My electric bill will be huge?
Comment 35 David Edmundson 2021-09-03 10:27:46 UTC
If anyone does have issues with Plasma 5.23 please open a new bug with a new backtrace.
Comment 36 David Edmundson 2021-09-15 22:55:49 UTC
Git commit 4a439143baf75b9a00cf17a3b7a34ae9ac93c68a by David Edmundson.
Committed on 15/09/2021 at 22:55.
Pushed by davidedmundson into branch 'master'.

Fix a crash when creating views on the placeholder screen

When a compositor has no outputs listed Qt creates a dummy placeholder
QScreen object that does not represent a wl_output.

This should still be fixed in the clients to not create a view, it's
wasteful and probably will still have plenty of other bugs, hence the
giant warning, but it's still worth guarding.

M  +9    -1    src/qwaylandlayersurface.cpp

https://invent.kde.org/plasma/layer-shell-qt/commit/4a439143baf75b9a00cf17a3b7a34ae9ac93c68a