People, people, if the absence of hibernation on Linux making you reboot to your dual booted system like windows, then we are going to solve this issue thoroughly, today. Mainly the problem is not going into hibernation mode, but it’s actually coming back and having the ability to resume things that are left off doing. But sometimes black screen appears when we try to resume after our previous suspend (sleep in windows language). A hard reboot is required, in order to be working again on that system, this leads to loss of tasks and focus on work.
Moving on to Solutions for hibernation on linux…
There are three solutions to this problem, which I tried one after another, some worked for me and some worked for others, so its kind of mixtures of solution in which any solution can lead you to success. Before anything, you have to check whether your Linux distro supports Hibernation. You can do this by running in a terminal:
$: sudo pm-hibernate
or for newer Ubuntu above 17.04 :
$: sudo systemctl hibernate
if you don’t have hibernation, try to install pm-utils, then:
$: sudo apt-get install hibernate
also, you can do this by going to the synaptic package manager or any distro provided package manager if you have that, then it’s easy.
Solution 1: Update Linux through update manager
Okay, you probably read this right, its utilities that are way too old can make you stay back from using hibernation. New changes to Ubuntu sometimes changes the settings to those distro also, which are using ubuntu’s code base as its codebase. AND you can check which version of ubuntu base you are running under “pretty name” by simply:
$ : sudo cat /etc/os-release
This should give you the base name, using which you can update accordingly and opt for hibernation.
Solution 2: Adding lines in polkit for hibernation
It is a small tricky business. You have to add some lines as follows:
$: sudo nano /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
You have to add lines of anyone block according to your ubuntu version, the first block is default thingy which means if two blocks (i.e lines of code for 16.04 or 15.04) after this doesn’t work, you can use this by Adding these lines:
[Re-enable hibernate by default in upower]
[Re-enable hibernate by default in logind]
for Ubuntu 16.04 and above add these:
[Re-enable hibernate by default in upower]Identity=unix-user:*Action=org.freedesktop.upower.hibernateResultActive=yes[Re-enable hibernate by default in logind]Identity=unix-user:*Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.hibernate-multiple-sessionsResultActive=yes
for Ubuntu 15.04 or 14.04 add these:
[Re-enable hibernate by default] Identity=unix-user:* Action=org.freedesktop.upower.hibernate ResultActive=yes[Re-enable hibernate by default for login1] Identity=unix-user:* Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.hibernate-multiple-sessions ResultActive=yes
restart your system, and hopefully, hibernation will be working.
check latest docs: https://help.ubuntu.com/stable/ubuntu-help/power-hibernate.html
Solution 3: Installing Tuxonice and using it.
This tool requires you to have a swap area more than your RAM size. Now, you can check if the swap is more or less than RAM by:
if the swap is not more than RAM, this solution will not work for you. Do increase your swap area. Now, assuming you have more swap area. Then before installing this, you have to delete a file under which the hibernation code is written for default so that the tuxonice could configure hibernation of its own way. Delete the hibernation file:
$: sudo rm /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
Install the hibernation patch by using the following:
$: sudo add-apt-repository ppa:tuxonice/ppasudo apt-get updatesudo apt-get install tuxonice-userui linux-generic-tuxonice linux-headers-generic-tuxonice
It will install all required files by tuxonice.
Note: I have seen that tuxonice creates its own kind of kernel than normal (i.e patched kernel). You can choose kernel to boot on at the start of grub selection. kernel with tuxonice has ability to hibernate while others don’t. Although It’s an easy method for hibernation on Linux, it has some less update available as a downside. Read more about tuxonice.
Now restart the system for it to be completely working.
Checking hibernation on Linux by the following:
$: sudo pm-hibernate or sudo systemctl hibernate
For me, installing TuxonIce [solution3] followed by updating Linux [solution1] worked.
Check this also for more solutions: https://askubuntu.com/questions/94754/how-to-enable-hibernation
Helpful? Read more Linux related solutions here.