Bug 450542

Summary: Black screen after unplugging external monitors when laptop screen is disabled
Product: [Plasma] kwin Reporter: Simon B <sbutcher+bugs>
Component: multi-screenAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: aleixpol, bhush94, kde, nate, notmart, vlad.zahorodnii, xaver.hugl
Priority: NOR    
Version: 5.26.2   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=437471
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Simon B 2022-02-18 22:04:53 UTC
SUMMARY

Removing the external displays (via thunderbolt dock) while the screenlocker is active results in a black screen on the laptop

STEPS TO REPRODUCE
1. Attach laptop to dock and use external monitors ONLY (laptop screen disabled)
2. Lock screen (e.g. with super key+L)
3. Detach usb c dock cable

OBSERVED RESULT
Screen is black except for mouse cursor, cannot access desktop or screenlocker

EXPECTED RESULT
Expect to see the screenlocker password prompt with wallpaper background

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:
(available in About System)
KDE Plasma Version: 5.24.1
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.2
Graphics platform: X11 ,  Intel TigerLake-LP GT2 [Iris Xe Graphics]
Distro: kubuntu 21.10 with backports PPA

ADDITIONAL INFORMATION
Other bugs seem to relate to compositing, and are fixable by switching ctrl-alt-f2 and back again to ctrl-alt-f1. However, this is not the same bug.

My current workaround is : hit ctrl-alt-f2 and type "ps -ef | grep kscreenlocker_greet" then kill the PID of the process.
Hit ctrl-alt-f1 and the screenlocker password prompt appears as expected.
I can reproduce this at will.
Comment 1 Simon B 2022-04-20 18:24:50 UTC
Having disabled the option to lock the screen on sleep, i realised this is not a kscreenlocker_greet issue.
Workflow:
1) laptop with 2 monitors attached via usb c to Dell dock (e.g. WD19 but also another Dell monitor with integrated usb c dock)
2) laptop display disabled, monitor display enabled.
3) set computer to sleep
4) remove usb C cable
5) wake laptop from sleep
6) black screen (although ctrl-alt-f2 shows a vty)
if i now plug the usb c cable back in, the display returns to the monitors, and i can then remove the usb c dock cable and regain visible screen on the laptop display.

so in summary, plasma doesn't recognise the display settings have changed when resuming from sleep, unless i plug the dock back in again and remove it. this is repeatable every time (and obviously an issue if you grab your laptop to go to a meeting or a train journey when it is sleeping attached to the dock)
Comment 2 Simon B 2022-05-09 19:10:09 UTC
Another observation. This only seems to occur with 2 external monitors. 
With one external monitor and the laptop screen off, removing the usb C cable to the dock while the laptop is sleeping, results in a working lock-screen on resume.
With 2 external monitors and the laptop screen off, the problem occurs. The only way to recover is ctrl-alt-f2 and kill kscreenlocker_greet process, then returning to ctrl-alt-f1 shows the lock screen as usual.
Comment 3 Simon B 2022-10-31 10:14:04 UTC
This bug persists in plasma 5.26.2

1) 2 external monitors via thunderbolt dock, laptop display off.
2) Set laptop to Sleep
3) unplug the cable to the dock
4) open the laptop lid to wake the laptop, and the screenlocker doesn't revert to using the laptop screen when the external monitors are removed while asleep.
Comment 4 Simon B 2022-10-31 10:23:45 UTC
Perhaps related, I find this in the dmesg output upon wake-up.

[Mon Oct 31 10:09:25 2022] i915 0000:00:02.0: [drm] *ERROR* [ENCODER:338:DDI TC3/PHY TC3][DPRX] Failed to enable link training
[Mon Oct 31 10:09:26 2022] i915 0000:00:02.0: [drm] *ERROR* failed to allocate vcpi
Comment 5 Simon B 2022-12-26 13:54:42 UTC
Pretty sure this is describing the same behaviour as 437471

*** This bug has been marked as a duplicate of bug 437471 ***