Issues with sleep states on linux

Hi! I am having some issues with sleep states on linux. systemctl has an option called hybrid-sleep which suspends to ram but also writes to disk in case power dies. The expected behavior on wake would be a normal wake from ram (so should be very fast). However on wake (pressing the power button), it flashes the screen after a short wait before going back to sleep. After waking again, it seems to be correctly waking from sleep as it turns on very fast. I am running NixOS.

It should be supported as these are framework’s outputs of the kernel sleep states (used the linux kernel docs).
cat /sys/power/state → freeze mem disk
cat /sys/power/disk → platform shutdown reboot [suspend] test_resume

A hybrid-sleep should be using disk and suspend.

Furthermore, I overwrite the suspend to operate like a hybrid-sleep. So my sleep.conf looks like:

SuspendMode=suspend
SuspendState=disk

On my Dell Latitude 7480, calling systemctl suspend works with no issue (along with hybrid-sleep). However on the framework calling systemctl suspend causes it to go to sleep correctly, but on wake it takes a few seconds (as if it is trying to wake from ram) before shutting off and then turning on and waking from hibernation.

@42jd, it may not matter, but the Arch Wiki article includes HibernateMode=suspend and HibernateState=disk sleep.conf.

I imagine your journal could tell a lot about what actually is happening with that stalled awakening.

1 Like

Have you checked the logfile?
Any chance you are running a tool that does an “emergency” hibernate/ hybrid-sleep when the battery is low?
If the “new” battery status after resume is reported with delay, the “emergency” could trigger and put your system back into sleep.

Another issue I’ve been facing recently on my 11th Gen w/ NixOS and hybrid-sleep is that the system woke up right before the battery ran out.

Adding acpi.no_ec_wakeup=1 to boot.kernelParams resolved the issue. From the little documentation I can gather on this kernel option it prevents the Embedded Controller (EC) from waking up the laptop.

This fixed my hybrid-sleep issues without impact other suspend/ hibernate modes.