Bug 438716 - Lid close leads to suspend even when external monitor is attached
Summary: Lid close leads to suspend even when external monitor is attached
Status: RESOLVED FIXED
Alias: None
Product: Powerdevil
Classification: Plasma
Component: general (show other bugs)
Version: 5.23.5
Platform: unspecified Linux
: HI normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: regression
: 361022 442954 446411 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-06-16 07:55 UTC by Alois Wohlschlager
Modified: 2022-03-02 08:56 UTC (History)
16 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.24
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alois Wohlschlager 2021-06-16 07:55:36 UTC
SUMMARY

Since the upgrade to 5.22, when I have an external monitor attached and close the laptop lid, the machine suspends despite the setting "even when an external screen is connected" being unchecked. I have not observed this behavior with 5.21.

STEPS TO REPRODUCE
1. Connect external monitor to laptop
2. Close lid

OBSERVED RESULT

Machine suspends immediately

EXPECTED RESULT

Machine keeps running

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

ADDITIONAL INFORMATION
Comment 1 Matej Mrenica 2021-07-27 06:21:41 UTC
Same issue here on Arch Linux. Setting "even when an external screen is connected" is always on regardless of the setting. This gets more annoying if you start your laptop with the lid closed resulting in it going to sleep immediately after logging in. Not to mention if your laptop has an issue where it cannot wake up from sleep (like mine does sometimes - amdgpu issue) this makes wayland session unusable. The only solution is to set "laptop lid close action" to something else.
Comment 2 Alois Wohlschlager 2021-07-27 15:38:40 UTC
> This gets more annoying if you start your laptop with the lid closed resulting in it going to sleep immediately after logging in.

I cannot reproduce this behavior. In fact, logging in with the lid closed is how I work around this bug.
Comment 3 Danny Medina 2021-08-16 16:05:00 UTC
I can confirm that this happens to me. i close the laptop lid while an external monitor i plugged in and i immediately get put on Lockscreen, then the laptop suspends. It only happens on the Wayland session, here are my specs:

Operating System: openSUSE Tumbleweed 20210810
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.2
Kernel Version: 5.13.8-1-default (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i5-8350U CPU @ 1.70GHz
Memory: 15.4 GiB of RAM
Graphics Processor: Mesa DRI Intel® UHD Graphics 620
Comment 4 Patrick Kopper 2021-08-26 20:40:00 UTC
Since the upgrade to 5.22.4, I notice the same behavior on my Arch Linux system. X11 keeps working fine but the setting "even when an external screen is connected" seems to have no effect on Wayland.

Operating System: Arch Linux
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2
Kernel Version: 5.13.12-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 4800H with Radeon Graphics
Memory: 15.0 GiB of RAM
Graphics Processor: AMD RENOIR
Comment 5 Nate Graham 2021-09-27 21:56:03 UTC
*** Bug 442954 has been marked as a duplicate of this bug. ***
Comment 6 Sebastian 2021-11-01 12:26:46 UTC
I can confirm this bug. In my case however, the laptop only suspends if the display is connected via HDMI. The laptop doesn't suspend when connected to the same display via an USB-C-Dock (and thus via eDP).
I tried to downgrade Powerdevil to v5.21.0 which didn't fix the problem for me, so the relevant change might have happened somewhere else (KWin maybe?).

Can others that are affected specify how the external display is connected (HDMI/DisplayPort) and test if the bug still occurs when DisplayPort is used?
Comment 7 Matej Mrenica 2021-11-01 12:28:45 UTC
(In reply to Sebastian from comment #6)
> I can confirm this bug. In my case however, the laptop only suspends if the
> display is connected via HDMI. The laptop doesn't suspend when connected to
> the same display via an USB-C-Dock (and thus via eDP).
> I tried to downgrade Powerdevil to v5.21.0 which didn't fix the problem for
> me, so the relevant change might have happened somewhere else (KWin maybe?).
> 
> Can others that are affected specify how the external display is connected
> (HDMI/DisplayPort) and test if the bug still occurs when DisplayPort is used?

I am connected with HDMI and I only have an HDMI.
Comment 8 Kai Uwe Broulik 2021-11-19 12:32:13 UTC
This is Wayland-only, correct?
Does it show "your computer is configured not to suspend while an external monitor is plugged in" in Battery Monitor?
Comment 9 Matej Mrenica 2021-11-19 12:41:02 UTC
(In reply to Kai Uwe Broulik from comment #8)
> This is Wayland-only, correct?
> Does it show "your computer is configured not to suspend while an external
> monitor is plugged in" in Battery Monitor?

Yes, wayland only and no it doesn't. This also happens if the close lid action is "lock screen", which is not related to suspending.
Comment 10 Sebastian 2021-11-19 12:53:02 UTC
(In reply to Kai Uwe Broulik from comment #8)
> This is Wayland-only, correct?
> Does it show "your computer is configured not to suspend while an external
> monitor is plugged in" in Battery Monitor?

If it's connected via eDP, the message shows up as expected. If the display is connected via HDMI, the message isn't shown.
Enabling the checkbox "Inhibit automatc sleep and screen locking" manually doesn't have an effect in this case either - the laptop will go to sleep or lock the screen, even if it's checked.
This happens on Wayland only.
Comment 11 Alois Wohlschlager 2021-11-19 12:57:33 UTC
> This is Wayland-only, correct?
I cannot reproduce the bug any more, but it definitely did happen on Wayland. I don't remember checking whether it worked on X11.

> Does it show "your computer is configured not to suspend while an external monitor is plugged in" in Battery Monitor?
Yes, it did.
Comment 12 KDE supporter7 2021-12-01 18:00:00 UTC
Same issue on Fedora 35 (Kinoite),
this only happens on Wayland, Battery Monitor does not show "your computer is configured not to suspend while an external monitor is plugged in".

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.23.3
KDE Frameworks Version: 5.88.0
Qt Version: 5.15.2
Comment 13 Kai Uwe Broulik 2021-12-03 10:59:36 UTC
*** Bug 446411 has been marked as a duplicate of this bug. ***
Comment 14 ita84aa 2021-12-03 13:08:50 UTC
I don't know if this will help, but I've had this particular issue only recently (currently KDE Plasma 5.23.4): a few updates ago (can't tell for sure which one, probably 5.23.2 or 3) the only thing that didn't work was that when I selected Shutdown from a Wayland session while the lid was closed, it'd go to Sleep instead; now it goes to sleep anytime the lid is closed, even when I start the Wayland session with the lid already closed
Comment 15 Anubhav Kini 2022-01-22 12:17:42 UTC
I'm also facing the same issue.

Operating System: NixOS 22.05
KDE Plasma Version: 5.23.5
KDE Frameworks Version: 5.89.0
Qt Version: 5.15.3
Kernel Version: 5.16.1 (64-bit)
Graphics Platform: Wayland
Comment 16 Nils 2022-01-24 18:24:21 UTC
Same issue here Thinkpad t460s on Fedora 35 connected via dock and HDMI the setting "Even when external monitor is connected " is disabled

Operating System: Fedora 35
KDE Plasma Version: 5.23.90
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2
Kernel Version: 5.15.16 (64-bit)
Graphics Platform: Wayland
Comment 17 Nils 2022-01-24 18:39:23 UTC
*** Bug 361022 has been marked as a duplicate of this bug. ***
Comment 18 Fabio 2022-01-28 09:39:47 UTC
I'm experiencing the same issue on 5.23.5.
The cause of the issue is that the external monitor is reported of an "unknown" type, and so it's not considered as an external monitor.
Basically reverting this fixes the issue:
https://invent.kde.org/plasma/powerdevil/-/commit/d3162725cfffb79da7bb8f276a31a915e3349dab
Of course reverting this will break suspend for the original post of the bug.
A better fix would be to correctly detect the monitor type, but how?
Maybe a possible workaround would be to check if:
 * there's only one "unkown" monitor connected => that's possibly the laptop panel => then suspend
 * there's more than one monitor connected, and one of them is type "unkown" => that's possibly an external monitor => don't suspend
Comment 19 Kai Uwe Broulik 2022-01-28 09:55:16 UTC
Can you provide the output of kscreendoctor -o and xrandr -q

Maybe there's some exotic connector type that we don't know. The heuristic for identifying monitor types is in https://invent.kde.org/plasma/libkscreen/-/blob/master/backends/utils.cpp
Comment 20 Bug Janitor Service 2022-01-28 10:11:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/powerdevil/-/merge_requests/76
Comment 21 Fabio 2022-01-28 10:13:42 UTC
(In reply to Kai Uwe Broulik from comment #19)
> Can you provide the output of kscreendoctor -o and xrandr -q
> 
> Maybe there's some exotic connector type that we don't know. The heuristic
> for identifying monitor types is in
> https://invent.kde.org/plasma/libkscreen/-/blob/master/backends/utils.cpp

kscreen-dotctor -o
---
Output: 1 AU Optronics eDP-1-sconosciuto enabled connected  Panel Modes: 0:1920x1080@40 1:1680x1050@60 2:1280x1024@60 3:1440x900@60 4:1280x800@60 5:1280x720@60 6:1024x768@60 7:800x600@60 8:640x480@60 9:1920x1080@60*! Geometry: 0,0 1920x1080 Scale: 1 Rotation: 1 Overscan: 0 Vrr: incapable RgbRange: unknown 
Output: 2 BNQ BenQ GW2780/ETP9L04484SL enabled connected primary Unknown Modes: 0:1920x1080@60 1:1920x1080@60 10:1280x720@60 11:1280x720@60 12:1280x720@60 13:1280x720@50 14:1024x768@75 15:1024x768@60 16:832x624@75 17:800x600@75 18:800x600@60 19:720x576@50 2:1920x1080@50 20:720x576@50 21:720x480@60 22:720x480@60 23:720x480@60 24:720x480@60 25:720x480@60 26:640x480@75 27:640x480@60 28:640x480@60 29:640x480@60 3:1680x1050@60 30:720x400@70 31:1920x1080@60*! 4:1600x900@60 5:1280x1024@75 6:1280x1024@60 7:1440x900@60 8:1280x800@60 9:1152x864@75 Geometry: 0,0 1920x1080 Scale: 1 Rotation: 1 Overscan: 0 Vrr: incapable RgbRange: unknown primary
---

xrandr -q
---
Screen 0: minimum 16 x 16, current 1920 x 1080, maximum 32767 x 32767
XWAYLAND1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 600mm x 340mm
   1920x1080     59.96*+
...
XWAYLAND2 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 290mm x 170mm
   1920x1080     59.96*+
...
---
Comment 22 ita84aa 2022-02-09 10:35:37 UTC
Just updated to Plasma 5.24 and the issue has been fixed for me: now closing the laptop lid in a Wayland session doesn't trigger suspend anymore, and selecting Shutdown shuts the laptop down correctly instead of suspending it. Thanks!
Comment 23 Matej Mrenica 2022-02-09 10:38:21 UTC
(In reply to ita84 from comment #22)
> Just updated to Plasma 5.24 and the issue has been fixed for me: now closing
> the laptop lid in a Wayland session doesn't trigger suspend anymore, and
> selecting Shutdown shuts the laptop down correctly instead of suspending it.
> Thanks!

Same here.
Comment 24 Nate Graham 2022-02-10 17:00:17 UTC
Oh good!
Comment 25 flan_suse 2022-03-02 02:22:30 UTC
(In reply to ita84 from comment #22)
> Just updated to Plasma 5.24 and the issue has been fixed for me: now closing
> the laptop lid in a Wayland session doesn't trigger suspend anymore, and
> selecting Shutdown shuts the laptop down correctly instead of suspending it.
> Thanks!

(In reply to Matej Mrenica from comment #23)
> Same here.

(In reply to Nate Graham from comment #24)
> Oh good!


Is there any chance that 5.24 "fixing" this issue caused a new issue?

Here's why I mention that: https://bugs.kde.org/show_bug.cgi?id=450980
Comment 26 ita84aa 2022-03-02 08:56:45 UTC
^ Not for me, at least. I've just checked, and suspend to RAM seems to work as expected for my laptop (CPU stays cool even after a few minutes), both on X11 and Wayland, but I have an AMD CPU and GPU (and I'm on Arch, not Manjaro)