23

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?

1

11 Answers 11

11

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

6
  • 1
    This doesn't add the 'hibernation' option for me, just suspend :/
    – daboross
    Commented Jun 7, 2013 at 1:38
  • Probably the creator has changed the behaviour of the extension. I haven't used it in ages. Commented Jun 10, 2013 at 22:01
  • @DaboRoss Just installed it and it does show the Hibernate option on my system (Ubuntu GNOME 3.8). Commented Jun 10, 2013 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
    Commented Jun 10, 2013 at 22:31
  • That's great, mate! Commented Jun 17, 2013 at 19:43
10

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

3
  • 1
    It works!!! So simple!
    – Dougui
    Commented Apr 30, 2014 at 10:24
  • 10
    where is hibernate then? The question was about hibernate
    – Anwar
    Commented Jul 6, 2015 at 6:21
  • 3
    This is standby, not hibernate
    – sebix
    Commented Jan 7, 2018 at 17:20
7
sudo apt-get install pm-utils

Alt+F2

sudo pm-hibernate
1
  • sudo command won't work in alt-f2. you must use terminal
    – Anwar
    Commented Jul 6, 2015 at 6:22
5

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.

4
  • 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
    Commented Sep 13, 2011 at 7:47
  • 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
    Commented Sep 13, 2011 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
    Commented Sep 13, 2011 at 20:58
  • 1
    You can always systemctl hibernate
    – Rolf
    Commented May 6, 2018 at 22:42
4

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.

1
  • This still works in 18.04 LTS in gnome flashback sessions. More details here
    – yoyoma2
    Commented Feb 19, 2020 at 15:46
3

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.

1
  • 5
    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
    Commented Aug 2, 2013 at 11:15
1

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.

2
  • 1
    There is no such package in the official repositories which are what I'm using.
    – dv3500ea
    Commented Sep 13, 2011 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 Commented Sep 14, 2011 at 8:58
1

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

1

I found a new extension which adds a new button for hibernation. It works fine with touch screens and convertibles because it is a separate button. There is on drawback though: it does not (currently) work from the lockscreen.

enter image description here

It was easy to find in Ubuntu 17.10, I just had to search for hibernate and select the corresponding result of the section for software results. Hibernate and Gnome extensions were already set up, if you have problems with these I suggest you look for the corresponding Q&A here at this site.

Also you can still configure the power button to hibernate your computer instead of shutting it down (settings > power options), if that is what you want.

1
  • This one worked for me on Ubuntu 18.04 after editing /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla (see askubuntu.com/a/1064114/674319)
    – Laurenz
    Commented Aug 16, 2019 at 21:04
0

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
0

For GNOME, on any distro, you can add a hibernate button by simply installing the extension System Action - Hibernate .

And done!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .