You are not logged in.

#1 2023-08-10 15:00:07

cloverskull
Member
Registered: 2018-09-30
Posts: 181

Hibernate help - systemd-boot, systemd initramfs, luks->ext4->swapfile

Hey friends,

I've been trying in vain to get hibernate to work. I've followed the wiki and have done so several times, each with the same results.

Expected behavior: run systemctl hibernate. System hibernates as expected. Upon powering back up, system resumes to pre-hibernation state successfully.

Observed behavior: run systemctl hibernate. System hibernates as expected (as far as I can tell, anyway). Upon powering back up, system fails to restore to pre-hibernation state, instead boots as normal.

I've been struggling to get the swapfile on encryption thing to work for a while now. I've tried on btrfs and did not have any luck, so I switched to my other laptop with ext4 (thought process being this could help with the filesystem as part of the diagnosis). Alas, same problem exists here.

Both laptops have an intel iGPU and NVidia dGPU. Both systems use the Arch linux, linux-headers packages. Both systems also use nvidia-dkms.

Relevant journalctl logs:

Aug 09 21:28:25 archlinux kernel: 
Aug 09 21:28:33 archlinux kernel: Hibernate inconsistent memory map detected!
Aug 09 21:28:33 archlinux kernel: PM: hibernation: Image mismatch: architecture specific data
Aug 09 21:28:33 archlinux kernel: PM: hibernation: Failed to load image, recovering.

Here's my systemd-boot config:

options rd.luks.name=32171e03-7713-46d6-bd40-32ab86f553dd=root root=/dev/mapper/root ro resume=UUID=32171e03-7713-46d6-bd40-32ab86f553dd resume_offset=336154624 mitigations=off nowatchdog modprobe.blacklist=iTCO_wdt i915.enable_guc=3 nvidia-drm.modeset=1

And my mkinitcpio.conf:

MODULES=(i915 intel_agp nvidia nvidia_modeset nvidia_uvm nvidia_drm)
HOOKS=(base systemd autodetect modconf kms keyboard sd-vconsole block sd-encrypt filesystems)

And the swapfile offset:

❯ sudo filefrag -v /swapfile | awk '$1=="0:" {print substr($4, 1, length($4)-2)}'
336154624

Note that the UUID for the root partition and resume are the same; they're both in /dev/mapper/root once the luks volume has been decrypted.

Edit - some additional details:

~                                                                                                 08:15:19 AM
❯ lsblk --all --noheadings --output "NAME,MAJ:MIN" --raw /dev/mapper/root 
root 254:0

~                                                                                                 08:18:45 AM
❯ cat /sys/power/resume
254:0

~                                                                                                 08:20:15 AM
❯ cat /sys/power/resume_offset 
336154624

Does anyone here actually have a similar setup with this working that could just share their boot config? I suspect something's off in there.

Cheers and thanks!

Last edited by cloverskull (2023-08-10 15:21:36)

Offline

#2 2023-08-10 17:42:08

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: Hibernate help - systemd-boot, systemd initramfs, luks->ext4->swapfile

=> resume=/dev/mapper/root

Offline

#3 2023-08-10 21:33:55

cloverskull
Member
Registered: 2018-09-30
Posts: 181

Re: Hibernate help - systemd-boot, systemd initramfs, luks->ext4->swapfile

Thanks. Gave that a whirl with the same result. hmm

Offline

#4 2023-08-23 18:39:31

Project579
Member
Registered: 2023-08-16
Posts: 4

Re: Hibernate help - systemd-boot, systemd initramfs, luks->ext4->swapfile

The resume from a swap file cannot be initiated from an initrd or initramfs, you must use a partition for that.

More info:
https://www.kernel.org/doc/html/latest/ … wsusp.html
https://www.kernel.org/doc/html/latest/ … files.html

Offline

#5 2023-08-24 02:07:43

cloverskull
Member
Registered: 2018-09-30
Posts: 181

Re: Hibernate help - systemd-boot, systemd initramfs, luks->ext4->swapfile

Yep - both of those links spell out exactly how I was trying to resume from a swapfile which, according to those links, is supported smile

Offline

Board footer

Powered by FluxBB