Make hibernation resume work on a LUKS-encrypted install
The diagnosis is correct and well sourced: the random-key crypttab swap, resume= pointing at the mapper node, and 'the resume hook must be placed after encrypt or lvm2' are all on wiki.archlinux.org/title/Power_management/Suspend_and_hibernate. The filefrag awk one-liner and btrfs inspect-internal map-swapfile -r (including the 198122980 example) are verbatim from it, as are the /sys/power/resume major:minor and /sys/power/resume_offset test steps. Two substantive problems. (1) For a SEPARATE encrypted swap partition, reordering the hooks is NOT enough. dm-crypt/Swap encryption is explicit: 'If the swap device is on a different device from that of the root file system, it will not be opened by the encrypt hook' and 'the encrypt hook ... can only unlock a single device'. A user who follows step 2's cryptdevice=UUID=...:cryptroot ... resume=/dev/mapper/cryptswap plus step 3's hook reorder will still land in a fresh boot, because /dev/mapper/cryptswap never exists in early userspace. (2) The record never mentions that Omarchy already ships the whole procedure: bin/omarchy-hibernation-setup (omarchy hibernation setup) creates /swap/swapfile on the encrypted Btrfs root, adds it to fstab, writes HOOKS+=(resume) to /etc/mkinitcpio.conf.d/omarchy_resume.conf, computes resume=/resume_offset= into /etc/limine-entry-tool.d/resume.conf, and rebuilds. Also, sudo limine-update followed by sudo limine-mkinitcpio is redundant. Upstream's own comment in that script says limine-mkinitcpio 'rebuilds initramfs/UKI for all kernels and updates the /boot/limine.conf entries', and limine-update 'would also re-deploy the binary and rebuild a second time'.
Editing HOOKS is how people make a machine unbootable. If you drop or misplace encrypt/sd-encrypt, the initramfs cannot unlock root and you get an emergency shell with no way in. Have an Arch/Omarchy live USB ready before you rebuild, and note that Omarchy's Limine snapshot entries do not help here because the initramfs/UKI is outside the snapshot. Removing a /etc/crypttab swap line without also removing or fixing the matching /etc/fstab entry leaves a failing swap unit that can block boot. Reformatting a partition that was previously a LUKS container to use as plain swap destroys whatever was on it.
Symptom
Full-disk-encrypted laptop. systemctl hibernate writes the image and powers off properly, but on the next boot I type the LUKS passphrase and land in a brand-new session. Everything is gone. Sometimes the initramfs prints ERROR: resume: hibernation device '/dev/nvme0n1p3' not found or hangs on Waiting 10 seconds for device /dev/mapper/cryptswap ... and then boots normally anyway.
Cause
Three separate mistakes, all of which produce the same silent 'fresh boot' result. (a) resume= points at the raw LUKS partition. That partition contains ciphertext and has no swap header, so the kernel finds no hibernation image. resume= must name the *decrypted* device-mapper node. (b) With the busybox encrypt hook, the resume hook runs before the container is unlocked. The Arch wiki is explicit: when swap sits on stacked storage (dm-crypt, LVM, RAID) the resume hook must be placed *after* encrypt/lvm2, and after udev. (c) The swap device is set up in /etc/crypttab with the swap option, i.e. re-encrypted with a random key from /dev/urandom on every boot. That deliberately makes suspend-to-disk impossible: the key that encrypted the image was thrown away at shutdown.
Fix
Add before step 1, for Omarchy:
**0. On Omarchy, do not hand-roll this.** The supported path handles the encrypted-root case end to end:
omarchy hibernation setup # bin/omarchy-hibernation-setup
It creates /swap/swapfile on the encrypted Btrfs root, adds it to /etc/fstab, writes HOOKS+=(resume) to /etc/mkinitcpio.conf.d/omarchy_resume.conf, computes resume=/resume_offset= into /etc/limine-entry-tool.d/resume.conf (and /etc/default/limine), and runs limine-mkinitcpio. Undo with omarchy hibernation remove. Read the rest of this record only if that fails or you are on plain Arch.
Rewrite step 3 to add the missing constraint:
**3b. A separate encrypted swap partition needs to be UNLOCKED in the initramfs, not just ordered.** The busybox encrypt hook unlocks exactly one device (the one named by cryptdevice=), so resume=/dev/mapper/cryptswap refers to a node that does not exist yet no matter where you put resume. Pick one:
- **Preferred:** switch to the systemd initramfs and list both containers, then drop
resumeentirely:
/etc/crypttab.initramfs
cryptroot UUID=<root-luks-uuid> none
cryptswap UUID=<swap-luks-uuid> none
HOOKS=(base systemd autodetect microcode modconf kms keyboard sd-vconsole block sd-encrypt lvm2 filesystems fsck)
- Or put swap inside the *same* LUKS container (LVM logical volume, or a swapfile on the encrypted root. The swapfile variant in step 2 is the one that works with the plain
encrypthook). - Or install
mkinitcpio-openswap(AUR) / write anopenswaphook that runscryptsetup openbeforeresume.
And in step 4, drop sudo limine-update, because sudo limine-mkinitcpio alone rebuilds the initramfs/UKI for every kernel and regenerates the Limine entries. Running both does the work twice.
Verify
After reboot, cat /sys/power/resume must print a non-zero major:minor matching the mapper device from lsblk -o NAME,MAJ:MIN, and cat /sys/power/resume_offset must match your swapfile offset. Hibernate, power on, and check sudo journalctl -b -k | grep -i 'PM: Image'. A real resume logs PM: Image loading progress / PM: Image loading done. grep -h '^HOOKS' /etc/mkinitcpio.conf /etc/mkinitcpio.conf.d/*.conf should show resume after encrypt.
Sources
- https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate
- https://wiki.archlinux.org/title/Dm-crypt/System_configuration
- https://wiki.archlinux.org/title/Dm-crypt/Swap_encryption
- https://wiki.archlinux.org/title/Limine
- https://raw.githubusercontent.com/basecamp/omarchy/master/default/limine/default.conf