[GUIDE] Framework 16 Hibernate (w/ swapfile) Setup on Fedora 40

Any progress so far?

In order for hibernation to start working for me (Framework 13/Fedora 40/AMD Ryzen) I needed to do extra steps:

  • turn off secure boot
  • create one more config file and execute command:
cat <<EOF >/etc/dracut.conf.d/resume.conf
add_dracutmodules+=" resume "
EOF
dracut -f

and that worked for me, maybe it will help for someone else :slight_smile:

2 Likes

Currently using framework 16 with fedora 40 kde plasma. When trying to hibernate after rebooting and setting up the swap file, I get “Call to Hibernate failed: Invalid argument” and running “sudo audit2allow -b” returns nothing. I have double checked my uuid and offset are correct.

TBH I’ve got the same error message and blank output of audit2allow first and disabled selinux completely :man_facepalming: so I could check if hibernation really works.

So it worked perfectly well and I changed from disabled to permissive in /etc/sysconfig/selinux, rebooted and once again changed mode to enforcing.
I read somewhere in RH documentation so it is advised to toggle to permissive before enforcing so that you don’t have problems booting system up.

After that combination of steps above I tried sudo systemctl hibernate and sudo audit2allow -b and got the output finally. And then retried steps from this guide, but unfortunelly it weirdly kicked me out to the login screen and without hibernation.

After all from gist attached in this post I tried:
cd /tmp
sudo audit2allow -b -M systemd_sleep
sudo semodule -i systemd_sleep.pp
And it worked for me without having to disable selinux

BTW I’m plasma user too :smiley:

1 Like

I also have Framework 13/Fedora 40/AMD Ryzen, with gnome

I followed this guide but had some more/different steps.

First, It seems that with systemd 255, there is no more need to set resume and resume_offset in grub.

So from Tarian’s guide, I follow step 1 to 3 then 7 to 11.

At this step, I had the Call to Hibernate failed: Invalid argument message when trying to hibernate.
In journalctl, I had Failed to find location to hibernate to: Invalid argument message.
This is due to /sys/power/resume file containing 0:0 instead of ID of the partition hosting the swapfile.
Mine is on /dev/nvme0n1p3:

root@arcadia:~# ls -l /dev/nvme0n1p3
brw-rw----. 1 root disk 259, 3 11 août  10:11 /dev/nvme0n1p3

So I need to use 259:3

Next, I follow what @tail_Head said:

  • create /etc/dracut.conf.d/resume.conf but with some modifications to make /sys/power/resume modifications consistent:
cat <<EOF >/etc/dracut.conf.d/resume.conf
add_dracutmodules+=" resume "
install_items+=" /usr/lib/systemd/system/systemd-hibernate-resume.service "
EOF
dracut -f
  • set selinux to permissive to use audit2allow
cd /tmp
sudo audit2allow -b -M systemd_hibernate
sudo semodule -i systemd_hibernate.pp
sudo audit2allow -b -M systemd_sleep
sudo semodule -i systemd_sleep.pp

Then, I finished with step 17 from Tarian’s guide

And for now, all seems to work

1 Like

Sad to say that this works, but it breaks wifi after resuming from hiberation for me.
It just gives a wifi activation error and nothing resolves it other than restarting the computer

This part of the guide should fix your wifi -

:person_facepalming: not sure how I missed that. Thanks, seems to work now :crossed_fingers:

I’ve been able to follow most of the steps here without issue, except that I’m still not able to see any output from audit2allow -b. I updated my /sys/power/resume with the offset value for my /dev/nvme0n1p3 and I added the extra install_items line that underscoreDje mentioned. Finally, I also changed /etc/sysconfig/systemd to SELINUX=permissive and rebooted but still no dice.

The output of journalctl -k contains this message about lockdown:

Lockdown: systemd-logind: hibernation is restricted; see man kernel_lockdown.7

I do have secure boot enabled, but I’d like to keep it that way since this is a work machine. I know that’s a problem for hibernate after reading through the suggested kernel_lockdown.7 man page, but there’s an old comment in the gist linked in the post which says “there’s an effort to produce signed and verifiable hibernation images”. Since that was about Fedora 37, I was hoping there was some improvement on this situation. However, though I haven’t seen anyone outright say it, I am slowly putting it together that I may not be able to use hibernate at all because of secure boot.

Does that seem to be the case and should stop wasting my time on this?

You have this thread which is saying you would need to modify your kernel to support hibernating with secureboot enabled.

I would imagine that still applies, based on your results

Hi there
Thanks for the excellent guide. Newbie here (came from Ubuntu) trying to set it up. I am completely lost on the policy, when i try the audit2allow i get no output and when i try $sudo audit2allow -b -M systemd_hibernate
then i get
compilation failed:
systemd_hibernate.te:6:ERROR ‘syntax error’ at token ‘’ on line 6:

any ideas why?

thanks

Why do you have a $ in front of sudo? Did you manually edit your policy? It seems like you have a typo in your .te file.

thanks for your quick response, sorry the “$” was to show that it was code.
So, let me explain, and sorry for not being very clear. I started by trying to generate the SELinux policy, so i typed

sudo audit2allow -b

the weird thing is the above comes back empty, it returns absolutely nothing.
so i went to /tmp and then i tried

but then what i got was

compilation failed:
systemd_hibernate.te:6:ERROR ‘syntax error’ at token ‘’ on line 6:
/usr/bin/checkmodule: error(s) encountered while parsing configuration

so now i m a bit on lost on how to proceed…

Your systemd_hibernate.te probably doesn’t have anything in it. Did trying to hibernate error out?

yeap, thats correct

sudo audit2allow -b -M systemd_hibernate

produces the systemd_hibernate.te

and then

less systemd_hibernate.te

shows that there is only one line in the file:

module systemd_hibernate 1.0;

when attempting

sudo systemctl hibernate

I get
Call to Hibernate failed: Invalid argument

1 Like

Edit: The below error is because audit2allow will only work if it has already denied an operation.

audit2allow - generate SELinux policy allow/dontaudit rules from logs of denied operations

In this case, the hibernate failure was due to secure boot still being enabled, and so it was not a SELinux policy denial.


I’m encountering the exact same error as @Panos_Sapou. I’m on a Framework 13 with a fresh Fedora 40 install.

Starting from step 11 (after reboot):

miles@fedora:~$ sudo systemctl hibernate
[sudo] password for miles: 
Call to Hibernate failed: Sleep verb 'hibernate' is not configured or configuration is not supported by kernel
miles@fedora:~$ sudo audit2allow -b


miles@fedora:~$ cd /tmp
miles@fedora:/tmp$ sudo audit2allow -b -M systemd_hibernate
compilation failed:
systemd_hibernate.te:6:ERROR 'syntax error' at token '' on line 6:


/usr/bin/checkmodule:  error(s) encountered while parsing configuration
miles@fedora:/tmp$ cat systemd_hibernate.te 

module systemd_hibernate 1.0;



miles@fedora:/tmp$

Can someone help me?

I achieved the whole tutorial successfully after many attempts, but I got stuck in getting it working. Whenever I call sudo systemctl hibernate, I get a black screen then I spawn in the login screen the following second. What could be happening?

Have you gone through the troubleshooting steps? What did you observe when going through them?

Hi,

On my side, resuming from hibernation doesn´t work anymore with 6.11.4-201.
It remains stucked on framework splash screen before grub kernel selection menu.

Revert to 6.10.12-200 and it works again.

Is anyone has this issue with 6.11.x ?

(Framework 13 / AMD)

Helpful guide for the newer versions of Fedora. I’ve installed Fedora 40 on ext4 rather than btrfs. I’m trying to get this guide to work with the only change being the use of the following to get the offset value:

filefrag -v /var/swap/swapfile

Has anyone tried that and got this to work?

With systemd v255 and superior, there is normally no need to set --resume and --resume_offset anymore.
I don´t use this args and hibernate is working.
I use btrfs, but I don´t think the filesystem is relevant here.