How to make GNOME 3 use suspend-hybrid?

6

1

How can I make GNOME 3 use pm-suspend-hybrid instead of pm-suspend when closing the lid or using suspend from the menu?

Martin Schulze

Posted 2012-05-01T01:35:13.660

Reputation: 163

I'm not sure if there is pm-suspend-hybrid support but you can use this to change the lid close action to hiberate gsettings get org.gnome.settings-daemon.plugins.power lid-close-ac-action "hibernate" and gsettings get org.gnome.settings-daemon.plugins.power lid-close-battery-action "hibernate" you can also use "blank" or "shutdown" as the action – seanwatson – 2012-05-03T02:14:35.053

Answers

2

Be sure it works

First of all you need to be sure pm-suspend-hybrid works on your computer. Type

sudo pm-suspend-hybrid

in console and notice if it works as expected.

Hacking

It is more the hack than a solution. But it works for me.

Execute the following commands in the console:

ls -l /usr/sbin/pm-suspend  # it should be symlink to /usr/lib/pm-utils/bin/pm-action
sudo rm /usr/sbin/pm-suspend  # just remove this link
sudo editor /usr/sbin/pm-suspend  # create new file instead of symlink

Contents of the new pm-suspend script:

#!/bin/bash
pm-suspend-hybrid
# notice that you need to execute "pm-suspend-hybrid"
# just changing symlink is not enough

Than give execution rights to this new script:

sudo chmod +x /usr/sbin/pm-suspend

Enjoy!


Notes

  • If your distribution does not use sudo command you need to be root to execute these commands.
  • It is possible that pm-suspend is located at another path on your system. Just type whereis pm-suspend to find correct path.
  • You may use any text editor of your choice instead of editor if you want or if your distribution does not have this wrapper.

lig

Posted 2012-05-01T01:35:13.660

Reputation: 266

1Thank you for this detailed answer! I had the same idea a while ago but didn't bother trying it. – Martin Schulze – 2012-06-11T01:02:57.980

1

I have a workflow without having to create a file, without deleting the original file and that works in one command. Paste this in a terminal if you already know that your machine support hybrid suspension:

sudo mv /usr/sbin/pm-suspend /usr/sbin/pm-suspend_traditional && sudo ln -sf /usr/sbin/pm-suspend-hybrid /usr/sbin/pm-suspend

With the command above you will be enabling the hybrid suspension by default on your system. It is totally safe. Restoring The original config can restored by entering this command:

sudo mv /usr/sbin/pm-suspend_traditional /usr/sbin/pm-suspend

Step by step explanation

First you should check if your machine support H-S.

  1. check if HS is supported by pasting this in a terminal (source webupd8 http://goo.gl/kjISbj):

    sudo pm-is-supported --suspend-hybrid && echo "hybrid suspend is supported" || echo "your system doesn't support hybrid suspend"
    

    The output of this command is a message that says if your machine does support or not hybrid-suspension.

  2. Make a backup

    sudo mv /usr/sbin/pm-suspend /usr/sbin/pm-suspend_traditional

  3. Make a link instead of a script:

    sudo ln -sf /usr/sbin/pm-suspend-hybrid /usr/sbin/pm-suspend
    

That's it.

Note: The re-hack just combines steps 2 and 3.

The advantages of this method compared with Lig's one are:

  1. avoid the need to (and you shouldn't) delete the original pm-suspend file
  2. it creates a backup that allows you to restore the previous setting
  3. avoid the need of editing a new file, instead just link the original existent one with a symbolic link (ln -s).

Rho con Linux

Posted 2012-05-01T01:35:13.660

Reputation: 111

Does not works, as @lig says, it is required that the script is called with the right name (pm-suspend-hybrid) so that the rigth action is performed. symlink is not enough. – Jocelyn delalande – 2015-02-02T21:25:02.737

Please note: Answers can be sorted in a number of ways, so "the response above" really doesn't have any context here. – ale – 2014-01-09T14:39:34.473

Yeah, I noticed, that's why I put the author's name. What would be the proper way to cite it? – Rho con Linux – 2014-01-10T11:15:26.027

The author name is okay. Not so useful when there's a lot of answers, though, so I would link to the answer referenced. – ale – 2014-01-10T12:53:35.483