Hibernation Into Swapfile

I’ve been having some trouble getting hibernation to work on manjaro. I’ve recently also encrypted my whole device that adds a whole level more complication.

I’ve followed the guide here using a swapfile:

https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Hibernation

However, I am finding that there are issues in configuring the kernel parameters. I can set up the parameters just fine, but every time I go to restart the device there’s an error with no resume device specified. Checking the kernel params I see this:

cat /sys/power/resume
0:0

cat /sys/power/resume_offset 
0

Is there a way to keep the kernel params consistent? And does the fact I have the swapfile on my LUKS encrypted root partition make things any different?

Thanks

I do not understand what you mean by that.

Not that I know of.

What needs to be edited is /etc/default/grub

For reference, here is what the relevant lines looks like for my setup:

GRUB_CMDLINE_LINUX_DEFAULT="mitigations=off audit=0 resume=/dev/disk/by-uuid/57ce341b-6aae-4fb0-a607-1a5d5967c7a2 resume_offset=220889088"

and

GRUB_CMDLINE_LINUX="cryptdevice=UUID=73213ab9-5c8c-4c2a-a397-aa321ebfd4ec:cryptroot nowatchdog ro"

the resume=... is the encrypted partition which contains the swap file
the resume_offset=... is the physical location on disk -
the wiki explains how to find that value that needs to be there
it is different for each one of us

This part of the wiki explains it (filefrag)

Power management/Suspend and hibernate - ArchWiki

Thanks I’ve edited what I can, the only piece of information I can’t get hold of now is the cryptdevice UUID. I’ve noticed these differ depending on whether the LUKS device is locked or unlocked. Judging by the differing UUID entries here:

GRUB_CMDLINE_LINUX_DEFAULT="... resume=/dev/disk/by-uuid/57ce341b-6aae-4fb0-a607-1a5d5967c7a2 resume_offset=220889088"

and

GRUB_CMDLINE_LINUX="cryptdevice=UUID=73213ab9-5c8c-4c2a-a397-aa321ebfd4ec:cryptroot nowatchdog ro"

I’d assume the second UUID specifies the encrypted drive. The only way I know how to get hold of this is by booting through a live usb and inspecting the encrypted root partition. Would you know of an easier way to access it?

lsblk -f

lsblk -f
NAME          FSTYPE      FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda                                                                                       
├─sda1        vfat        FAT32       84B9-0375                             331,7M    57% /boot
└─sda2        crypto_LUKS 2           73213ab9-5c8c-4c2a-a397-aa321ebfd4ec                
  └─cryptroot ext4        1.0         57ce341b-6aae-4fb0-a607-1a5d5967c7a2  670,7G    26% /

sda2 is the container - what you are looking for - the cryptdevice
it contains the “cryptroot” - the name by which I refer to the encrypted ext4 filesystem it contains

there are the two numbers you need

It has been some time since I set this up, but:
in /etc/default/grub

GRUB_CMDLINE_LINUX=

or

GRUB_CMDLINE_LINUX_DEFAULT=

should already contain this.
You do have an encrypted system, do you not?

I did not use Calamares to create this setup.
It is, as you see, an encrypted / and an unencrypted /boot

Manjaro (the Calamares installer) encrypts the whole /
with no option of having /boot unencrypted.

So I’ve covered what you’ve suggested but when I restart from hibernate I’m hit with

Error: resume: no resume device specified for hibernation

And for reference the relevant outputs and files:

lsblk -f
NAME                    FSTYPE      FSVER LABEL      UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
nvme0n1                                                                                                                
├─nvme0n1p1             vfat        FAT32 ESP        DE0D-CC70                             588.1M    13% /boot/efi                                     
├─nvme0n1p2             crypto_LUKS 1                8a642ee6-37cd-43f6-b264-c70d8f3b6c30                
│ └─luks-8a642ee6-37cd-43f6-b264-c70d8f3b6c30
│                       ext4        1.0              6af44687-1015-45de-bf56-5e167a7dee23   36.9G    64% /
cat /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="quiet cryptdevice=UUID=8a642ee6-37cd-43f6-b264-c70d8f3b6c30:luks-8a642ee6-37cd-43f6-b264-c70d8f3b6c30 root=/dev/mapper/luks-8a642ee6-37cd-43f6-b264-c70d8f3b6c30 apparmor=1 security=apparmor udev.log_priority=3 resume=/dev/disk/by-uuid/6af44687-1015-45de-bf56-5e167a7dee23 resume_offset=17969152"

GRUB_CMDLINE_LINUX=""

And I’d taken the resume_offset from filefrag.

Is there anythng else I’m missing?

And yes I do have an encrypted system. I’d installed this via the live USB installer (calamares?)

I chose to delete most of my post and replaced it with this because I more than likely was talking bs … :wink:

The many unwieldy numbers got me confused and I was misreading the strangely formatted lsblk -f output.

update-grub was run after editing /etc/default/grub ?
/etc/mkinitcpio contains the resume HOOK ?

dm-crypt/Encrypting an entire system - ArchWiki

Take a breath, read again and start over? :wink:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.