16

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?? – LasseLuttermann Aug 08 '10 at 22:38
  • 5
    Hybrid 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. Thompson Aug 09 '10 at 04: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 Castro Aug 09 '10 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. Thompson Aug 10 '10 at 17:56

3 Answers3

10

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.

Li Lo
  • 15,894
  • 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 via pm-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. – Ryan C. Thompson Aug 10 '10 at 17:54
  • I guess it's not supported. – Ryan C. Thompson Oct 10 '10 at 21:05
3

You can enable hybrid suspend by following the answer to this question:

Jorge Castro
  • 71,754
0

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:

[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.