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.
freeze
I think this is S0 sleep, Suspend-To-Idle,s2idle
standby
I think this is S1 sleep, aka shallow, Power-On Suspend?mem
I think this refers to S3 sleep, aka suspend-to-RAM, deephibernate
I'm pretty sure this is S4 sleep, suspend-to-disk/hibernation.
My config
/etc/systemd/logind.conf
has:
[Login]
HandleSuspendKey=suspend-then-hibernate
HandleLidSwitch=suspend-then-hibernate
HandleLidSwitchExternalPower=suspend-then-hibernate
and /etc/systemd/sleep.conf
has
[Sleep]
HibernateDelaySec=120min
SuspendMode=suspend
SuspendState=mem standby freeze
mem, I believe is supposed to be the good one - suspend to RAM, S3.
/etc/UPower/UPower.conf
has:
CriticalPowerAction=HybridSleep
/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
My syslogs
Jan 10 18:20:48 dove systemd[1]: Reached target Sleep.
Jan 10 18:20:48 dove systemd[1]: Starting Record successful boot for GRUB...
Jan 10 18:20:48 dove systemd[1]: Starting Suspend; Hibernate if not used for a period of time...
Jan 10 18:20:48 dove systemd[1]: grub-common.service: Deactivated successfully.
Jan 10 18:20:48 dove systemd[1]: Finished Record successful boot for GRUB.
Jan 10 18:20:48 dove systemd[1]: 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[102558]: Entering sleep state 'suspend'...
Jan 10 18:20:48 dove systemd[1]: grub-initrd-fallback.service: Deactivated successfully.
Jan 10 18:20:48 dove systemd[1]: Finished GRUB failed boot detection.
Jan 10 18:20:48 dove kernel: [31933.647185] Filesystems sync: 0.006 seconds
s2idle
orsuspend
- 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
sync
at 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[1561]: Clock change detected. Flushing caches.
Jan 10 18:21:43 dove rtkit-daemon[2366]: The canary thread is apparently starving. Taking action.
Jan 10 18:21:43 dove rtkit-daemon[2366]: Demoting known real-time threads.
...
Jan 10 18:21:43 dove rtkit-daemon[2366]: 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 exit
doesn't give clues as to what sleep state was achieved.
Question clarification
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.