How enable hibernation swapfile on luks root?

I want to enable hibernation swapfile for luks ext4 partition
I went according to this site but it didn’t work

https://confluence.jaytaala.com/display/TKB/Use+a+swap+file+and+enable+hibernation+on+Arch+Linux+-+including+on+a+LUKS+root+partition

Without providing exact info on what you did step-by-step, all anyone can say is:
YOU DID SOMETHING WRONG…
:woman_shrugging:

No need to point at the tutorial, you need to provide info from YOUR OWN SYSTEM for anyone here to be able to assist you…


The swapfile is created without any problems and works
My only problem is activating it for hibernation

You need to add the resume hook to mkinitcpio (this is Arch/Manjaro specific) and set the resume and resume_offset parameters for your kernel via your bootloader.

Also please primarily use the Manjaro and Arch wikis, they address all your questions.

For some reason I can’t post links to the arch-wiki but there are topics for

  1. hibernation support
  2. setting kernel parameters via your boot loader
  3. using swap encryption with dm-crypt/luks
1 Like

Unfortunately, I searched the forum, the explanation was not complete in this case, it was only available for btrfs encryption not for luks ext4
Wiki Find is only mentioned, not fully explained
Someone please explain and end it forever

Follow the arch wiki about swap and hibernation.

There is no difference if you use LUKS or not.

Archlinux or manjaro wiki?

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

1 Like

I got this amount of these two lines and added it to etc/default/grub and updated grub but it still didn’t work

resume=UUID=swap_device_uuid resume_offset=swap_file_offset

If you don’t provide logs or more info, there’s nothing to go on.

Everything you need to now is in the linked wiki page. If it doesn’t work, tell us what you actually did and what exactly doesnt work.

1:

findmnt -no UUID -T /swapfile

2:

filefrag -v /swapfile | awk ‘$1==“0:” {print substr($4, 1, length($4)-2)}’

resume=UUID=value1 resume_offset=value2

I obtained the values ​​with the following two commands and then added them to etc/default/grub and update grub

What does cat /proc/cmdline print?

Do you have the resume hook?

1 Like

No,I didn’t
How should it be done?

I’ll not link the arch wiki again. Please look there and come back of you have problems with the manual.

Look for the mkinitcpio.conf instructions.

Voila Power management/Suspend and hibernate - ArchWiki

1 Like

For me mkinitcpio.conf it’s a “” change to ()
HOOKS=“”
HOOKS=()

It can’t be empty. You have to add resume to this array.

1 Like

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