Artix Linux Forum

Artix Linux => System => Topic started by: kiblaster on 14 February 2023, 17:33:30

Title: Hibernate with a swap file [SOLVED]
Post by: kiblaster on 14 February 2023, 17:33:30
I followed this guide (https://confluence.jaytaala.com/display/TKB/Use+a+swap+file+and+enable+hibernation+on+Arch+Linux+-+including+on+a+LUKS+root+partition) but it didn't work.

Code: [Select]
filefrag -v /swapfile | awk 'NR==4 {print $4}' | tr -d .
15820800

I put that on /etc/default/grub  and I ran "grub-mkconfig -o /boot/grub/grub.cfg".

How can you hibernate?
I used loginctl command. After it booted as after a normal shutdown.
I didn't see the pm-utils package.

I use dinit.
Title: Re: Hibernate with a swap file
Post by: nous on 15 February 2023, 14:25:16
I do the same without issue, and it's init-independent. You need:
Title: Re: Hibernate with a swap file
Post by: kiblaster on 15 February 2023, 18:41:40
I copied the resume hook position from another Artix device with lvm on luks and a swap partition.
As the Artix guide states https://wiki.artixlinux.org/Main/InstallationWithFullDiskEncryption.
There it works:
Code: [Select]
HOOKS=(base udev autodetect modconf kms keyboard keymap consolefont encrypt resume block filesystems fsck)

I tried this following the Arch wiki (https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Configure_the_initramfs) before seeing the answer and it works for the swap file:
Code: [Select]
HOOKS="base udev autodetect modconf block keyboard keymap consolefont encrypt filesystems resume fsck"
(And I set the offset in grub config)

Is it better to place it after udev then?
With that (after encrypt) I can't use "loginctl hibernate", nothing happens and no error.
But I can hibernate with "echo disk > /sys/power/state".
Title: Re: Hibernate with a swap file
Post by: nous on 15 February 2023, 21:45:34
Is it better to place it after udev then?
Since hook order is important, I'd say yes.
Title: Re: Hibernate with a swap file [SOLVED]
Post by: kiblaster on 16 February 2023, 16:07:54
I tried it since I have encryption it couldn't find the swap file because it wasn't unlocked yet.
This one so:
Code: [Select]
HOOKS="base udev autodetect modconf block keyboard keymap consolefont encrypt filesystems resume fsck"