Bug 498298 - Sleep on lid close and via global shortcut do not work anymore
Summary: Sleep on lid close and via global shortcut do not work anymore
Status: REPORTED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Power management & brightness (show other bugs)
Version: 6.2.5
Platform: Neon Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-05 23:43 UTC by Stephan Diestelhorst
Modified: 2025-01-06 22:07 UTC (History)
2 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 Stephan Diestelhorst 2025-01-05 23:43:24 UTC
SUMMARY

My hotkeys for suspending (Meta + S) and closing the lid do not suspend the laptop anymore; clicking on Sleep in the menu (Kmenu) and the power down options from Ctrl + Alt + Del both still work.  This is broken in both X11 and Wayland sessions.

STEPS TO REPRODUCE
1.  Enable a sleep hotkey and / or suspend on lid close
  * System Settings -> Keyboard -> Shortcuts -> Power Management -> Suspend (Meta + S, Sleep), and / or
  * System Settings -> Power Management -> On * power -> When laptop lid closed -> Sleep
2. press the hotkey / close the lid

OBSERVED RESULT
* nothing happens, no lock screen, simply stays in the current session, logged in

EXPECTED RESULT
* machine goes to sleep and locks the screen
* note: that works when clicking Sleep in the Kmenu bottom and in the Ctrl-Alt-Del power down screen

SOFTWARE/OS VERSIONS
Operating System: KDE neon 6.2
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.9.0
Qt Version: 6.8.1
Kernel Version: 6.8.0-51-generic (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION
Comment 1 Stephan Diestelhorst 2025-01-05 23:55:26 UTC
I have had a quick look at UPower, and at least saw the lid toggling:

$ upower --monitor-detail
Monitoring activity from the power daemon. Press Ctrl+C to cancel.
[23:53:54.853]  daemon changed:
  daemon-version:  1.90.3
  on-battery:      no
  lid-is-closed:   yes
  lid-is-present:  yes
  critical-action: HybridSleep

[23:53:57.904]  daemon changed:
  daemon-version:  1.90.3
  on-battery:      no
  lid-is-closed:   no
  lid-is-present:  yes
  critical-action: HybridSleep

[23:54:13.369]  daemon changed:
  daemon-version:  1.90.3
  on-battery:      no
  lid-is-closed:   yes
  lid-is-present:  yes
  critical-action: HybridSleep
Comment 2 Stephan Diestelhorst 2025-01-05 23:59:38 UTC
The only (somewhat?) relevant info from journalctl (please note my locale is not C, but instead en_GB.UTF-8

Jan 05 23:53:54 d-allen systemd-logind[1370]: Lid closed.
Jan 05 23:53:54 d-allen wpa_supplicant[1592]: wlp3s0: CTRL-EVENT-SIGNAL-CHANGE above=0 signal=-73 noise=9999 txrate=162000
Jan 05 23:53:54 d-allen dbus-daemon[1309]: [system] Activating service name='org.kde.powerdevil.backlighthelper' requested by ':1.414'>
Jan 05 23:53:54 d-allen org.kde.powerdevil.backlighthelper[32352]: Detected locale "C" with character encoding "ANSI_X3.4-1968", which>
                                                                   Qt depends on a UTF-8 locale, and has switched to "C.UTF-8" instead.
                                                                   If this causes problems, reconfigure your locale. See the locale(1)>
                                                                   for more information.
Jan 05 23:53:54 d-allen dbus-daemon[1309]: [system] Successfully activated service 'org.kde.powerdevil.backlighthelper'
Jan 05 23:53:57 d-allen systemd-logind[1370]: Lid opened.
Jan 05 23:53:59 d-allen wpa_supplicant[1592]: wlp3s0: CTRL-EVENT-SIGNAL-CHANGE above=1 signal=-59 noise=9999 txrate=121500
Jan 05 23:54:13 d-allen systemd-logind[1370]: Lid closed.
Jan 05 23:54:13 d-allen dbus-daemon[1309]: [system] Activating service name='org.kde.powerdevil.backlighthelper' requested by ':1.414'>
Jan 05 23:54:13 d-allen org.kde.powerdevil.backlighthelper[32397]: Detected locale "C" with character encoding "ANSI_X3.4-1968", which>
                                                                   Qt depends on a UTF-8 locale, and has switched to "C.UTF-8" instead.
                                                                   If this causes problems, reconfigure your locale. See the locale(1)>
                                                                   for more information.
Jan 05 23:54:13 d-allen dbus-daemon[1309]: [system] Successfully activated service 'org.kde.powerdevil.backlighthelper'
Comment 3 Nate Graham 2025-01-06 19:06:42 UTC
Do you by any chance recall when this stopped working? Was there a Plasma update, a kernel update, a upower update, or something else?
Comment 4 Stephan Diestelhorst 2025-01-06 21:16:48 UTC
Sorry, I should have mentioned this.  This used to work.  Unfortunately, I have used this laptop in a 24/7 on configuration in the last months, so it is a little hard to be precise when this stopped working.  It was certainly working last summer, which is an annoyingly large window of updates.  I am on KDE Neon User Edition 24.04.

I am happy to poke a bit, but I am struggling to know where to start.  If anyone knows the different code paths / general ways we get to suspend, and why this works from Sleep in KMenu, but not from the hotkeys and also not from the lock screen, that would be good to know.  Otherwise, I can start digging and maybe enable the right log options / add some printfs in places and recompile the right things.
Comment 5 Stephan Diestelhorst 2025-01-06 22:07:40 UTC
I have been reading the powerdevil source code a bit.  It seems there are two ways to get to suspend:

* runner actions -> these seem to be talking to logind directly, and I think they are the ones invoked by KMenu and Krunner -> these seem to work
* daemon actions -> these eventually seem to be turned into DBus commands to org.freedesktop.PowerManagement -> these don't work

Manually trying
  $ qdbus org.freedesktop.PowerManagement /org/freedesktop/PowerManagement Suspend
does nothing.

Some more information:
  $  qdbus org.freedesktop.PowerManagement /org/freedesktop/PowerManagement CanSuspend
  true
  $ qdbus org.freedesktop.PowerManagement /org/freedesktop/PowerManagement/Inhibit HasInhibit
  false

This seems to suggest that whatever hangs on the other side of that DBus port is not doing the right thing.  I will keep digging as time permits, hope me logging stuff here is okay.