Cannot get hibernation with swapfile working, Not enough swap space for hibernation
I recently installed arch on my laptop, I switched from arch to solus for a little bit, but I cannot get hibernating to a swapfile to work again.
I have run though https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate#Hibernation
I searched here on reddit and a similar post was https://www.reddit.com/r/archlinux/comments/ekfa6t/zfs_on_root_hibernate_system_failed_via_logind/ but there were no comments on that post
free -h
total used free shared buff/cache available
Mem: 13Gi 1.2Gi 11Gi 197Mi 880Mi 11Gi
Swap: 8.0Gi 0B 8.0Gi
cat /etc/fstab
# /dev/nvme0n1p2
UUID=c4bb6096-86ce-4cd9-98ce-dd0a2d69a02c / ext4 rw,relatime 0 1
/swapfile none swap sw,pri=100 0 0
findmnt -no SOURCE -T /swapfile
/dev/nvme0n1p2
sudo filefrag -v /swapfile | awk '{ if($1=="0:"){print $4} }'
1918976..
swapon -s
Filename Type Size Used Priority
/swapfile file 8388604 0 100
Kernel parameter from /etc/default/grub
GRUB_CMDLINE_LINUX="resume=/dev/nvme0n1p2 swap_file_offset=1918976"
I have of course ran
sudo grub-mkconfig -o /boot/grub/grub.cfg
and I've also tried re running mkinitcpio, I am running just linux not linux-lts
sudo mkinitcpio -p linux
and then remade the grub config
journalctl | grep -i hibernation
Mar 29 19:57:00 thinkpad kernel: PM: hibernation entry
Mar 29 20:12:55 thinkpad kernel: PM: hibernation entry
Mar 29 20:14:47 thinkpad budgie-panel[825]: UserIndicatorWindow.vala:289: Cannot hibernate: GDBus.Error:org.freedesktop.login1.SleepVerbNotSupported: Not enough swap space for hibernation
I don't know what I could've done wrong, hopefully someone here can point me in the right direction.
About this post
- Posted
- Archived
- Score
- 2 · 100% up
- Kind
- Text
- ID
- ftak2a
5 comments
Ceck your
/sys/power/image_size, it's likely > 8GB. Increase it to the size of the your RAM and/or adjust the size of your swapfile accordingly and try again.While it normally should work with a smaller swapfile, this way you can rule out errors that occur while shrinking the image size:
https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate#About_swap_partition/file_size
Edit: How did you create the swapfile and what are It's permissions? Maybe try creating a new file as per instructions in the Wiki: https://wiki.archlinux.org/index.php/Swap#Swap_file
I created by fallocate -l 8g /swapfile I then chmod 600 to it I'll try recreating it tomorrow along with following the first link
I removed the swapfile by swapoff then rm
I created a new one using fallocate, then chmod, then mkswap, finally swapon.
I updated the swapfile offset in my grub parameters, re ran mkinitcpio (I don't know if this is necessary but I did it anyways) finally I build my new grub config.
my image_size is 5815803904, which equates to <5G.
Still doesn't work.
The last time I got this to work I was lazy and installed arch via the archfi script, but thanks to being cooped up I decided to install vanilla this time. I don't know if the script does anything special.
Thanks for looking into though!
swap_file_offsetis not the correct name for the kernel command line option, tryresume_offsetinstead. You probably copied the wrong part of the line in the kernel documentation by accident :)That worked, of course it was a typo