Monday, November 25, 2013

Enabling Hibernation in Ubuntu

Hibernation is a useful feature of modern computers/operating systems, which allows users to turn off the computer for a while and later resume their session from that point, eliminating the need to save all work before shutting down. It is similar to the "Sleep" or "Suspend" option, but the computer won't keep on drawing power when hibernated, because all the information in the memory is written to the disk and therefore there is no need to feed power to the memory. I use this option to power down my system unless I perform some operation that specifically requires shut down instead of hibernation.

In Ubuntu, there is no hibernate option in the shut down menu because hibernation is disabled by default as a measure against certain problems it causes on certain hardware. It has to be enabled by the user and we will see in this article how to do it. This is tested on Ubuntu 13.10 Saucy Salamander.

The first thing to do before making any changes to the system is to check if the hibernation is working the way it is supposed to. To do this, open a terminal window by CTRL+ALT+T and enter the following command:

The expected behaviour after this command is that your system powers down and when you power the system up again (and boot into Ubuntu if you have a multi-boot system), the session is resumed the way you left it, with the terminal window and any other window open. If this command does not work, try checking if your swap settings are configured properly. If this command works, you may use it every time to hibernate your system but that may get annoying. Instead, we will enable the hibernate option in the shut down menu.

We need to edit the file "com.ubuntu.enable-hibernate.pkla" located in /etc/polkit-1/localauthority/50-local.d. Open a new terminal window and enter the following command:

By the way, you can simply select these commands with your mouse and middle-click on your terminal window to easily copy and paste the command into the terminal. If the file does not exist; just enter the text below and save, the file will be created. If it already exists, modify it so that it contains the text below.

After this, either restart your system or run the following command:

Alternatively, you can start the "System Monitor" application (either by searching in the Unity launcher or by typing "gnome-system-monitor" into a terminal window) and then kill the "indicator-session-service" process from the list of running processes. After that, the "Hibernate" option should appear on your shut down menu:

Just note that you have to restart if you want the "Hibernate" option to appear on the shut down dialogue that you get when you press your computers "Power" button.

No comments :

Post a Comment