Sleep error

xfce

#1

Every time I close my laptop and turn it on, give me the mistake.

  • GDBus.Error:org.freedesktop.login1.sleepVerbNotSupported:Not enough swap space for hibernation

What should I do?


#2

Make sure the swap is big enough …
what is the output of:
lsblk -pf


#3


#4

You don’t have a swap partition at all, from what i gather from your screenshot (by the way, you could have copied the text and paste it here using ``` above and bellow that text, to keep the formatting).

The easiest way for you is to make use of a swapfile


#5

I add swapfile according to swapfile.

But every time the computer sleeps, it shuts down directly.

My computer has 16G of memory, I give swapfile 6G memory.


#6

You have to add it to /etc/fstab file if you didn’t already:
/swapfile swap swap defaults 0 0

Then you have to find it’s offset by this command:
sudo filefrag -v /swapfile

and you will get something like this

image

Then you edit /etc/default/grub and on the GRUB_CMDLINE_LINUX_DEFAULT line you add:
resume=UUID=the-uuid-of-your-root-partition resume_offset=the-offset-number

After that you check or modify /etc/mkinitcpio.conf so the HOOKS have the resume to it.
Example:
HOOKS=(base udev resume autodetect modconf block keyboard filesystems fsck)

The last you run this:
sudo mkinitcpio -P
sudo update-grub
Reboot and all should be fine.


#7

Can you give me a revised version of the /etc/default/grub?
the GRUB_CMDLINE_LINUX_DEFAULT line of mine is:
GRUB_CMDLINE_LINUX_DEFAULT=“quiet”,
I don’t know how to modify it.


#8

Then you should have that line like this:

GRUB_CMDLINE_LINUX_DEFAULT="quiet resume=UUID=the-uuid-of-your-root-partition resume_offset=the-offset-number"

remember to replace with the correct UUID of your root partition (you find it in fstab) and the offset of the swapfile.


#9

in my fstab ,I get two line:
UUID=7CE0-5F91 /boot/efi vfat defaults, noatime 0 2
UUID=c6b38ff0-108c-4654-97d6-7ee4bf5a7101 / ext4 defaults, noatime 0 1

I change my /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="quiet resume=UUID=c6b38ff0-108c-4654-97d6-7ee4bf5a7101 resume_offset=8185856"

Then follow the steps to set it up.

There’s another UUID.
mkswap /swapfile will show a UUID
UUID=9631e4ea-…

I try three UUID
it’s doesn’t use.


#10

What do you mean?
Have you added swap file to fstab?


#12

I did it step by step. I didn’t review every step.


#13

And that’s your mistake.
Check it yourself:
cat /sys/power/image_size
I’m almost sure it will show something above 6 Gb.
Now goto https://wiki.archlinux.org/index.php/Swap#Swap_file and create a new swap file of proper size, at least 7 Gb.


#14

Which steps?
Is it difficult to check fstab and answer the question? :confounded:

Nevertheless, the error message suggests you need a larger swap file.


#15

yes, I add swapfile according to swapfile.


#16

How large is the swapfile you created?

For a computer with 16GB RAM you need a swapfile of at least 16GB.

If it’s the same as you said before,

then the issue is as the error message explicitly states:


#17

cat /sys/power/image_size

6672769024


#18

You see.


#19

this time, I get /swapfile 16G,but when i sleep ,it also shuts down directly.


#20

from terminal, what you get by:
cat /sys/power/mem_sleep
?


#21

first:
I add swapfile according to swapfile.
and get /swapfile 16G

next:

sudo filefrag -v /swapfile
File size of /swapfile is 17179869184 (4194304 blocks of 4096 bytes)
 ext:     logical_offset:        physical_offset: length:   expected: flags:
          0:                      1..                      0:                 356352..               356352:                 1:            

next:
edit /etc/default/grub and on the GRUB_CMDLINE_LINUX_DEFAULT line

GRUB_CMDLINE_LINUX_DEFAULT="quiet resume=UUID=7CE0-5F91 resume_offset=356352"

edit * /etc/mkinitcpio.conf*

HOOKS=(base udev resume autodetect modconf block keyboard filesystems fsck)

last:
run this:
sudo mkinitcpio -P
sudo update-grub

but when i sleep ,it also shuts down directly.