[Solved] Hibernate doesn't work

Hello everyone :slight_smile:

I currently try to get hibernate to work with my system. I use ext4 root and home each on a separate LUKS encrypted partition. I boot with systemd boot and have a swapfile with 64G that’s added to my /etc/fstab. I added resume and resume_offset to the cmdline, reinstalled the kernels and rebuilt dracut.

Now I’m wondering

  1. why systemctl hibernate returns
    Call to Hibernate failed: No such file or directory
  2. why the hibernate option isn’t showing up in the kde menu

Hello @Numerfolt ,
I think I have a similar test system. RAM size is 16G with me.

  sudo fallocate -l 13G /swapfile 
  sudo chmod 600 /swapfile
  sudo mkswap /swapfile
  sudo swapon /swapfile
  echo '/swapfile none swap defaults 0 0' | sudo tee -a /etc/fstab
  sudo filefrag -v /swapfile | awk '{if($1=="0:"){print $4}}' | sed 's/\.\.//g'

after reboot the UUID has changed with me. So
findmnt -no UUID -T /swapfile
gave the final UUID and
sudo filefrag -v /swapfile | awk '{if($1=="0:") print $4}'
showed the resume_offset
these two were added to (in my case)
/efi/loader/entries/e2b14c1100c74e55bc2e58c607a6a3c2-7.0.3-arch1-2.conf
at the end of the options

options    nvme_load=YES nowatchdog rw rd.luks.uuid=09a120b9-1d3b-41de-bd88-3c99bbb04bf8 root=/dev/mapper/luks-09a120b9-1d3b-41de-bd88-3c99bbb04bf8 systemd.machine_id=e2b14c1100c74e55bc2e58c607a6a3c2 resume=UUID=74f0d36f-c757-431d-9327-78ae922bf07a resume_offset=600064

  echo 'add_dracutmodules+=" resume "' | sudo tee /etc/dracut.conf.d/resume.conf
  sudo dracut -f

If the explanations are missing try this to google
endeavouros hibernate with swapfile

re 2 It will show up in case you make all steps correctly.

Hi @eso thanks for taking the time to answer here!

I managed to get it to work :partying_face:

I think my problem was, that the swapfile wasn’t on the root partition, but on the home partition.

I created a new swapfile at /swapfile, just as you recommended.
Then I only needed to add the resume module to dracut and rebuild the initramfs.

So basically I just did these things and it worked:

sudo mkswap -U clear --size 64G --file /swapfile
sudo swapon /swapfile
echo '/swapfile none swap defaults 0 0' | sudo tee -a /etc/fstab
echo 'add_dracutmodules+=" resume "' | sudo tee /etc/dracut.conf.d/resume.conf
sudo dracut -f --regenerate-all

And you were right, after I correctly set up hibernation, the entry appeared in the kde application menu :slight_smile:

For anybody else with the same problem in the future, this is actually outlined in the dm-crypt Arch wiki page: