Standby then hibernate doesn't work

Sleep is working, hibernate is working, but selecting “Standby, then hibernate” in power saving settings doesn’t work, it actually performs a normal sleep, and what is that unknown period it needs to jump from normal sleep to hibernate?

Operating System: Manjaro Linux 
KDE Plasma Version: 6.0.5
KDE Frameworks Version: 6.2.0
Qt Version: 6.7.1
Kernel Version: 6.9.1-2-MANJARO (64-bit)
Graphics Platform: Wayland
1 Like

The unknown period is only configurable through systemd config files, the HibernateDelaySec entry in /etc/systemd/sleep.conf can modify the default which depends on your system’s capabilities and is described in man systemd-sleep.conf (see the “suspend-then-hibernate” section).

1 Like

HibernateDelaySec is effectively empty in /etc/systemd/sleep.conf,

[Sleep]
#AllowSuspend=yes
#AllowHibernation=yes
#AllowSuspendThenHibernate=yes
#AllowHybridSleep=yes
#SuspendState=mem standby freeze
#HibernateMode=platform shutdown
#HibernateDelaySec=
#SuspendEstimationSec=60min

With a laptop left connected to power, it seems it will always fail to hibernate after sleeping

If the system has battery and HibernateDelaySec= is not set, low-battery alarms (ACPI _BTP) are tried first for detecting battery percentage and wake up the system for hibernation. If not available, or HibernateDelaySec= is set, the system would regularly wake up to check the time and detect the battery percentage/discharging rate. The rate is used to schedule the next detection. If that is also not available, SuspendEstimationSec= is used as last resort.

After setting HibernateDelaySec to a value, now it works fine as it should.

you must uncomment that line with the parameter in order for the value to be read, yes?

[Sleep]
#AllowSuspend=yes
#AllowHibernation=yes
#AllowSuspendThenHibernate=yes
#AllowHybridSleep=yes
#SuspendState=mem standby freeze
#HibernateMode=platform shutdown
#HibernateDelaySec=
SuspendEstimationSec=60min

I simply created a new file
/etc/systemd/sleep.conf.d/sleep-then-hibernate.conf

with the following content:

[Sleep]
HibernateDelaySec=3600
2 Likes

Thank you, I always wondered when that’d happen or if it was broken. So I was never using it after testing.
Seems to be set to

HibernateDelaySec=4

by default …?
So that mean it did not work here.

Hibernate needs some prior preparation depending on your distro, does hibernate alone works for you?

Perfectly.
:grinning:

4 seconds might not be enough time
try 4min instead.

1 Like

i like that better (recommended approach).

does the initramfs need to be rebuilt for these changes take effect, or do you just reboot?

Maybe these defaults need to be adjusted. Or maybe distros set them individually.

I simply restarted my laptop and it worked.

Hello there, I’ve got the Same Setup (Manjaro and the adjusted sleep.conf to switch to hibernate after 90 minutes) and most of the time it works fine. My Laptop goes into Standby and after the 90 minutes, it switches.

But sometimes, it doesnt work and it’s still in Standby, although it’s definetly been more than the 90 minutes.

I meed to do some more Testing to find out what causes this, but maybe you got some tips on how to find the root of the problem… I’m definetly No pro in Linux on that.
I could bei wrong on this, but maybe the Firefox Browser may be a problem?
Last night i left open the Browser and this morning, the Laptop was still in Standby.

Firefox has some weird behavior:

  • If the currently selected tab is playing some videos or playlist then it will block automatic sleep and lock.

  • If you select another tab different from the one playing video, then blocking automatic sleep and lock will be disabled.

  • Even if the current selected tab plays some video and you click on minimize button then blocking sleep and lock will be disabled.

  • Playing audio will never block automatic sleep and lock even if the tab playing it is the one currently selected and viewed at top of all apps.

Did some more testing today and in KJournald i found a hint at the real cause for this behaviour.

When i start the application menu and select the standby there, i can see that the laptop only enters suspend mode (Kjournald says: The system will suspend now!
But when i press the power button of my laptop, which i configured to be the same “standby”, KJournald says: The system will suspend and later hibernate now!

Dunno why the button seems to trigger this but the suspend/standby-icon in application menu doesnt… Maybe someone got an idea.

For the real test, im gonna press the power button this time to see, if it really goes into hibernation after some time.