Skip to main content
Topic: Enable hibernate guide (Read 971 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Enable hibernate guide

I succesfully use artix runit KDE on a laptop. Sleep suspend and resume work correctly. Hibernation also seems to work but actually the system just shuts down. I would like to properly enable hibernate to the swap file but after reading
https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Hibernation
and
https://wiki.archlinux.org/title/Kernel_parameters#GRUB
I start to panic.
I would appreciate a guide in the wiki for first-timers.
Code: [Select]
x360:[root]:/home/art# cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=68abdd14-9ad9-4009-a96c-60d12937c089 rw net.ifnames=0 quiet

x360:[root]:/home/art# filefrag -v /swapfile
Filesystem type is: ef53
File size of /swapfile is 8589934592 (2097152 blocks of 4096 bytes)
 ext:     logical_offset:        physical_offset: length:   expected: flags:
   0:        0..  221183:     303104..    524287: 221184:           
   1:   221184..  483327:     557056..    819199: 262144:     524288:
   2:   483328..  546815:     821248..    884735:  63488:     819200:
   3:   546816..  708607:     886784..   1048575: 161792:     884736:
   4:   708608.. 1200127:    1081344..   1572863: 491520:    1048576:
   5:  1200128.. 1689599:    1607680..   2097151: 489472:    1572864:
   6:  1689600.. 2097151:    2129920..   2537471: 407552:    2097152: last,eof
/swapfile: 7 extents found
Operating System: Artix Linux x86_64

Re: Enable hibernate guide

Reply #1
Where's resume= and resume_offset= on your kernel command line? Did you edit /etc/default/gruband run update-grub?

Re: Enable hibernate guide

Reply #2
Where's resume= and resume_offset= on your kernel command line? Did you edit /etc/default/gruband run update-grub?
I have never altered it. Just read the guides, took a look into the files mentioned there, but made no changes to them. Just posted them above to illustrate what I have learnt so far and where is my starting point. I realize this sounds helpless, but currently I will not be able to sort things out if I made any mistake along the steps I hardly understand.... :o
Operating System: Artix Linux x86_64

Re: Enable hibernate guide

Reply #3
Please beware that the instruction below may be no longer up-to-date. Also when updating /boot/grub/grub.cfg  (step 4 below)
Code: [Select]
# update-grub

may be required.

However, you spurred my ambition... I selected for testing my obsolete disk of smaller capacity that still kept the system before cloning. The whole process is simple but not very friendly. It can be summarized as follows:
  • Add a resume runtime hook to the /etc/mkinitcpio.conf, ex.
    Code: [Select]
    HOOKS=(base udev autodetect keyboard modconf block filesystems resume fsck)
  • Regenerate manually  the initramfs
    Code: [Select]
    # mkinitcpio -P
    Warnings of missing firmware were interesting, but did not matter for now.

  • Add a resume  kernel parameter (additional arguments to the Linux image) to the etc/default/grub file,
    ex.
    Code: [Select]
    GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=56a369ef-06a0-49fe-bf8b-acb1165f615d resume_offset=3850240 quiet"
    Nb. do not edit the  GRUB_CMDLINE_LINUX value
  • "Populate" new arguments from the /etc/default/grub file to the /boot/grub/grub.cfg with a single command regenerating the latter:
    Code: [Select]
    # grub-mkconfig -o /boot/grub/grub.cfg
  • Reboot
  • If curious recheck your new kernel command line parameters:
    Code: [Select]
    # cat /proc/cmdline
    BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=56a369ef-06a0-49fe-bf8b-acb1165f615d rw net.ifnames=0 resume=UUID=56a369ef-06a0-49fe-bf8b-acb1165f615d resume_offset=3850240 quiet
  • Hibernate, ex. from your DE.

Please correct the above if I erred or ommited anything. In my case from Plasma to hibernate and back after resume I was taken to the lock-screen.
I would also appreciate if anyone elaborated the above on what point and how to run # update-grub.
Operating System: Artix Linux x86_64