How to enable hibernation in Ubuntu

It is truly surprising that Ubuntu ships with hibernation turned off. But, hibernation can be useful on notebooks where I would prefer to hibernate than to power off when the notebook runs completely out of battery.

Ubuntu 14.04

A few steps are needed to enable hibernation in Ubuntu:

  • Ensure that the size of your swap partition is equal or greater than the amount of RAM in your system.

  • Open the following file with superuser privileges:

$ sudo vim /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla
  • Find the following two sections in the file:
[Disable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=no

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

Change the value assigned to ResultActive in both section to yes.

  • Reboot Ubuntu. Now, you will find the Hibernate option when you click the Gear icon.

Note: These steps do not enable the Hibernate option for when the laptop lid is closed. That option is not visible in the Power settings. If you use GNOME Tweak Tool, that option can be set. But, I found that my Thinkpad X201i would still not hibernate when the lid was closed. I still had to manually choose Hibernate from the Shutdown menu to put the laptop into hibernation.

Ubuntu 12.02

A few steps are needed to enable hibernation in Ubuntu:

  • Ensure that the size of your swap partition is equal or greater than the amount of RAM in your system.

  • As sudo, open a new file /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

Add these lines and save the file

[Re-enable hibernate by default]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
  • Reboot Ubuntu. Now, you will find the Hibernate option when you click the Gear icon. You will also find Hibernate as an option for your Power or Laptop lid settings.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s