Skip to main content
Topic: Hibernate with a swap file [SOLVED] (Read 650 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Hibernate with a swap file [SOLVED]

I followed this guide 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.

Re: Hibernate with a swap file

Reply #1
I do the same without issue, and it's init-independent. You need:
  • The resume hook in /etc/mkinitcpio.conf:
    Code: [Select]
    HOOKS=(consolefont base udev resume autodetect modconf block filesystems keyboard fsck)
  • The resume_offset in grub.cfg
    Code: [Select]
    resume_offset=15820800

Re: Hibernate with a swap file

Reply #2
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 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".


 

Re: Hibernate with a swap file [SOLVED]

Reply #4
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"