25

I did a clean install of 15.04, tried to enable hibernation per instruction from http://ubuntuhandbook.org/index.php/2014/10/enable-hibernate-option-in-ubuntu-14-10-unity/

but it works only if I boot with upstart and not with systemd.

How can I get it to work with systemd?

EDIT>After installing hibernate package I can run it from the terminal, but still it is not available in the shutdown menu.

André Marinho
  • 910
  • 9
  • 23

2 Answers2

18
  1. Create the following file: /etc/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla

  2. Copy / paste the following content into it:

    [Enable hibernate by default in upower]
    Identity=unix-user:*
    Action=org.freedesktop.upower.hibernate
    ResultActive=yes
    
    [Enable hibernate by default in logind]
    Identity=unix-user:*
    Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
    ResultActive=yes
    
  3. Log out and check that you can see the hibernate menu item on the login screen, do the same once you logged in.

The reason the above manual step needs to be done is that they seem to have disabled hibernate by default in Ubuntu 15.04.

Jinesh Choksi
  • 196
  • 1
  • 2
  • First it didn't change anything; after I logged in this file was gone, so I re-created this file, and tried again with the same result: just like normal shutdown except the nuisance of switching the screen on and off a couple of times before shutdown, and reporting a system problem on login. No wonder they disabled this feature by default ;-) I have only sudo pm-suspend-hybrid working though. – Sadi Oct 03 '15 at 08:49
  • 2
    Wov, got it! I worked like a charm after adding the resume parameter to kernel boot options as per: https://help.ubuntu.com/community/PowerManagement/Hibernate – Sadi Oct 03 '15 at 09:07
  • 1
    What about the simple solution at http://tipsonubuntu.com/2015/04/30/ubuntu-15-04-auto-shutdown-lid-closed/ ? I admit I haven't tried it yet but the comments suggest it works. – Carl Witthoft Oct 13 '15 at 23:01
  • Are the 3 steps of this answer all that needs to be done on a vanilla 15.04 install? (or are they, what needs to be done on top of the instructions the OP has followed?) – Frank N Oct 18 '16 at 23:57
  • Still helps in 17.04 (zesty)! Thx! – midenok Jan 26 '17 at 01:04
1

The answer given by Jinesh Choksi to create the file /etc/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla doesn't seem to work for me, when I resume hibernation, it just performs a normal boot. The best option I've found is the classic pm-hibernate, which works with no issues:

sudo pm-hibernate

You also have the option of a hybrid suspend/hibernate. From the man pages:

pm-suspend-hybrid
    Hybrid-suspend is the process where the system does everything it needs to hibernate, but suspends instead of shutting down. This means
    that your computer can wake up quicker than for normal hibernation if you do not run out of power, and you can resume even if you run
    out of power. s2both(8) is an hybrid-suspend implementation.
texasflood
  • 457
  • 2
  • 6
  • 18