There were discussions about it, but no solution forever. Some people dealing with it but stopping, while hibernation is such an essential and nice feature for Desktop Linux, especially as Intel S3 sleep drivers are missing!
I guess the solution is pretty good, while not working for me currently. These are the commands nessecary (slightly modified to automate, I hate this “open nano and add this”):
NOTE: the following contains infos generated by ChatGPT during that time
There’s a very simple reason why we don’t offer hibernation for Fedora desktop variants by default: there’s no support for secure boot systems right now.
It’s also really, really dependant on the hardware (well, firmware) cooperating well. So it’s very vendor, model, and even revision-sensitive. It’s very likely that a large number of systems won’t resume reliably for reasons beyond our control. So it might need to remain an “enable at your own risk” option. (Or something we have an enable-list for known-good systems.)
S4 suspend (suspend-to-disk) doesn’t require that much hardware/firmware cooperation. You might be thinking of S3 suspend (suspend-to-ram), where this is true. It’s so true that it’s being replaced with S0/S0ix suspend (also known as Windows Modern Standby), which requires the operating system to fully manage the system suspend mode instead of having the firmware do it.
Maybe! I remember a lot of problems with reliably waking up displays, etc. But it has been a few years. Oh, also: we’ll have to figure out something with swap partitions, right?
Yup. I think the idea would be to dynamically create a btrfs subvolume to instantiate a swapfile for hibernation (similar to the Windows hiberfile.sys trick). But there’s been no real need to do that work until we get S4 suspend working with secure boot enabled.
# Create swapfile directory
SWAPSIZE="$(( $(grep MemTotal /proc/meminfo | awk '{print $2}') * 2 ))"
btrfs subvolume create /var/swap
# You might like to mount /var/swap from a subvolume on the SSD if /var is on a slow HDD like my system
chattr -R +C /var/swap
# Create swapfile
btrfs filesystem mkswapfile -s "$SWAPSIZE" /var/swap/swapfile
# Note down the offset
btrfs inspect-internal map-swapfile -r /var/swap/swapfile
After creating the swapfile as appropriate, add the swapfile entry to /etc/fstab: echo '/var/swap/swapfile swap swap sw 0 0' | sudo tee -a /etc/fstab
Find the UUID of the disk the swapfile is on, via lsblk -fo NAME,FSTYPE,UUID ${DEVICE} where ${DEVICE} can be found out by findmnt /var/swap || findmnt /var || findmnt /sysroot under the SOURCE title.
Set it to SWAPUUID variable in your shell. SWAPUUID=the-uuid-of-the-disk
Set the SWAPOFFSET variable in your shell as the offset noted down above.
Then append the kargs: rpm-ostree kargs --append=resume=UUID=${SWAPUUID} --append=resume_offset=${SWAPOFFSET}
@boredsquirrel please stop re-tagging and re-categorizing necro-topics. It has been made clear already in the past that this is not the way to go, and why.