5

So I'm trying to hibernate my Ubuntu laptop, using sudo systemctl hibernate, in turn it says "Failed to hibernate system via logind: Not enough swap space for hibernation".

I already tried this before, so before using hibernate, I set up different swapfiles to accomodate the RAM my laptop has (8G), overall my total swap space (from free -h) is total used free shared buff/cache Mem: 7.7Gi 2.7Gi 4.4Gi 135Mi 741Mi
Swap: 16Gi 1.4Gi 14Gi

So is there any difference between swapfiles and swap partitions? Is there any more settings I can do to properly hibernate?

As a side note, I tried installing pm-utils and use pm-hibernate, the system hangs for a moment, the screen turns off, but then it would turn back on and resume as normal, (probably because also of the lacking swap space).

Is there a step I forgot or whatever?

EDIT: Related screenshot, enter image description here

DepChemical
  • 61
  • 2
  • 4

1 Answers1

2

Hibernation requires swap space on a separate partition. Although it also can work on a swap file, the swap file must be contiguous and the offsets indicating the physical location of the file must be specified, so setup is more complex.

If you want to try hibernation, create a swap partition first. The size of the swap partition should be at least the size of your computer RAM: hibernation involves that all content of RAM is written out to SWAP space before the system shuts down; on restart, the contents os read again from the SWAP space into RAM.

Be aware that hibernation may not work properly on your computer, even if you have set up proper SWAP space. This is because computer manufacturers tend not to document how they implemented power management. As a result, hibernate does not work well on quite a lot of hardware.

vanadium
  • 97,564