Do you want to hibernate your Ubuntu 20.04, 19.04, 18.04 LTS Linux Desktop PC, or laptop to freeze the current state of your work? If yes, then this tutorial is for you.
Hibernation is a feature of Computer operating systems in which the system shutdown itself while saving all content on the RAM to hard disk for temporary until the next start of the computer. Whether it is Linux (Ubuntu RHEL, CentOS, Linux Mint, etc), Windows or macOS, the hibernation work is the same, save the exact state of the PC or laptop and shut down the computer.
How Hibernation is beneficial?
It helps users who are continuously working on some software, project, browsing with multiple tabs, etc and don’t want to lose any of them even after shutting down the computer. Thus, they can opt for the Hibernate option available within the computer OS. It not only save the current state and data of the system but also helps in saving energy. That’s why you don’t need to leave your computer keeps running ON if you want to take a break of one hour. The reason could be anything electricity cuts, the laptop battery is running out, etc. However, it is recommended to shut down or restart your system properly, intermittently, so that it can update and apply the setting.
Well, let’s come to the main topic of the tutorial where will show the commands to use Hibernation on Ubuntu 20.04/19.04/18.04/17.04/16.04…
Enable Hibernating option on Ubuntu 20.04 LTS
Before starting the tutorial you should know the difference between Suspend and Hibernation on Linux systems. Suspend an option that is available by default on all the Linux distros including the Ubuntu that partially freezes your computer state, I mean it not going to save system state from RAM to hard disk instead it remains in the RAM and it will not shut down the computer or laptop completely. Instead, it puts most of the PC components in the low power state, therefore it resumes the state of the system much faster than Hibernation. Whereas the downside is if the PC loses the power then resuming the frozen state of the system won’t be possible. If you suspend a laptop, then it will continuously consume the battery 2 or 3 days until it won’t get exhausted completely.
On the other hand, hibernation is a complete freeze of the current PC state, which means it will save the RAM data on the hard disk and completely shut down all components of the PC. Therefore, no need for a power supply, and whenever you turn it on, you get the same screen or work where you left it.
sudo apt install pm-utils
To suspend the system using the command terminal
For hybrid hibernate in which the system follows the hibernation process but instead, it will remain in Suspend mode which means a quicker system resume while having the hibernation benefits.
Note: Make sure your SWAP partition is bigger than the system to make the hibernate feature work properly.
Install hibernate and other dependencies
sudo apt install hibernate
grep swap /etc/fstab (find UUID)
At the line GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash” add UUID of swap. The line looks like this GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash resume=UUID of swap”
Restart and after the restart
sudo systemctl hibernate
You can also enable the hibernate option in the menus. To do that create
sudo nano /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
Add the following to the file and save:
[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
Restart the computer
2 thoughts on “How to Hibernate Ubuntu 20.04 LTS focal fossa”
sudo APT install pm-utils
j’ai suivi la marche a suivre a la lettre car mon portable ne sort pas du tout de veille (ou toutes les commandes font ce qu’elles veulent) mais quand j’ai fini de taper la ligne de commande dans le fichier, le terminal me dit que la commande est introuvable. et je ne sais pas comment enregistrer cette ligne de commande….
merci beaucoup par avance