Hibernation in Fedora 32

Dear all, I am a Fedora newbie, just installed on my laptop few days ago.
I followed the tutorial on how to enable hibernation from the official fedora documentation, however when I test it by typing as root:

systemctl hibernate

I get:

Failed to hibernate system via logind: Not enough swap space for hibernation

However, if I do:

echo disk > /sys/power/state

Hibernation works flawlessly, in the sense that the computer turns off, and then when I boot up the system again I am at the exact point when I launched the command.

Thank you for your help!

Hello,

can you post the output of the free command?
So we see something like

$ free 
                      total        used        free      shared  buff/cache   available
        Mem:        3942392     1587724      234904      107708     2119764     1998960
        Swap:       9351164        1024     9350140

[root@linux simone]# free
total used free shared buff/cache available
Mem: 16103324 2319604 11002692 1353844 2781028 12112304
Swap: 16383996 0 16383996

Here it is, actually, I have 16GB of ram and as you can see the swap is around 16GB.
P.S: I am hibernating in a swapfile

Hi,

Great to see you are running Fedora.
What exactly is the issue? Is it that it doesn’t work for root? I just tried it as root. It worked!
Although I am running Rawhide … but I bet F32 should be having similar versions. Have you updated your Fedora recently? I mean a complete update. Try it

Which tutorial? I’m interest as well.

Dear twohot, thank you for your reply. I just run an update, also the kernel updated. However the problem persists, as you can see in my first post, the hibernation works using the command disk, so the configuration is correct. The problem is that I cannot hibernate with systemd since I get the error that there is not enough space, and I need systemd hibernation.

I followed this tutorial: https://openterprise.it/2019/09/enable-hibernation-on-fedora-linux/#:~:text=Edit%20%2Fetc%2Fdefault%2Fgrub,of%20line%20containing%20GRUB_CMDLINE_LINUX%20string.&text=Next%20thing%20is%20to%20rebuild%20GRUB2%20config%20file.&text=You%20can%20try%20to%20hibernate%2C%20after%20hibernating%20computer%20should%20fully%20shutdown.

2 Likes

Hibernate should work out of the box
In any case, your issue may be similar to the one on this mailing list:
https://www.spinics.net/linux/fedora/fedora-users/msg498180.html

The user outlined the steps he took to fix it. It turns out that a module was missing in initrd.
We could confirm by searching for “hibernat” in the output of:
journalctl -b 0

If your issue is different, the search may reveal that too.

Dear twohot, thanks for your support!

Here is the output of journalctl, where I searched for the instance “hibernat”:

sudo journalctl -b 0 | grep hibernat
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0x00000000-0x00000fff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0x00058000-0x00058fff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0x0009e000-0x000fffff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0x5a553000-0x5a553fff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0x5a563000-0x5a563fff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0x5a564000-0x5a564fff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0x5a58d000-0x5a58dfff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0x5e90f000-0x5e90ffff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0x5e910000-0x5e910fff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0x6c09a000-0x6c2a9fff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0x6eb6a000-0x6ef26fff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0x6ef27000-0x6ef6dfff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0x6ef6e000-0x6f661fff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0x6f662000-0x6fffefff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0x70000000-0x77ffffff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0x78600000-0x7e7fffff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0x7e800000-0xefffffff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0xf0000000-0xf7ffffff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0xf8000000-0xfdffffff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0xfe000000-0xfe010fff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0xfe011000-0xfebfffff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0xfec00000-0xfec00fff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0xfec01000-0xfedfffff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0xfee00000-0xfee00fff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0xfee01000-0xfeffffff]
Jun 09 11:04:52 localhost.localdomain kernel: PM: hibernation: Registered nosave memory: [mem 0xff000000-0xffffffff]
Jun 09 11:04:52 localhost.localdomain systemd[1]: Created slice system-systemd\x2dhibernate\x2dresume.slice.
Jun 09 11:04:53 localhost.localdomain systemd[1]: Starting Resume from hibernation using device /dev/disk/by-uuid/fe5192a8-542b-402a-beb6-e29c845f50c7…
Jun 09 11:04:53 localhost.localdomain systemd-hibernate-resume[470]: Could not resume from ‘/dev/disk/by-uuid/fe5192a8-542b-402a-beb6-e29c845f50c7’ (259:2).
Jun 09 11:04:53 localhost.localdomain systemd[1]: systemd-hibernate-resume@dev-disk-by\x2duuid-fe5192a8\x2d542b\x2d402a\x2dbeb6\x2de29c845f50c7.service: Succeeded.
Jun 09 11:04:53 localhost.localdomain systemd[1]: Finished Resume from hibernation using device /dev/disk/by-uuid/fe5192a8-542b-402a-beb6-e29c845f50c7.
Jun 09 11:04:53 localhost.localdomain audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg=‘unit=systemd-hibernate-resume@dev-disk-by\x2duuid-fe5192a8\x2d542b\x2d402a\x2dbeb6\x2de29c845f50c7 comm=“systemd” exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success’
Jun 09 11:04:53 localhost.localdomain audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg=‘unit=systemd-hibernate-resume@dev-disk-by\x2duuid-fe5192a8\x2d542b\x2d402a\x2dbeb6\x2de29c845f50c7 comm=“systemd” exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success’
Jun 09 11:04:53 localhost.localdomain kernel: audit: type=1130 audit(1591693493.392:6): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg=‘unit=systemd-hibernate-resume@dev-disk-by\x2duuid-fe5192a8\x2d542b\x2d402a\x2dbeb6\x2de29c845f50c7 comm=“systemd” exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success’
Jun 09 11:04:53 localhost.localdomain kernel: audit: type=1131 audit(1591693493.392:7): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg=‘unit=systemd-hibernate-resume@dev-disk-by\x2duuid-fe5192a8\x2d542b\x2d402a\x2dbeb6\x2de29c845f50c7 comm=“systemd” exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success’
Jun 09 11:05:07 linux.fritz.box gsd-media-keys[1804]: Failed to grab accelerator for keybinding settings:hibernate
Jun 09 11:05:25 linux.fritz.box gsd-media-keys[2743]: Failed to grab accelerator for keybinding settings:hibernate

Anyway, my guess is that the error is related completely to systemd, since that with the disk command I can successfully hibernate and resume.

Hello, how to check is it off or not? if it is on how to make it off?

What do you mean exactly?

Does anyone have idea on how to solve this issue? Would downgrade systemd help?

I think that similar to “Suspend” also “Hybernate” should be made available from the Gnome power-off menu - don’t you think? On battery supported PCs “Suspend” may be sufficient, but for regular PCs using PSU only the other option is safer in case of a power outage…

You mean that if its not available by default in the menu then is not supposed to work?if its so, thats not the case since hibernation (through systemd) always worked in any other distribution I used before Fedora: Ubuntu, Mint, Elementary Os, Arch, Manjaro.

Just to be clear, hibernation is not officially supported. Due to the countless hardware combinations and particularly because of Secure Boot, it’s not supported upstream and while the Workstation SIG would like to have it working out of the box, they cannot.
If you get it working, you should consider it serendipity more than anything else.

Read this for more information:
https://pagure.io/fedora-workstation/blob/master/f/hibernationstatus.md

This is far from official fedora documentation…

1 Like

I think you are missing my initial point: hibernation is working, in fact, echo disk > /sys/power/state hibernates the system, and I can successfully resume my sessions after boot. In my understanding, this means that the kernel boot parameters the fstab file, and the quantity of swap space (which is larger than my ram) are in the correct fashion.

The problem is that hibernation through systemd does not work, in fact if I do: systemctl hibernate, I obtain:

Failed to hibernate system via logind: Not enough swap space for hibernation

So I guess the problem is related to some control check in logind.

For many users, on a variety of systems, hibernation works just fine, e.g. in your case via /sys/power/state. What I’m saying is that since kernel upstream does not currently support it, its implementation in every other higher level tool such as systemd or GNOME is all over the place and not very actively pursued.

If you want to troubleshoot the issue, you could try incrementally increasing your swap file size (if it’s a partition you could add a swap file) to figure out the discrepancy in systemd’s caclulations and file a bug against systemd. I’m not sure it’s going to convince anyone to work on it though, but ymmv.

If i will turn off hibernate will i mess up system?
btw is that necessary?