Bug 486422 - Suspend inhibits also end up keeping the display on
Summary: Suspend inhibits also end up keeping the display on
Status: RESOLVED WORKSFORME
Alias: None
Product: Powerdevil
Classification: Plasma
Component: general (other bugs)
Version First Reported In: 5.27.80
Platform: Kubuntu Linux
: NOR minor
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-01 23:54 UTC by Michael Terry
Modified: 2024-07-30 11:17 UTC (History)
5 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 Michael Terry 2024-05-01 23:54:11 UTC
SUMMARY
When an app inhibits suspend via a freedesktop.org dbus call, it seems to also wake & keep the display on. This causes annoyance when this happens overnight.

A user of my backup app reported this issue [1], and I'm reporting it on here with some extra investigation.

Here's the backup use case for "suspend only" inhibits (while wanting to allow display to stay off / the session to go idle):
- This app can resume backups. So if the user wants to log out or power off, that's fine.
- If the user wants to walk away from the machine or otherwise go idle, that's also fine.
- But the app wants to be able to finish its work without being suspended through power policy.

I've noticed by watching dbus, that the fd.o inhibit request gets sent to Powerdevil as an InterruptSession inhibit. But past that, I am not sure how this ends up resulting in the display staying on.

[1] https://gitlab.gnome.org/World/deja-dup/-/issues/462

STEPS TO REPRODUCE
1. Inhibit suspend via dbus (or if using this backup app, run "deja-dup --backup --auto" after configuring a backup) 
2. See if display is allowed to turn off

(I've not tested this myself, I don't have a KDE system handy and VMs don't seem to reproduce display-power-logic.)

OBSERVED RESULT
The display wakes up and stays on.

EXPECTED RESULT
The display to stay off and be allowed to go idle.

SOFTWARE/OS VERSIONS
Operating System: Kubuntu 23.10
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.10
Kernel Version: 6.5.0-27-generic (64-bit)
Graphics Platform: X11
Processors: 16 × 12th Gen Intel® Core™ i5-12500H
Memory: 15.2 GiB of RAM
Graphics Processor: Mesa Intel® Graphics
Manufacturer: ASUSTeK COMPUTER INC.
Product Name: VivoBook_ASUSLaptop K3502ZA_K3502ZA
System Version: 1.0
Comment 1 Bug Janitor Service 2024-07-29 15:45:27 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/merge_requests/305
Comment 2 Jakob Petsovits 2024-07-30 11:17:42 UTC
I was a little too excited about also marking this bug as fixed as a result of the above MR, but it doesn't fix this.

The good news is that an InterruptSession inhibit works as intended at least on Plasma 6.1.3:

* To test, I create an equivalent inhibitor which will be picked up by PowerDevil as InterruptSession:
  * systemd-inhibit --what=sleep --who=test --why=bug486422 sleep 3600
  * Direct D-Bus calls to `org.freedesktop.portal.Inhibit` (with "Sleep" flag) or PowerDevil's own D-Bus API would behave the same.
* In the Screen Locking configuration, I set a 1 minute timeout and in Power Management, turn off screen after 20 seconds when locked.
* As an alternative test, I set Screen Locking to Never and in Power Management, turn off screen after 1 minute.
* The screen turns off either way after the defined timeout while the system does not suspend. (In the first test, it will lock before turning off.)

So I can't tell what went wrong for your user in particular, but I was able to confirm that Plasma's current implementation works as expected in this case.