Bug 456723

Summary: Laptop wakes up to a completely black screen after every suspend on wayland
Product: [Plasma] kwin Reporter: Kalzi <kalzwayed>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: nate, postix, xaver.hugl
Priority: NOR    
Version: 5.24.6   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: kwin.log
kwin2.log
dmesg.log from wayland

Description Kalzi 2022-07-14 16:58:10 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***
This happens only on wayland, and it doesn't matter which KDE Plasma version I'm on.
Every time I close the lid and the let the laptop sit for a while then wake it up, I'm greeted with a black screen. No cursor, no indicator, no sign of any life beside the power button light and the keybaord backlight.
It doesn't work no matter how long I wait and I can't even get into TTY. Only way to get out of it by force shutting off laptop from power button.

STEPS TO REPRODUCE
1. Switch to wayland
2. Close the lid and wait a while
3. Open lid

OBSERVED RESULT
Complete black screen

EXPECTED RESULT
For lockscreen to show up

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Manjaro Linux
(available in About System)
KDE Plasma Version: 5.24.6
KDE Frameworks Version: 5.96.0
Qt Version: 5.15.5

ADDITIONAL INFORMATION

Kernel Version: 5.15.53-1-MANJARO (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-8550U CPU @ 1.80GHz
Memory: 15.4 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 620

Nvidia/intel hybrid graphics with nvidia diabled by optimus manager / nvidia Geforce mx130
- I do have a wifi USB module plugged into my laptop
Comment 1 Zamundaaa 2022-07-14 21:18:40 UTC
After you reproduce the bug, can you run
> journalctl --boot -1 --user-unit plasma-kwin_wayland
and upload the output here?

Note that systemd startup is still off by default in 5.24; in order to get logging to work you'll need to enable it with
> kwriteconfig5 --file startkderc --group General --key systemdBoot true
and reboot before triggering the bug.
Comment 2 Kalzi 2022-07-14 21:28:23 UTC
(In reply to Zamundaaa from comment #1)
> After you reproduce the bug, can you run
> > journalctl --boot -1 --user-unit plasma-kwin_wayland
> and upload the output here?
> 
> Note that systemd startup is still off by default in 5.24; in order to get
> logging to work you'll need to enable it with
> > kwriteconfig5 --file startkderc --group General --key systemdBoot true
> and reboot before triggering the bug.

When this happens, I'd have to force shutdown the laptop by holding down the power button. Will the journalctl command still give me the log I'm looking for given that I'd just basically rebooted?
Comment 3 Zamundaaa 2022-07-14 22:08:07 UTC
yes. The "--boot -1" means that it'll fetch the log from the last boot
Comment 4 Kalzi 2022-07-15 00:47:41 UTC
(In reply to Zamundaaa from comment #3)
> yes. The "--boot -1" means that it'll fetch the log from the last boot

Ok, so ran the second command 
> kwriteconfig5 --file startkderc --group General --key systemdBoot true
Restarted laptop - closed lid before logging in - waited a while - opened lid - blackscreen - forced shutdown - started laptop - logged into wayland session
Ran command 
>journalctl --boot -1 --user-unit plasma-kwin_wayland
and this is what I got
>Specifying boot ID or boot offset has no effect, no persistent journal was found
Comment 5 Zamundaaa 2022-07-15 01:26:48 UTC
that's quite odd. If you enable ssh, you could also ssh in with a second computer or your phone while the laptop isn't working and save the current log with
> journalctl --user-unit plasma-kwin_wayland > ~/kwin.log
then you can also try
> killall -9 kwin_wayland
and see if the laptop reacts to your inputs again.
Comment 6 Kalzi 2022-07-15 10:47:44 UTC
(In reply to Zamundaaa from comment #5)
> that's quite odd. If you enable ssh, you could also ssh in with a second
> computer or your phone while the laptop isn't working and save the current
> log with
> > journalctl --user-unit plasma-kwin_wayland > ~/kwin.log
> then you can also try
> > killall -9 kwin_wayland
> and see if the laptop reacts to your inputs again.

Of course it just chose to work because someone is actually is trying to help me 🤦🏽
It happened every single time before reporting this bug. I don't know if any of the commands you've given me did anything, but I'm not getting anything so far. I'll keep trying until I'm able to reproduce it and ssh into it from my phone.
Comment 7 Kalzi 2022-07-15 13:21:07 UTC
(In reply to Kalzi from comment #6)
> (In reply to Zamundaaa from comment #5)
> > that's quite odd. If you enable ssh, you could also ssh in with a second
> > computer or your phone while the laptop isn't working and save the current
> > log with
> > > journalctl --user-unit plasma-kwin_wayland > ~/kwin.log
> > then you can also try
> > > killall -9 kwin_wayland
> > and see if the laptop reacts to your inputs again.
> 
> Of course it just chose to work because someone is actually is trying to
> help me 🤦🏽
> It happened every single time before reporting this bug. I don't know if any
> of the commands you've given me did anything, but I'm not getting anything
> so far. I'll keep trying until I'm able to reproduce it and ssh into it from
> my phone.

Alright, so it happened again. I can't even ssh into the laptop when this happens.
Comment 8 Kalzi 2022-07-15 13:25:35 UTC
BTW, I tried to ssh after I rebooted then closed the lid without logging into the desktop. So, maybe because there is no internet connection?
I logged in then closed the lid, and I'll see if it happens again then I'll try again, because then there should be a network connection then I can ssh into it (hopefully).
Comment 9 Kalzi 2022-07-15 20:08:16 UTC
Created attachment 150654 [details]
kwin.log

Alright.
I have reproduced, but this time the screen wasn't black, it was just frozen. Keyboard and cursor don't do anything.
Got the kwin log and attached it here.
kwin killall didn't fix it, it just refreshed the screen. I rebooted my laptop through ssh from my phone
Comment 10 Zamundaaa 2022-07-18 12:34:15 UTC
hmm, that log contains nothing of relevance, probably because debug logging is disabled. Can you put
> QT_LOGGING_RULES="kwin_wayland_*.debug=true"
into /etc/environment, reboot and try again?
Comment 11 Kalzi 2022-07-19 00:23:21 UTC
(In reply to Zamundaaa from comment #10)
> hmm, that log contains nothing of relevance, probably because debug logging
> is disabled. Can you put
> > QT_LOGGING_RULES="kwin_wayland_*.debug=true"
> into /etc/environment, reboot and try again?

Alright, I just did. It has been so much better, btw. I am now suspecting that it is caused by powertop, because I always run
> sudo power --auto-tune
and that does some changes to these 
                                           
   Good          Enable SATA link power management for host1
   Good          Enable SATA link power management for host2
   Good          Enable SATA link power management for host0
   Good          Enable Audio codec power management
   Good          Bluetooth device interface status
   Good          NMI watchdog should be turned off
   Good          Autosuspend for unknown USB device 1-7 (8087:0a2a)
   Good          Autosuspend for USB device xHCI Host Controller [usb2]
   Good          Autosuspend for USB device Integrated_Webcam_HD [CN0CW54MLOG007AK0384A00]
   Good          Autosuspend for USB device xHCI Host Controller [usb1]
   Good          Runtime PM for I2C Adapter i2c-3 (i915 gmbus dpc)
   Good          Runtime PM for I2C Adapter i2c-1 (Synopsys DesignWare I2C adapter)
   Good          Runtime PM for I2C Adapter i2c-4 (i915 gmbus dpb)
   Good          Runtime PM for I2C Adapter i2c-2 (SMBus I801 adapter at f040)
   Good          Runtime PM for I2C Adapter i2c-0 (Synopsys DesignWare I2C adapter)
   Good          Runtime PM for I2C Adapter i2c-5 (i915 gmbus dpd)
   Good          Runtime PM for disk sda
   Good          Runtime PM for PCI Device Intel Corporation Sunrise Point-LP PMC
   Good          Runtime PM for PCI Device Intel Corporation Sunrise Point-LP PCI Express Root Port #1
   Good          Runtime PM for PCI Device Intel Corporation Sunrise Point-LP Serial IO I2C Controller #1
   Good          Runtime PM for PCI Device Intel Corporation Sunrise Point LPC Controller/eSPI Controller
   Good          Runtime PM for PCI Device Intel Corporation Sunrise Point-LP Integrated Sensor Hub
Comment 12 Kalzi 2022-07-19 00:39:24 UTC
Created attachment 150727 [details]
kwin2.log

There is the log after adding that command to /etc/environment
Comment 13 Zamundaaa 2022-07-19 08:59:32 UTC
You can test quite easily if powertop is at fault by not executing it. Any problems caused by it should also happen on Xorg though...
In the log you attached there is still no warnings or anything useful.

The next thing to check would thus be if this also happens with other Wayland compositors. Easiest to test is usually Weston; after installing it you can use it by choosing it in the bottom left of the login screen as an alternative to Plasma X11 / Wayland
Comment 14 Kalzi 2022-07-19 16:57:00 UTC
(In reply to Zamundaaa from comment #13)
> You can test quite easily if powertop is at fault by not executing it. Any
> problems caused by it should also happen on Xorg though...
> In the log you attached there is still no warnings or anything useful.
> 
> The next thing to check would thus be if this also happens with other
> Wayland compositors. Easiest to test is usually Weston; after installing it
> you can use it by choosing it in the bottom left of the login screen as an
> alternative to Plasma X11 / Wayland

OK, I installed Weston from the Manjaro repos, and it gave me a very basic "desktop" that has nothing but time and date on the top right and terminal icon on the top left. Nothing is clickable. Right click doesn't work. Touchpad doesn't work either. Add to that my 4k display, which made the whole display so tiny. Unless, you have a specific version of weston that has a complete different interface, I don't know
Comment 15 Zamundaaa 2022-07-23 12:13:05 UTC
The terminal icon on the top left should be clickable. Note that libinput defaults to disabling tap to click for some reason; if your touchpad has buttons or can be physically pressed down, you need to do that for anything to happen.
In the terminal you can execute "systemctl suspend" to cause it to suspend
Comment 16 Kalzi 2022-07-23 16:40:00 UTC
(In reply to Zamundaaa from comment #15)
> The terminal icon on the top left should be clickable. Note that libinput
> defaults to disabling tap to click for some reason; if your touchpad has
> buttons or can be physically pressed down, you need to do that for anything
> to happen.
> In the terminal you can execute "systemctl suspend" to cause it to suspend

My trackpad doesn't have clickable buttons, but I can still click the corners, and it works, but it never did on Weston.
Btw, I was searching around and found this on some Arch forums. Could it be related to this? https://bbs.archlinux.org/viewtopic.php?id=166964
Comment 17 Zamundaaa 2022-07-23 23:12:56 UTC
No, you'd still get a movable cursor and you'd also get a message about the lockscreen being broken.

Instead of using the terminal in weston, you could also just start it from a tty and initiate suspend like this:
> weston; sleep 10 && systemctl suspend
Comment 18 Kalzi 2022-07-23 23:45:49 UTC
(In reply to Zamundaaa from comment #17)
> No, you'd still get a movable cursor and you'd also get a message about the
> lockscreen being broken.
> 
> Instead of using the terminal in weston, you could also just start it from a
> tty and initiate suspend like this:
> > weston; sleep 10 && systemctl suspend

Ok, so I was kind of a dumbass. Lol
I was able to launch the terminal. Ran [systemctl suspend] and I'll keep testing to see if it happens on weston.
Comment 19 Kalzi 2022-07-24 00:37:00 UTC
(In reply to Kalzi from comment #18)
> (In reply to Zamundaaa from comment #17)
> > No, you'd still get a movable cursor and you'd also get a message about the
> > lockscreen being broken.
> > 
> > Instead of using the terminal in weston, you could also just start it from a
> > tty and initiate suspend like this:
> > > weston; sleep 10 && systemctl suspend
> 
> Ok, so I was kind of a dumbass. Lol
> I was able to launch the terminal. Ran [systemctl suspend] and I'll keep
> testing to see if it happens on weston.

Ok, it doesn't happen when I systemctl suspend from the desktop of weston. Rebooted from terminal while on weston, laptop rebooted to the lock screen, I didn't sign in, I closed the lid, waited a while, and opened it to a black screen. Does it have anything to do with SDDM not liking anything Wayland/weston?
Comment 20 Zamundaaa 2022-08-04 16:31:46 UTC
SDDM and the lock screen are two different things. Did you enable auto login, or change SDDM to use kwin instead of Xorg?

One more thing we can try is that you open konsole, let the command
> sudo dmesg -w > dmesg.log
run, suspend the computer and upload the dmesg.log file after waking up fails
Comment 21 Kalzi 2022-08-04 17:21:50 UTC
Created attachment 151113 [details]
dmesg.log from wayland

This is driving me crazy. Now it stopped happening on wayland and started on xorg. Here is the log. It didn't happen, but it shows some errors from PCI and other stuff that could be helpful
Comment 22 Zamundaaa 2022-08-04 19:34:02 UTC
Yes, these PCIe errors definitely seem suspicious. They seem to happen other stuff with NVidia as well: https://forums.developer.nvidia.com/t/pcie-bus-error-severity-corrected-on-jetson-nano/155780
Comment 23 Kalzi 2022-08-05 01:34:12 UTC
(In reply to Zamundaaa from comment #22)
> Yes, these PCIe errors definitely seem suspicious. They seem to happen other
> stuff with NVidia as well:
> https://forums.developer.nvidia.com/t/pcie-bus-error-severity-corrected-on-
> jetson-nano/155780

Yeah, I've found this page before. I thought I had nvidia disabled with optimus manager. I'm not sure then.
Comment 24 Nate Graham 2022-09-22 14:19:47 UTC

*** This bug has been marked as a duplicate of bug 457284 ***
Comment 25 Kalzi 2022-09-22 15:02:41 UTC
(In reply to Nate Graham from comment #24)
> 
> *** This bug has been marked as a duplicate of bug 457284 ***

Not sure if this could be considered a duplicate of that big. That one is about the wallpaper being black. This one, the laptop is almost dead, nothing on the screen and nothing is active. Not even a cursor. Ttys don't work at all. Only fix is to hard power it off. I see that crossed the other bug. So not sure if it is still considered a duplicate or not.
Comment 26 Kalzi 2022-09-22 15:03:38 UTC
That bug*
Comment 27 Nate Graham 2022-09-22 16:49:09 UTC
Yeah, my mistake, sorry.
Comment 28 postix 2023-11-20 20:11:48 UTC

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