[How to] enable hyberneation in Zorin

I'm "forced" to use hibernation, because I use laptop where suspend does not work (HP ENVY x360 on Ryzen, with borked BIOS :neutral_face:).

I agree that at first, to find out the correct way to make it work was a pain, but once I found a way, it is actually quite simple. Enabling hibernation in Zorin is the same as enabling it in Ubuntu; the hibernation capability is there, it is just disabled by default.

Three steps are required:

  1. Optional technical step: prepare swap partition, if you do not have one
  2. Enable hibernation policy in the system
  3. Update the GRUB boot loader so that it knows from where to resume hibernated OS.

Step 0: Swap
It is possible to hibernate to either a swap partition of to a swap file. I recommend swap partition, because to make it work is so much simpler :slight_smile: You just ensure that your swap partition is at least as big as your physical RAM (so with 16GB RAM you need at least 16GB swap partition). For step 3) you will need a partition UUID. (You can get UUID from e.g. a preinstalled Disks utility on your desktop:

Step 1: Enable hibernation policy
This is done by creating one config file called com.ubuntu.enable-hibernate.pkla in path /etc/polkit-1/localauthority/50-local.d/ like this:

sudo nano /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

You put this in the config 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 and close the file. And voila, there is a new option in Settings to use Hibernation to disk :slight_smile: :

Step 2: Update GRUB boot loader
Config file for GRUB bootloader is stored in /etc/default/grub, so edit it like this:

sudo nano /etc/default/grub

Find a line which saiz GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
...and extend the line with "resume=UUID=<your_swap_UUID>", using UUID of your swap partition. Here is an example of mine:


Now you just need to update GRUB boot loader with this new configuration, running:

sudo update-grub

And that is it :grinning: Now if you press power button, the system should hibernate. And after the next startup, it should restore itself from hibernation :slight_smile:
(Note: hibernation can take some time. Depending on speed of our disks and on your RAM+swap usage + RAM size, it can take from 15secs up to several minutes, so be patient... Resume from hibernation is always quite fast, 15secs on my HP laptop with nvme SSD...)

2 Likes