Enabling Hibernation on Fedora 43+

Article Summary:
The current article on enabling hibernation in fedora 40+ is outdated because Secure Boot is now enforced and has to be disabled. Also SELinux has to be modified in order to allow Fedora to work with the swapfile.

Article Description:
The article is already written here in markdown with all the steps explained. Very similar to reference article but with the fixes.

I have read and understand the Ai-Assisted Contributions Policy

+1 for posting this on Fedora Magazine. Thanks.

Thank you @ragequit

I’ve opened Pagure ticket #431 to track your article. You will be prompted to log in to Pagure using your FAS login at that link.

Let us know when you have logged into Pagure and we will assign the ticket to you.

Please use comments on ticket #431 for any questions you may have. The editors will be glad to assist. Also, when you have the article ready to review in the Fedora Magazine Word Press Engine let us know in a comment on #431.

You can log into the Fedora Magazine WP instance using your FAS login. To create a new article, select the :plus: sign in the top menu bar.

The following links contain more information about the magazine work flow and some authoring tips:

Thank you for volunteering to write for the Fedora Magazine.

@rlengland, I was able to log in to both Pagure and Fedora Magazine WordPress Engine. Onward to next steps!

@ragequit I see that you have an article in WordPress

https://fedoramagazine.org/?p=43031&preview=true

It appears to need some work on the formatting for WP but do you consider the text complete? If so, let me know and I will work on the formatting and then let you review to ensure that it is correc.

I am a non technical user and these steps to enable hibernate are not accessible to me.

Are there plans to add hibernate to the GUI in Fedora to make it accessible to non technical users, perhaps in Fedora 45 or 46?

I don’t know that much about it. There was some discussion about it here:

Also, there are complications when secure boot is enabled. There is a blog about that here:

https://mjg59.dreamwidth.org/55845.html

Hi, I have just run through these commands on new Fedora 43 on a framework laptop and everything seemed to go okay but when I tested hibernate my system now turns completely off has to be rebooted. I also notice that the boot options now come up on startup. Do you have any idea what might be happening here?

I should add that I saw no error messages and I ran through each of the steps which seemed to work as expected. This is what I get if I run swapon --shows:

NAME TYPE SIZE USED PRIO
/dev/zram0 partition 8G 1G 100
/var/swap/swapfile file 15G 0B -1

I think this means that a swap partition was created but that it is not being used because it is a lower priority than the dynamic swap. I haven’t got much further!

I’m wondering if anyone can help me work out what has gone wrong or if this is just too hard to, let me know if I need to undo anything that I’ve done to my system.

From: How to restore hibernation on Fedora
ā€œif a traditional swap partition exists, the system is intelligent enough to use it for hibernation, even if the zram device existsā€
mine is:

Filename				Type		Size		Used		Priority
/var/swap/swapfile    file		6291452		0		-1
/dev/zram0           partition	3986428		16		100

with same priority as yours, yet all works… maybe check your offset setting is correct?

Just to be clear, if you are using Btrfs, then you will not need the offset. Jaimie’s configuration is much more complex because she is using the ext4 filesystem (and using another OS’s bootloader). If you are running a more standard setup, then what is in the gist that is linked in the first post should be enough.

I am using a standard setup - its a new framework 13 laptop installed with Fedora 43 workstation and I haven’t done much to it other that installing software. This is the first thing I’ve tried to do that fiddles with the system in anyway. I am using Btrfs and the drive is encrypted.

As I said I followed the gist and there didn’t seem to be any problems as I went though it, but it doesn’t seem to work for me (I noticed that the swap partition created is the same size as RAM). Hibernation seems to occur but it won’t wake up and restarts instead - I have to put in the password to access the hard drive, I re-login and no applications are open. I’m not sure what the offset is but maybe it doesn’t matter!

I don’t use hibernation, but IIUC, it doesn’t work with secure boot.[1]

The offset doesn’t matter if you are using Btrfs.


  1. ā†©ļøŽ

Well that would make sense of it. There is some discussion of using hibernation with secure boot and encryption in the comments on Update on hibernation in Fedora Workstation - Fedora Magazine but I am unable to evaluate it all and it is getting beyond what im capable of following or willing to get into.

The main reason for hibernation is when I am travelling and the laptop isn’t used for extended periods such as most of a day. There is a significant draw on the battery which I am not used to (and the framework I have doesn’t have amazing battery life to begin with), but I’ll just have to learn to shut it down.

On the fedoramagazine.org instructions (which have a lot of crossover) there is some code to revert the changes. I’m hoping/assuming they will work okay to revert what is covered in the gist.

sudo swapoff -v /var/swap/swapfile
sudo sed -r -i '/.var.swap.swapfile/d' /etc/fstab
sudo btrfs subvolume delete /var/swap
sudo rm /etc/dracut.conf.d/resume.conf

@ragequit It seems this topic was kidnapped and turned into a discussion of the topic rather than a discussion about the article.

Can you give us a status? Are you planning to complete the article? Now that Fedora Linux 44 is out it might be good to proceed with that in mind by verifying your process and amending any F43 references.

Thank you for any information you can provide on the status.

…while the article is being ā€˜expanded’ for 44 (btw - my old badge number…) it could include a subtopic on non-btrfs systems, ā€œforeign bootloadingā€, and the other rabbit holes I introduced - just in the interest of being more wellrounded?

:grin:

For those looking for the 48 post ā€˜rabbit hole’ they were split to a new topic: How do I create swapfile on ext4?, which would’ve been better titled : How do I Enable Hibernation on Fedora 43 on multi boot system?

Possibly, or perhaps a multi-part series where the follow-on parts expand on the initial one. It probably depends on how long the article ends up being.

@firebat @ragequit It would be a shame to let all your work on hibernation go unpublished. Do you have plans to continue this article?

Please let us know the status.

Thank you.

Jaimie’s posts were slightly off-topic for this thread. She wasn’t commenting about the article. She just wanted help with a special configuration. Maybe I should attempt to split those posts out into a separate topic?

I seem to have gotten lost in the conversation. Yes. Splitting might be a good idea if you can accomplish that.
(I think I mistook the respondees for the same person with a different identifier, for some reason)