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?
-
What's the point of hybrid suspend??– LasseLuttermannAug 8, 2010 at 22:38
-
5Hybrid suspend is when your computer does suspend-to-disk and suspend-to-RAM at the same time. So you get the fast resume speed of suspend-to-RAM, but you don't lose your session if you lose power or run out of battery. So in principle, it's better than either suspend-to-ram or suspend-to-disk alone. Which is why I'm wondering why it seems to have disappeared from the feature lists of modern Linux distros.– Ryan C. ThompsonAug 9, 2010 at 4:46
-
In the "On Battery Power" tab in the power manager I see an option to "When battery power is critically low: Hibernate", perhaps that removes the need for a hybrid suspend?– Jorge CastroAug 9, 2010 at 21:23
-
1@Jorge: Another use case is if you need to remove your laptop battery (or unplug your suspended desktop PC) for some reason. If you're in hybrid suspend, it won't matter. If you're in regular suspend-to-RAM, you'd have to resume and then suspend to disk.– Ryan C. ThompsonAug 10, 2010 at 17:56
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.
-
I tried
s2both
and got the same results as you. I also tried switching to a tuxonice kernel and telling pm-utils to use tuxonice, and then using the tuxonice hybrid suspend viapm-suspend-hybrid
. The screen never turned on when I resumed, but Control+Alt+Delete worked to reboot, so I think it actually worked, but failed to turn on the screen. Aug 10, 2010 at 17:54 -
You can enable hybrid suspend by following the answer to this question:
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.