So what ever happened to hybrid suspend, where it would suspend to both RAM and disk? It was kind of hot a few years ago, but it seems it was dropped. Is there any way to set this up in recent Ubuntu versions?
3 Answers
There is a program called pm-is-supported that can be used to check for the suspend capabilities of the system.
On my system here are the results (0 means supported, 1 means unsupported):
$ pm-is-supported --suspend ; echo $?
0
$ pm-is-supported --hibernate ; echo $?
0
$ pm-is-supported --suspend-hybrid ; echo $?
1
The manpage of pm-is-supported suggests that s2both supports hybrid suspend. I've installed s2both, available in the uswsusp package but it still reports that hybrid suspend is not supported. I have a hunch that it needs a reboot because it updated the initrd image. I'm gonna reboot and report back. Wish me luck.
Update: Running sudo s2both wrote the snapshot to disk and suspended to RAM correctly, however when I pressed a key to resume the system rebooted (and didn't restore the snapshot from disk).
I think there's something wrong with the uswsusp package in ubuntu. The splashy package (which is used by uswsusp) has a file conflict with lsb-base which has been left unfixed since Jaunty ( https://bugs.launchpad.net/ubuntu/+source/splashy/+bug/328089 )
Try running sudo s2both or sudo pm-suspend-hybrid, see if it works on your system.
- 16,382
This question comes up frequently enough in Google that I think it's worth bumping. Li explains hybrid suspend perfectly. However, s2both requires uswsusp (thus not using in-kernel suspend), and pm-hsuspend-hybrid does the wrong thing because it is unmaintained[1].
Here's how to enable the hybrid suspend seamlessly:
- Override "suspend" call to do a "hybrid_suspend" in pm-utils.
% cat /etc/pm/config.d/00-use-suspend-hybrid
# Always use suspend_hybrid instead of suspend
if [ "$METHOD" = "suspend" ]; then
METHOD=suspend_hybrid
fi
- Make a backup of /usr/lib/pm-utils/pm-functions
- Get the patch from here: https://bugs.freedesktop.org/attachment.cgi?id=68712
- This patch enables hybrid suspend if available (i.e. on kernels 3.6+)
- Either apply it using 'patch -p0' or manually merge it if that fails
This method works for me on my Sony Vaio SVS.
PS: Reproducing the patch here in case the file is deleted in the future:
diff --git a/pm/pm-functions.in b/pm/pm-functions.in
--- a/pm/pm-functions.in
+++ b/pm/pm-functions.in
@@ -316,8 +316,28 @@ if [ -z "$HIBERNATE_MODULE" ] && \
{
[ -n "${HIBERNATE_MODE}" ] && \
grep -qw "${HIBERNATE_MODE}" /sys/power/disk && \
+ HIBERNATE_MODE_SAVE=$(cat /sys/power/disk) && \
+ HIBERNATE_MODE_SAVE="${HIBERNATE_MODE_SAVE##*[}" && \
+ HIBERNATE_MODE_SAVE="${HIBERNATE_MODE_SAVE%%]*}" && \
echo -n "${HIBERNATE_MODE}" > /sys/power/disk
echo -n "disk" > /sys/power/state
+ RET=$?
+ echo -n "$HIBERNATE_MODE_SAVE" > /sys/power/disk
+ return "$RET"
+ }
+fi
+
+# for kernels that support suspend to both (i.e. hybrid suspend)
+# since kernel 3.6
+if [ -z "$SUSPEND_HYBRID_MODULE" ] && \
+ [ -f /sys/power/disk ] && \
+ grep -q disk /sys/power/state && \
+ grep -q suspend /sys/power/disk; then
+ SUSPEND_HYBRID_MODULE="kernel"
+ do_suspend_hybrid()
+ {
+ HIBERNATE_MODE="suspend"
+ do_hibernate
}
fi
Sources:
- https://bugzilla.redhat.com/show_bug.cgi?id=843657
- https://bugs.freedesktop.org/show_bug.cgi?id=52572
[1]: pm-utils predates in-kernel hybrid suspend available in kernels 3.6+. What pm-suspend-hybrid actually does is put your machine in sleep mode for 15mins by default, and then hibernate.
- 460