I understand that there's loads of theoretical sleep states, but that for whatever reason most of them don't work/aren't available on a given laptop.
My laptop is set up to do hybrid sleep; that is do a suspend for 2 hours, then do a hibernate. It's great. When it works. But sometimes it doesn't; and the battery gets completely killed.
I'm not very clear looking at the kernel logs what would indicate a successful sleep state. How would I find out? I have a suspicion that my laptop is not doing proper "suspend to ram", but instead only doing "standby"
I'm having a hard time translating between the words in use, between the config files (see below), this wikipedia article on ACPI and the kernel logs.
freezeI think this is S0 sleep, Suspend-To-Idle,
standbyI think this is S1 sleep, aka shallow, Power-On Suspend?
memI think this refers to S3 sleep, aka suspend-to-RAM, deep
hibernateI'm pretty sure this is S4 sleep, suspend-to-disk/hibernation.
[Login] HandleSuspendKey=suspend-then-hibernate HandleLidSwitch=suspend-then-hibernate HandleLidSwitchExternalPower=suspend-then-hibernate
[Sleep] HibernateDelaySec=120min SuspendMode=suspend SuspendState=mem standby freeze
mem, I believe is supposed to be the good one - suspend to RAM, S3.
/etc/default/acpi-support has a lot of comments on hibernate:
# Comment the next line to disable ACPI suspend to RAM ACPI_SLEEP=true # Comment the next line to disable suspend to disk ACPI_HIBERNATE=true # Change the following to "standby" to use ACPI S1 sleep, rather than S3. # This will save less power, but may work on more machines ACPI_SLEEP_MODE=mem ... # If you specify dbus or pm-utils, the result will normally be the same as when # you suspend from your desktop environment. If you specify "hibernate" or # "acpi-support", be aware that this probably does not match what your desktop # environment would do (unless you have managed to configure something so that # the DBUS power management interfaces call the hibernate package). # # # Please specify a space separated list of options. The recommended value is # "dbus pm-utils" # SUSPEND_METHODS="dbus-pm dbus-hal pm-utils" # Set the following to "platform" if you want to use ACPI to shut down # your machine on hibernation HIBERNATE_MODE=shutdown
Jan 10 18:20:48 dove systemd: Reached target Sleep. Jan 10 18:20:48 dove systemd: Starting Record successful boot for GRUB... Jan 10 18:20:48 dove systemd: Starting Suspend; Hibernate if not used for a period of time... Jan 10 18:20:48 dove systemd: grub-common.service: Deactivated successfully. Jan 10 18:20:48 dove systemd: Finished Record successful boot for GRUB. Jan 10 18:20:48 dove systemd: Starting GRUB failed boot detection... Jan 10 18:20:48 dove kernel: [31933.640758] PM: suspend entry (s2idle) Jan 10 18:20:48 dove systemd-sleep: Entering sleep state 'suspend'... Jan 10 18:20:48 dove systemd: grub-initrd-fallback.service: Deactivated successfully. Jan 10 18:20:48 dove systemd: Finished GRUB failed boot detection. Jan 10 18:20:48 dove kernel: [31933.647185] Filesystems sync: 0.006 seconds
suspend- So is that ACPI S0? (As in the 2 in s2idle is short for "to", and not "S2" as in ACPI states?) If so, why didn't it manage S3 when that's configured as the preference? I'd expect some notice about why that state was chosen?
- why the "failed boot detection" bit when I'm shutting down/sleeping?
- I think the
syncat the end makes sense - data flushed to disk.
Then the next lines must be on wake up
Jan 10 18:21:43 dove kernel: [31933.780334] Freezing user space processes ... (elapsed 0.003 seconds) done. Jan 10 18:21:43 dove kernel: [31933.784219] OOM killer disabled. Jan 10 18:21:43 dove kernel: [31933.784221] Freezing remaining freezable tasks ... (elapsed 6.113 seconds) done. Jan 10 18:21:43 dove kernel: [31939.898171] printk: Suspending console(s) (use no_console_suspend to debug) Jan 10 18:21:43 dove kernel: [31940.839037] ACPI: EC: interrupt blocked Jan 10 18:21:43 dove kernel: [31988.103447] ACPI: EC: interrupt unblocked Jan 10 18:21:43 dove kernel: [31989.258313] OOM killer enabled. Jan 10 18:21:43 dove kernel: [31989.258318] Restarting tasks ... Jan 10 18:21:43 dove kernel: [31989.267532] done. Jan 10 18:21:43 dove kernel: [31989.267553] random: crng reseeded on system resumption Jan 10 18:21:43 dove systemd-resolved: Clock change detected. Flushing caches. Jan 10 18:21:43 dove rtkit-daemon: The canary thread is apparently starving. Taking action. Jan 10 18:21:43 dove rtkit-daemon: Demoting known real-time threads. ... Jan 10 18:21:43 dove rtkit-daemon: Demoted 4 threads. Jan 10 18:21:43 dove kernel: [31989.292406] PM: suspend exit
- it's weird that this starts by saying it's "Freezing remaining freezable tasks" - surely those are already frozen? Same with suspending terminal. These sound like they should have happened on suspend not wake up?
- At the end, the
suspend exitdoesn't give clues as to what sleep state was achieved.
I'm aware that in order to ask my question I've had to include a lot of detail and express a lot of confusion and that this might cause down votes for being too vague. So to summarise:
- Is my laptop only 'achieving' S0 state (s2idle), and not S3 (deep/suspend-to-ram)?
- What can I do to investigate/configure it to actually use S3 state?
Beyond those key questions, any tips on reliable ways to grep the logs for this info, or things to look for in the event that it fails to sleep, or explanations to any of the above would really help, too.
- Edited 18 April 2023 to add info from kernel docs - thanks to @MattNordhoff for link.