Skip to content

Enable hibernate

Jonathon Hall requested to merge enable-hibernate into pureos/latest

Enable hibernate by resizing and formatting the placeholder swap file created by the image builder. A file must be created during the image build so the first extent's physical offset is known, this is added to the kernel command line. The goal is to permit future support for suspend-then-hibernate - saving battery power by hibernating if the device is unused for a long time, and/or preserving state if the battery would die while suspended.

A swap file is used (rather than a partition) so swap is encrypted, and so it can be easily resized or removed later if desired. Resuming from hibernate requires entering the LUKS password.

As far as I can tell, GNOME lacks support for suspend-then-hibernate. (https://bbs.archlinux.org/viewtopic.php?pid=1917430#p1917430 - GNOME gitlab is down again so I can't check if there is any newer activity.) It's possible to configure the systemd 'suspend' action to behave like hybrid sleep, but this increases the time and power usage when suspending a lot, so I don't think we want that. (Suspend takes about 2 seconds, hybrid sleep takes roughly 4 additional seconds per GB of memory in use from some quick tests, power usage is high while writing to disk.) So the idle and power button actions are still 'suspend' for now, but with the swapfile and kernel parameters in the OS image we could enable suspend-then-hibernate later.

Merge request reports