Hibernation not working "HibernateLocation via EFI variable is not possible."

Hi,

I’ve done as much as I can but this one escapes me! Hopefully someone can help. I am running Fedora 40 on my Lenovo W530, and trying to get hibernation to work. I have successfully followed this guide https://fedoramagazine.org/hibernation-in-fedora-36-workstation/, and:

systemctl hibernate

seems to work as expected, until the second all turns off and it wakes straight up again at the login screen. checking:

journalctl -f

and attempting hibernate again produced this output:

Jun 17 21:25:46 fedora systemd[1]: Starting systemd-hibernate.service - System Hibernate…
Jun 17 21:25:46 fedora systemd[1]: Stopping systemd-zram-setup@zram0.service - Create swap on /dev/zram0…
Jun 17 21:25:46 fedora systemd-sleep[10789]: Not an EFI boot, passing HibernateLocation via EFI variable is not possible.
Jun 17 21:25:46 fedora systemd-sleep[10789]: No valid ‘resume=’ option found, refusing to hibernate.
Jun 17 21:25:46 fedora systemd[1]: systemd-hibernate.service: Main process exited, code=exited, status=1/FAILURE
Jun 17 21:25:46 fedora systemd[1]: systemd-hibernate.service: Failed with result ‘exit-code’.
Jun 17 21:25:46 fedora systemd[1]: Failed to start systemd-hibernate.service - System Hibernate.
Jun 17 21:25:46 fedora systemd[1]: Dependency failed for hibernate.target - System Hibernation.
Jun 17 21:25:46 fedora systemd[1]: hibernate.target: Job hibernate.target/start failed with result ‘dependency’.
Jun 17 21:25:46 fedora systemd-logind[910]: Operation ‘hibernate’ finished.
Jun 17 21:25:46 fedora audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg=‘unit=systemd-hibernate comm=“systemd” exe=“/usr/lib/systemd/systemd” hostname=? addr=? terminal=? res=failed’
Jun 17 21:25:46 fedora ModemManager[1007]: [sleep-monitor-systemd] system is resuming

The interesting part is in bold above.

What does ‘not an EFI boot’ mean? And how can I get Fedora to boot using EFI if that solves the problem? Is there another way I can fix this?

Many thanks in advance for your help!

Actually the following line is more relevant.
There must be a valid physical swap file or partition and there must be a “resume=…” option in the kernel command line that points to that location to tell the kernel where to save the ram content to and read the ram content from for resuming from hibernation.

Also, your comment is correct. I would guess you are not using uefi boot which would trigger the error you highlighted.

To use uefi boot fedora must be installed when booted into uefi mode then the installer will automatically create the efi partition and configure uefi boot.

My suggestion would be to first enter the bios setup and configure booting as uefi only.
Then boot the install media and reinstall in uefi mode.

Many thanks, ok this makes sense

I do have “resume” as a line in the kernel command line, perhaps there is a space where there shouldn’t be, I will check

Reinstall in UEFI mode is fine, can I just ask if the following partition setup is correct for Fedora? I often manually partition other distros but Fedora I don’t like to fiddle with and usually leave as default. My proposed setup for a 128Gb disk:

Thanks again!

The Fedora default uses btrfs subvolumes for root and home.

For newer hardware, advances in power management mean that many linux users find that suspend meets their needs.

Thanks but that isn’t what Fedora Magazine says:

Fedora Disk Config

Power management still not good enough for my uses - the amount of times I come back to a dead laptop means I absolutely need hybrid sleep/hibernation

Note that the images shows “Root subvolume” and “Home subvolume” on a Btrfs filesystem.

Here (using Fedora defaults on a 128 GB nvme in a USB3 case):

% df -T //boot/efi boot / /home 
Filesystem     Type  1K-blocks     Used Available Use% Mounted on
/dev/sdc1      vfat     613160    19492    593668   4% /boot/efi
/dev/sdc2      ext4     996780   440032    487936  48% /boot
/dev/sdc3      btrfs 123370496 51251004  67680084  44% /
/dev/sdc3      btrfs 123370496 51251004  67680084  44% /home

Ok maybe I’ve misunderstood, this is v similar to how I would set up a Debian system for example but with Btrfs partitions instead of ext4. Am I incorrectly calling ‘subvolumes’ ‘partitions’ or is this something else?

Is my proposal above with swap-space correct to allow hibernation?

Yes. I have 3 partitions, but /dev/sdc3 is a btrfs partition with 2 subvolumes.

42 GB seems excessive unless you have a huge amount of RAM (which might explain short time on battery!). Arch Linux Suspend and Hybernate discusses partition size for hybernation:

  • Even if your swap partition is smaller than RAM, you still have a good chance of hibernating successfully. See “image_size” in the kernel documentation for information on the image_size sysfs(5) pseudo-file. Note that the default is 2/5 your RAM capacity. On this system with 8G RAM, I get:
% cat /sys/power/image_size
3273302016

There is a real cost to over-provisioning linux-swap as btrfs makes good use of extra space.

Ok thanks for help in this thread but I’ve spent the last few days trying different things, to no avail. As an aside, I have no idea why this is so hard with fedora and gnome, I have a Debian based LXDE installation on another machine that does hibernation out of the box and another opensuse Xfce installation that does likewise. But I digress

I have tried with a swap space partition and have tried without, if you look at the instructions in my original post, it doesn’t actually say to create a separate swap partition, the first command is:

Btrfs subvolume create /swap

But I’ve followed the guide so many times now and I cannot get audit2allow to help filter audit log entries to make the SELinux module

If I look at journalctl, it says that the system cannot find a location to hibernate to, but I thought that was what I did in step 1 (create a swap subvolume and a swap file). Part of the output is below

It’s anyone able to advise further? Thanks so much

Jun 21 23:14:15 fedora systemd[1]: Starting systemd-hibernate.service System Hibernate…
Jun 21 23:14:15 fedora systemd[1]: Stopping systemd-zram-setup@zrame.service Create swap on /dev/zram0…
Jun 21 23:14:15 fedora systend-sleep [4173]: Failed to find location to hibernate to: Invalid argument fedora
Jun 21 23:14:15 systemd[1]: systemd-hibernate.service: Main process exited, code exited, status-1/FAILURE
Jun 21 23:14:15 fedora systemd[1]: systemd-hibernate.service: Failed with result ‘exit-code’.
Jun 21 23:14:15 fedora systemd[1]: Failed to start systemd-hibernate.service Systes Hibernate.
Jun 21 23:14:15 fedora systemd[1]: Dependency failed for hibernate.target System Hibernation.
Jun 21 23:34:15 fedora systemd[1]: hibernate.target: Job hibernate.target/start failed with result 'dependency".

Ok I found the solution - install OpenSUSE Tumbleweed Gnome edition.

Hibernation works immediately after install, straight out of the box. I like Fedora but there seems to be an awful lot of excuse making for a basic function that another leading distro can make work by default

Thanks for any help given to me on this thread