Skip to content

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.

2 points5 comments
Open on Reddit
About this post
Posted
Archived
Score
2 · 100% up
Kind
Text
ID
ftak2a

Author

3
posts
22
comments
1
media
View profile

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

3 points

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

1 points

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!

1 points

swap_file_offset is not the correct name for the kernel command line option, try resume_offset instead. You probably copied the wrong part of the line in the kernel documentation by accident :)

3 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.