Revision of Hibernation aka suspend to disk from Fri, 04/14/2023 - 02:22

The revisions let you track differences between multiple versions of a post.

What is hibernation?

Hibernation, also known as suspend to disk, is powering off a computer while retaining its state. In hibernation, the computer needs no power: it can be unplugged. After turning the computer on again, the system is exactly as it was before entering hibernation.

Prerequisite

Hibernation requires a swap partition at least as large as the main memory. The rest of this manual assumes the existence one single such partition. Executing the following command in a terminal shows how much "Mem" and "Swap" the system has in "total" (first column):
$ free
If the system has no (or a too small) swap partition, it can be created (or enlarged) from a GNU/Linux live system such as Trisquel's, for instance using GParted, which is graphical interface to GNU Parted.

Setting up hibernation

To hibernate/resume Trisquel 11, Linux must be given the identification of the swap partition. Executing those commands in a terminal does that:
$ sudo sed -i "s/GRUB_CMDLINE_LINUX_DEFAULT=\"/&resume=UUID=$(blkid | grep swap | cut -d \" -f 2) /" /etc/default/grub
$ sudo update-grub

After that, the following command hibernates the system:
$ systemctl hibernate
However, it asks for the password of a user with administrative privileges, what also prevents the integration into desktop environments. To avoid that, executing the following in a terminal adds a Polkit rule:
sudo tee /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla << EOF
[Enable hibernate in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes
[Enable hibernate 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
EOF

To hibernate from a desktop environment, additional steps depend on what is that desktop environment. With GNOME Shell, this extension adds a Hibernate button in the Status menu. To install GNOME Shell extensions from Abrowser, the package chrome-gnome-shell (in Trisquel's repository) must be installed and this add-on must be enabled.

Revisions

04/14/2023 - 01:38
Magic Banana
05/02/2023 - 10:14
prospero
08/03/2024 - 11:07
Avron
09/22/2024 - 02:39
knife