In Hibernate mode on a computer all the data of the current session which is in RAM is first copied to the hard disk (Usually to swap space) and then the system gets shutdown. When you switch on your system again the saved data is copied back to RAM which makes it start from the same point as it was before hibernation.
There is no power consumption in this mode as during the hibernation period system is powered off. To get back to the working state again simply press the power button.
In newer Linux distributions the option to hibernate the system is not enabled by default.
So in this article, I will discuss how to enable hibernation on a Ubuntu system.
Why hibernation is not enabled by default in Ubuntu?
Each hardware device connected to a computer system has its state. Reading and recreating the state correctly is a difficult task.
When you hibernate a system all the data present in the main memory is saved to Swap space, if Swap is not set up correctly you will face system crashes and data losses. So in many Linux distributions, it comes disabled by default.
If you want to use this feature you can enable it on your system by following the steps given ahead in this article.
Check your system for hibernation compatibility
To check compatibility first use the given command to install the
pm-utils package –
sudo apt install pm-utils -y
Now by using the given command you can check if your system is compatible with hibernation or not –
Alternatively, you can use the following command –
sudo systemctl hibernate
The above command will shutdown your system, switch on your system again, and see if all the programs that were running before executing the above command are running as it is if yes that means your system is compatible.
Note:- To make hibernation work correctly on your system always keep your Swap partition size equal to or greater than RAM.
Enable Hibernate option on a Ubuntu system
To enable the Hibernate option on your Ubuntu system, run the given command –
sudo nano /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
Copy and paste the given lines into this file –
[Re-enable hibernate by default in upower] Identity=unix-user:* Action=org.freedesktop.upower.hibernate ResultActive=yes [Re-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
Save the file by pressing Ctrl+s and then exit from the editor by using Ctrl+x.
After this reboot your system to make the changes effective –
I hope you have enabled Hibernate option on your Ubuntu system. Now if you have a query or feedback then write us in the comments below.