Bug 498593 - Laptop goes into (broken) standby, if lid is closed during shut down
Summary: Laptop goes into (broken) standby, if lid is closed during shut down
Status: REPORTED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Session Management (show other bugs)
Version: 6.2.5
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-13 10:36 UTC by postix
Modified: 2025-03-26 17:27 UTC (History)
7 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description postix 2025-01-13 10:36:23 UTC
STEPS TO REPRODUCE
1.  Initiate a shut down of your laptop: Ctrl Alt Del -> Power off
2.  Close the lid right after - at least before the system has fully powered off

OBSERVED RESULT
The laptop actually goes into standby, ignoring the intention to shut down. This is indicated in my case by the red blinking dot of my thinkpad on its backcover.

If I open the lid there are two possible states: it shows the lockscreen or a black screen with random white or green dots, which is a broken state.

This is problematic, because, when it stays in standby w/o me knowing, I may find it with an empty battery next time.

EXPECTED RESULT
Plasma disables "standby on lid closed" for the period, when a shut down process is happening.

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 41
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.10.0
Qt Version: 6.8.1
Kernel Version: 6.12.9-200.fc41.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 PRO 5850U with Radeon Graphics
Graphics Processor: AMD Radeon Graphics
System Version: ThinkPad X13 Gen 2a
Comment 1 cqtestfailed 2025-01-15 20:02:35 UTC
Can verify this behavior across several devices (Framework 13, Framework 16 (w/ 7700S), ThinkPad T480, etc) running from Fedora 38 to 41, in late versions of Plasma 5, and all new versions of Plasma 6.
Setting "when laptop lid is closed" options to "Sleep" and "Lock Screen" both seem to disrupt the shutdown process, requiring me to forcefully power off the device upon opening the lid again before being able to interact with the system in any way.
Comment 2 Vinícius 2025-03-06 13:33:11 UTC
you can workaround this issue putting 
'[Login]
HandleLidSwitch=ignore'
on /etc/systemd/logind.conf, so i'm guessing, would this be fixed if kde by taking the handle-lid-switch inhibitor? as said in the logind.conf manpage 
"A different application may disable logind's handling of system power and sleep keys and the lid switch by taking a low-level inhibitor lock ("handle-power-key", "handle-suspend-key", "handle-hibernate-key", "handle-lid-switch", "handle-reboot-key"). This is most commonly used by graphical desktop environments to take over suspend and hibernation handling, and to use their own configuration mechanisms. If a low-level inhibitor lock is taken, logind will not take any action when that key or switch is triggered and the Handle*= settings are irrelevant."
Comment 3 Nate Graham 2025-03-06 22:01:07 UTC
I can reproduce this on a ThinkPad, but not on a different laptop, an HP Pavilion Plus 14.

That suggests that the behavior here is controlled by the device drivers, and not anything we can affect in Plasma code. I'd recommend reporting the issue upstream.
Comment 4 Vinícius 2025-03-06 22:33:19 UTC
(In reply to Nate Graham from comment #3)
> I can reproduce this on a ThinkPad, but not on a different laptop, an HP
> Pavilion Plus 14.
> 
> That suggests that the behavior here is controlled by the device drivers,
> and not anything we can affect in Plasma code. I'd recommend reporting the
> issue upstream.

upstream in this case is the laptop drivers or logind(considering that it can be "fixed" by disabling logind)?
Comment 5 Nate Graham 2025-03-06 22:40:36 UTC
Could be either, I'm not sure.
Comment 6 fanzhuyifan 2025-03-06 22:41:09 UTC
(In reply to Nate Graham from comment #3)
> I can reproduce this on a ThinkPad, but not on a different laptop, an HP
> Pavilion Plus 14.
> 
> That suggests that the behavior here is controlled by the device drivers,
> and not anything we can affect in Plasma code. I'd recommend reporting the
> issue upstream.

Humm looking at the plasma code [0], between the logout and shutdown request [1], and the call to logind shutdown [2] [3], there is quite a lot of plasma code going on, and I don't see anything particular that is blocking sleep (maybe I am missing something obvious)

[0] https://invent.kde.org/plasma/plasma-workspace/-/blob/master/startkde/plasma-shutdown/shutdown.cpp?ref_type=heads
[1] https://invent.kde.org/plasma/plasma-workspace/-/blob/6ce316502af5110c18a6aa7dec6a03f4ca108808/startkde/plasma-shutdown/shutdown.cpp#L30
[2] https://invent.kde.org/plasma/plasma-workspace/-/blob/6ce316502af5110c18a6aa7dec6a03f4ca108808/startkde/plasma-shutdown/shutdown.cpp#L171
[3] https://invent.kde.org/plasma/plasma-workspace/-/blob/6ce316502af5110c18a6aa7dec6a03f4ca108808/libkworkspace/sessionmanagementbackend.cpp#L174
Comment 7 postix 2025-03-07 11:39:35 UTC
Thanks  Yifan Zhu! 

Nate, could we maybe reopen this until it's clarified that it's definitely not a Plasma bug and not a lucky coincidence with the HP laptop,
so that this bug gets more attention?

Who of us affected is going to report it upstream and links the report here? :)

Thanks!
Comment 8 Nate Graham 2025-03-07 16:19:51 UTC
Sure.
Comment 9 Vinícius 2025-03-20 23:50:45 UTC
(In reply to postix from comment #7)
> Thanks  Yifan Zhu! 
> 
> Nate, could we maybe reopen this until it's clarified that it's definitely
> not a Plasma bug and not a lucky coincidence with the HP laptop,
> so that this bug gets more attention?
> 
> Who of us affected is going to report it upstream and links the report here?
> :)
> 
> Thanks!

Tried first to report on logind https://github.com/systemd/systemd/issues/36759 let see if the devs helps to determine if it's a driver issue :)