You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.9 KiB

5 years ago
---
title: How to enable hibernation in three simple steps
tags: [hibernation, parabola, systemd, mkinitcpio, syslinux]
11 months ago
updated: 2017-10-22 18:30
5 years ago
description: How to enable hibernation on systemd and mkinitcpio-based systems
---
Greetings to all,
11 months ago
It has been some time since I needed to enable hibernation on my machine so
that I could find all my stuff exacly as I left it the previous time. This
is especially useful to me since I usually leave multiple terminals opened. So,
untill recently, I suspended instead of hibernate, but that is not
5 years ago
always practical.
11 months ago
What follows is a summary of instuctions I gathered from
[multiple](https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate)
[sources](https://wiki.archlinux.org/index.php/Mkinitcpio#Image_creation_and_activation)
5 years ago
and it reflects my use case and configuration.
## Prerequisites
- A swap partition with size >= RAM size.
- Systemd
- mkinitcpio
- A bootloader that supports kernel parameters.
## Step 1
Get the UUID of your swap partition.
# UUID="$(blkid | grep swap | awk '{print $2}' | tr -d "\"")"
## Step 2
11 months ago
Edit the `/etc/mkinitcpio.conf` file to include `resume` after `udev` in the
5 years ago
`HOOKS` section. This is how mine looks:
HOOKS="base udev mdadm_udev lvm2 resume autodetect modconf block filesystems keyboard fsck"
11 months ago
Then we must regenerate the ramdisk environment (please get the
5 years ago
correct kernel names first). For example:
# mkinitcpio -p linux-libre
# mkinitcpio -p linux-libre-lts
## Step 3
Copy the variable you gathered earlier.
$ echo $UUID
11 months ago
Append the `resume` kernel parameter to your bootloader configuration. For
example, this would be a modified Syslinux entry to accomodate the new
parameter.
5 years ago
LABEL <some label>
MENU LABEL <some value>
LINUX <some other value>
APPEND <yet again other values> resume=<paste the $UUID variable here>
INITRD <and again>
## Testing
$ systemctl hibernate
That's it.
Enjoy.