Revision of Hibernation aka suspend to disk from Sat, 08/03/2024 - 11:07

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.

Be careful: on a number of computers, wake-up from hibernation has issues. In the worst case, the computer may start as if starting from off. In other cases, the MATE session may be terminated, or it may be difficult to access it again. It is recommend to save all documents before going to hibernate.

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 a 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 a reboot, the following command would hibernate the system:
$ systemctl hibernate
However, it would ask for the password of a user with administrative privileges, what also prevents the integration into desktop environments. To avoid that, executing the following command 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

If you are using GNOME Shell, install this extension, which adds a Hibernate button in the Status menu. To do so from Abrowser, you may need to install the package chrome-gnome-shell, which is available in the Trisquel repository, and to enable this add-on.

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