Wanted to share the problems and solutions I found when trying to get hibernation to work on a fresh install on my laptop.
My goal was to do a fresh install (manjaro-kde-25.0.6-250730-linux612.iso) with BTRFS, full disk encryption and hibernation with swapfile using the standard graphical installer.
I thought this would work out of the box, but after installing there is no hibernation option in the GUI. This seems to be because the automatically generated swapfile is only 500MB, and my laptop has 8GB of RAM. I was unable to find an option to change the swapfile size during installation.
At this point I had to remove the swapfile and add a new one that is at least 8GB in size. I googled around and found these relevant wiki entries:
https://wiki.archlinux.org/title/Btrfs#Swap_file
https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Hibernation
I then ran the following:
# Delete old swapfile
sudo swapoff /swap/swapfile
sudo rm /swap/swapfile
# Make new swapfile
btrfs filesystem mkswapfile --size 16g --uuid clear /swap/swapfile
swapon /swap/swapfile
This swapfile is already in /etc/fstab with the same location, so I didnāt edit that file, but I looked at it to find the block device for the partition:
/dev/mapper/luks-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
I ran this command to find the swap file offset:
btrfs inspect-internal map-swapfile -r /swap/swapfile
# 2106624
I added the resume and resume_offset kernel parameters by appending to /etc/default/grub in GRUB_CMDLINE_LINUX_DEFAULT like so:
GRUB_CMDLINE_LINUX_DEFAULT='quiet cryptdevice=UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:luks-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx root=/dev/mapper/luks-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx splash udev.log_priority=3 resume=/dev/mapper/luks-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx resume_offset=2106624'
and executed sudo grub-mkconfig -o /boot/grub/grub.cfg.
At this point I thought I was done, and tried rebooting. I could see from free and htop that the new swap was recognized, but when I tried to run systemctl hibernate Iād get this error:
Call to Hibernate failed: Invalid resume config: resume= is not populated yet resume_offset= is
Moreover, the āhibernateā button appeared in the KDE application menu but wouldnāt do anything.
I tried googling and searching on this forum but I couldnāt find much relevant to this specific error. After a while I realized I had to configure the initramfs by adding the āresumeā hook to /etc/mkinitcpio.conf and then regenerating the initramfs by executing:
sudo mkinitcpio -P
At this point, after a reboot, hibernation works! Iām not sure why the resume hook was not present already, since I was able to see the āhibernateā option in the GUIā¦
Iām sharing this here in case anyone else runs into the same issue as me.
Moreover, Iād like to ask if there really is no option to specify swapfile size during installation, or perhaps I missed it. I used the āerase diskā option with automatic partitioning.