Bug 456369 - Plasma Shell 5.25: Black screen when disconnecting external monitor with no hope of recovery
Summary: Plasma Shell 5.25: Black screen when disconnecting external monitor with no h...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Unclassified
Component: general (show other bugs)
Version: 5.25.2
Platform: Archlinux Packages Linux
: NOR major
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-05 20:55 UTC by Robert
Modified: 2022-07-12 16:26 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.25.3


Attachments
Some journalctl entries from the previous boot (that got stuck because of this issue) (12.85 KB, text/x-log)
2022-07-05 20:55 UTC, Robert
Details
journalctl log, filtered for kwin_wayland (54.83 KB, application/gzip)
2022-07-07 16:51 UTC, Robert
Details
journalctl log, filtered for plasmashell (5.11 KB, application/gzip)
2022-07-07 16:53 UTC, Robert
Details
DRM log entries while reproducing the issue (565.06 KB, application/gzip)
2022-07-12 06:50 UTC, Robert
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert 2022-07-05 20:55:36 UTC
Created attachment 150427 [details]
Some journalctl entries from the previous boot (that got stuck because of this issue)

After upgrading to Plasma Desktop 5.25, disconnecting a monitor attached through USB-C (HDMI Alt Mode) results in a black screen.
Reconnecting it does not restore video.
The only thing that helps is to force a reboot.

I cannot try a direct HDMI connection, because my laptop doesn't have one.

It happens consistently since upgrading the Plasma Desktop.
Version 5.24 worked fine.
I have tried a Gnome session to make sure nothing else is causing this issue.
In Gnome it works fine.


STEPS TO REPRODUCE
1. Start a Plasma Shell session with an external monitor connected using an USB-C dock
2. Disconnect either the monitor, or the whole dock
3. Laptop screen does not turn on
4. Reconnect the external monitor / dock
5. No image on either monitor
6. Try to switch to a virtual terminal (ctrl-alt-f3)
7. Still no picture

Black screen, no matter what I do


Laptop screen turns on when disconnecting the monitor, external screen shows desktop when plugging it back in.


SOFTWARE/OS VERSIONS
Linux version: 5.18.9
KDE Plasma Version: 5.25.0 / 5.25.1 / 5.25.2
KDE Frameworks Version: 5.95.0
Qt Version: 5.15.5+kde+r167
Mesa Version: 22.1.3

Hardware:
Dell XPS 13 9310 2 in 1
Intel Core i7 1165G7
Iris XE Graphics
Comment 1 Nate Graham 2022-07-06 17:17:22 UTC

*** This bug has been marked as a duplicate of bug 454086 ***
Comment 2 Zamundaaa 2022-07-06 20:28:31 UTC
Can you add
> QT_LOGGING_RULES="kwin_*.debug=true"
to /etc/environment, reboot, reproduce the problem and afterwards upload the output of
> journalctl --boot 0 | grep kwin_wayland
? You can make the computer react again by using ssh and remotely killing kwin_wayland when it gets stuck. If you need to reboot, you can retrieve the log by specifying boot -1 instead of 0.
Comment 3 Robert 2022-07-07 16:51:20 UTC
Created attachment 150473 [details]
journalctl log, filtered for kwin_wayland

following line was added to /etc/environment
QT_LOGGING_RULES="kwin_*.debug=true"
Comment 4 Robert 2022-07-07 16:52:42 UTC
Comment on attachment 150473 [details]
journalctl log, filtered for kwin_wayland

The following line was added to /etc/environment:
QT_LOGGING_RULES="kwin_*.debug=true"
Comment 5 Robert 2022-07-07 16:53:07 UTC
Created attachment 150474 [details]
journalctl log, filtered for plasmashell

The following line was added to /etc/environment:
QT_LOGGING_RULES="kwin_*.debug=true"
Comment 6 Robert 2022-07-07 16:54:46 UTC
Nate and  Zamundaaa,

Thanks for responding so quickly.
I have attached the log like you asked, and added one with plasmashell entries just in case.
The logs are too big to attach as they are, so I gzipped them.

Hope this helps.
Comment 7 Robert 2022-07-07 20:12:36 UTC
I discovered some more odd behaviour.
First of all, disconnecting / reconnecting the dock caused the whole system to freeze for a few seconds, or at least my ssh session.

I also tried reproducing the issue with the lid opened, and the laptop monitor enabled, scale 200%.
The external monitor was set as primary screen, scale 150%.

In this scenario, the laptop monitor took over as expected after disconnecting the dock.
Reconnecting it did not give me back my external monitor, but at least the laptop monitor kept working.

Other devices connected to the dock (mouse and keyboard) will come online most of the times when plugging it in, but not always.
In that case, disconnecting and reconnecting would fix that.

Logging out of plasma and back in with the dock plugged in results in a fully working system.
Sometimes the scale of the external monitor is wrong (set to 150%, but this is not applied).
Switching to another setting and back fixes that too.

I'll try to get some more logs for you tomorrow doing what I described above.
Is there anything else you want me to try?

Have a nice evening.
Comment 8 Zamundaaa 2022-07-11 13:30:42 UTC
Alright so the kernel rejects the new display configuration for some reason. To find out why, please execute
> echo 0x1FF | sudo tee /sys/module/drm/parameters/debug
to enable drm debug logging and then execute
> sudo dmesg -w > dmesg.log
to copy the drm log into "dmesg.log" (and keep that one running). Then cause the problem again and upload the log file afterwards.
Note that drm logging is quite verbose and the file may become quite huge, so the command should only be run as long as really needed.
Comment 9 Robert 2022-07-12 06:50:58 UTC
Created attachment 150552 [details]
DRM log entries while reproducing the issue

Commands:

echo 0x1FF | sudo tee /sys/module/drm/parameters/debug
sudo dmesg -w > dmesg.log
Comment 10 Zamundaaa 2022-07-12 09:54:51 UTC
The issue is this:
> [CRTC:167:pipe B] enabled/connectors mismatch

which is a bug that should be fixed with https://invent.kde.org/plasma/kwin/-/merge_requests/2600.
To verify that the fix works for you, you can either compile the master or 5.25 branch yourself, or wait for 5.23.3 (to be released today) to reach your distro
Comment 11 Robert 2022-07-12 11:52:56 UTC
Great news.
Archlinux usually keeps on top of these things, so I expect I can inform you of the results before the end of the week.

In the mean time, I discovered an workaround to sort of recover from this:
- Make sure the primary (laptop) display is enabled (doesn't have to be primary)
- Unplug the dock
- Switch to another virtual terminal (ctrl-alt-f4)
- Plug in the dock
- Wait for the display to reinitialize
- Switch back to the Plasma session (ctrl-alt-f2)

It seems to crash and restart when I do that, but at least I have full use of my secondary monitor again without having to log out.
The background was missing on the primary display, but running "plasmashell --replace" fixed that also.

I will let you know if version 5.23 fixes the original issue.
Comment 12 Robert 2022-07-12 11:53:26 UTC
Correction, 5.25.3
Comment 13 Robert 2022-07-12 16:24:02 UTC
I have hotplugged the monitor a few times with plasma 5.25.3, and it turned on every time.
Thank you for all your efforts.
You guys are awesome.
Comment 14 Nate Graham 2022-07-12 16:26:11 UTC
Great news!