Strange powerdevil(?) behaviour

I have some strange behaviour with my laptop regarding idle handling. I am using kubuntu 23.04 with latest backports which is plasma 5.27.7 at this time. I am also using wayland if that matters. I haven’t made a bug report because I am not sure what to report.

The expected behaviour is

  1. The laptop goes to sleep
  2. The nightly backup timer wakes up the system and does the backup
  3. Since the machine is idle, it goes back to sleep

Now, 1. and 2. work just fine, but what happens with 3. depends on how 1. happened.

If the original sleep was caused by the idle timer or by using the sleep button in application menu, 3. does not work, the system is fully awake and the display stays on, until some user action is performed–by pressing shift of moving the pointer for example.

Step 3. works fine if 1. was done by closing the lid, pressing the sleep button on the keyboard or using “systemctl suspend” command.

First I thought the problem case was because of kde putting the system to sleep, but the lid and the sleep button also come from the kde side of things.

Any ideas or should I make a bug report? I am pretty sure this has appeared somewhat recently, less than a year, but I also switched to wayland during this time period, so there are many variables to consider.

Edit: I also have a desktop running vanilla Ubuntu 23.04 with wayland, and it works as expected.

Ignore my (this) post, most likely just nonse

From the Arch Wiki:

Some desktop environments include power managers which inhibit (temporarily turn off) some or all of the systemd ACPI settings. If such a power manager is running, then the actions for ACPI events can be configured in the power manager alone. Changes to /etc/systemd/logind.conf or /etc/systemd/logind.conf.d/*.conf need be made only if you wish to configure behaviour for a particular event that is not inhibited by the power manager.

Note that if the power manager does not inhibit systemd for the appropriate events you can end up with a situation where systemd suspends your system and then when the system is woken up the other power manager suspends it again. The power managers of KDE, GNOME, Xfce and MATE issue the necessary inhibited commands. If the inhibited commands are not being issued, such as when using acpid or others to handle ACPI events, set the Handle options to ignore. See also systemd-inhibit(1).

Here is what I think happens:

  1. If you use systemctl or use your Button/Lid the first sleep done by system.d after the wakeup powerdevil causes the next sleep.

  2. If the sleep is caused by idle time the first sleep is done by Powerdevil. Then Powerdevil inhibits sleep until some user action.

This is maybe done intentional and therefore maybe no bug.

But… I tested the lid action in power management and the sleep button in global shortcuts and they do follow however they are configured. That makes me think it is the powerdevil that does the actual action.

I don’t see any rationale why this might be intentional.

Btw, the backup is run with systemd-inhibit but it takes typically only two minutes, whereas the idle timeout is one hour.

I can reproduce your issue.

On second thought me neither.

€: Can only reproduce on Wayland. Xorg seems to work correctly