Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

GNOME Shell doesn't have an option to hibernate in the session menu. I checked the GNOME Shell Cheat Sheet but hibernate is not mentioned there.

How can I hibernate my machine from within a GNOME Shell session?

share|improve this question

9 Answers 9

Just install this GNOME Shell extension by sliding the slider. Your user menu should now show a few new extra options: Hibernate, and Power Off...

enter image description here

share|improve this answer
1  
This doesn't add the 'hibernation' option for me, just suspend :/ –  DaboRoss Jun 7 '13 at 1:38
    
Probably the creator has changed the behaviour of the extension. I haven't used it in ages. –  Alfredo Hernández Jun 10 '13 at 22:01
    
@DaboRoss Just installed it and it does show the Hibernate option on my system (Ubuntu GNOME 3.8). –  Alfredo Hernández Jun 10 '13 at 22:10
1  
I just installed it again and it seems to work this time! They must have updated it! Thanks for posting that. –  DaboRoss Jun 10 '13 at 22:31
    
That's great, mate! –  Alfredo Hernández Jun 17 '13 at 19:43

I don't think it is possible to manually hibernate in GNOME Shell (I could be wrong). There is an extension that adds extra options for power management, but having not had sucess installing extensions myself, I cannot tell you for sure how to install it.

For now, you can hit alt + f2 and type pmi action hibernate or gnome-power-cmd hibernate (10.10 and lower only), then press enter. This will not give you any options, so only do this if you are sure you won't want to cancel.

If you want to make this easier, you could create a script with (using zenity to provide options) and place this in ~/bin. You could then create a keyboard binding for the script, so when you press (for example) alt+super+h your system would hibernate.

share|improve this answer
    
I guess gnome-power-cmd is no longer available in 11.04, Refer:answers.launchpad.net/ubuntu/+source/gnome-power-manager/…; alternative is : gshutdown gshutdown.tuxfamily.org/en/index.php. –  user7044 Sep 13 '11 at 7:47
    
@user7044: thanks! –  RolandiXor Sep 13 '11 at 15:10
    
To use the pmi command I had to install the powermanagement-interface package. Unfortunately I get an error when I use it: Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Hal was not provided by any .service files. –  dv3500ea Sep 13 '11 at 20:56
    
@dv3500ea aw man... I'll have to find the correct command for GNOME 3 again. If you do before me feel free to edit it into the answer. –  RolandiXor Sep 13 '11 at 20:58

dv3500ea In your link to GNOME Shell Cheat Sheet you got the answer:

The Power Off... menu entry is hidden by default. You can make it visible by pressing the Alt key in the user menu.

Just hold ALT

share|improve this answer
    
It works!!! So simple! –  Dougui Apr 30 at 10:24

There's a bit more required for this in 12.10. (Skip this answer if you're using 12.04 or earlier.) By default, alternative status menu no longer displays the Hibernate option. The easiest way to fix this is to install the extension, newly added to the Ubuntu repositories, and then use gsettings to change the default:

sudo apt-get install gnome-shell-extensions
gsettings set org.gnome.shell.extensions.alternative-status-menu allow-hibernate true

Then enable the extension in Tweak Tool and restart the shell (alt+f2 and enter r).

DO NOT install the extension from extensions.gnome.org.

share|improve this answer
2  
The second command is not working for me. Are you sure about it? I get this error: No such schema 'org.gnome.shell.extensions.alternative-status-menu' –  sajjadG Aug 2 '13 at 11:15
sudo apt-get install pm-utils

Alt+F2

sudo pm-hibernate
share|improve this answer

You need to install "gnome-shell-extensions-alternative-status-menu" package if you are using gnome-shell testing ppa. This will enable hibernation option as well as power off options in the status menu.

share|improve this answer
1  
There is no such package in the official repositories which are what I'm using. –  dv3500ea Sep 13 '11 at 20:54
    
you need to add the following ppa: sudo apt-add-repository ppa:ricotz/testing && sudo apt-get update. Then upgrade gnome-shell using sudo apt-get dist-upgrade and then install "gnome-shell-extensions-alternative-status-menu" package. That's it –  Syed Khalil Sep 14 '11 at 8:58

For me installing the extension

sudo apt-get install gnome-shell-extensions
gsettings set org.gnome.shell.extensions.alternative-status-menu allow-hibernate true

(as mentioned above) AND editing this file

gksu gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

and inserting

[Enable Hibernate]
 Identity=unix-user:*
 Action=org.freedesktop.upower.hibernate
 ResultActive=yes

helped (see here).

share|improve this answer

as of 2013-10-24, using Ubuntu-Gnome 13.10, the following allowed me to use hibernation in the power settings, as well as hibernate using the physical power button:

sudo -i  # because the following should be ran as root
gsettings set org.gnome.shell.extensions.alternative-status-menu allow-hibernate true
cat > /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla <<EOF
[Enable Hibernate]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
EOF
share|improve this answer

On Ubuntu Gnome 14.04, Gnome 3.12, the following works (13 June 2014), but I have only set it up to work with pushing the power button and closing the lid (so no GUI button to push).

Credit goes here, to the commentators, too.

Instead of making a new file .../polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla, sudo edit the existing

/var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla

and activate hibernation there, by changing ResultActive=no to ResultActive=yes, to obtain the following sections:

[Disable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

[Disable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate
ResultActive=yes

This allows the machine to hibernate.

To activate it on lid closure, sudo edit

/etc/systemd/logind.conf

and change HandleLidSwitch=suspend to #HandleLidSwitch=hibernate.

Before doing this, I searched dconf editor for entries with hibernate and changed everything from suspend to hibernate (my machine cannot resume from suspend...) I'm not sure which entry made it work, but the power button also hibernates my machine now.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.