This could be asked about most distros, but I don’t get it.
On a stationary pc sleep/suspend is fine. But on a laptop, it will eventually drain the battery if left long enough. You can not care about that or you can just power the laptop off, losing your state and having to recreate it when powering on.
Why is that the default?
In my opinion, the default, especially on a laptop should be to hibernate or maybe some hybrid sleep that starts out as suspend and then hibernates after some time or when battery reaches 20% or whatever.
I find it weird that people with laptops are fine with just being forced to lose their state all the time.
While I do not use suspend/hibernate at all I can understand the avoidance of hibernation.
When fedora switched from physical swap (slow) to zram swap (fast) the need for a physical swap space was made obsolete for most users. Hibernation cannot be achieved without a physical swap space at least as large as system RAM.
The combination of using zram to swap directly within ram compared with the slower speeds of using a physical swap space and the growing amount of ram installed in most systems seems to have obviated the need for hibernation for the great majority of users. Fedora chose the solution that meets the needs of the great majority of users and selected the use of zram over physical swap.
The tiny minority that wish to use hibernation can easily configure their systems to do so by adding a physical swap space.
Fedora’s choice means that swap (which, depending upon the amount of ram in the system, could easily take up as much as 256GB of drive space as a physical swap space to support hibernation) now resides in ram only and is cleanly erased with a reboot. A physical swap space does not get erased with a power off / reboot so data in that area remains for forensic analysis and can be seen as a security issue – particularly if hibernation is used.
I believe the trade off of much better security vs hibernation was optimal by eliminating the default physical swap.
Another wrinkle is that when a desktop/laptop is sleeping (aka. ACPI “S3”), the CPU is powered off, so the OS isn’t running and unable to monitor the battery and/or handle the hibernation process.
Either the hardware would need to monitor the battery and wake the OS, or the hardware would need to hande the switch from suspend/sleep to hibernate all on its own.
Some BIOS/UEFI firmware support waking a system up at a preset time, but I haven’t seen one that can react to a preset battery level. It would also have to override the laptop lid so the OS can run with the lid closed.
I agree with the OP that hibernation is a very desirable feature. I use it every single day on my work Windows laptop. I carry it back and forth between work and home and hibernate it each time. I originally tried suspend, but it drained my battery and my laptop kept waking up in my backpack and getting very, very hot. I have tons of work in progress, so I don’t want to power it off and have to start over each time.
It seems to me that zram and swap partitions have completely different purposes. Zram is for when you run out of RAM and it needs to swap something out. Swap partitions (and hibernation) is for when you want to save the state of your laptop and have it not drain power.
I understand there are technical challenges, but unless you never carry your laptop around I don’t see why hibernation is a desirable feature for Windows but not Linix?
We can agree that people have different usage patterns, not everyone need hibernation.
We can also discuss the technical details and ways of implementing it, and the pros and cons of doing it etc.
What I don’t understand why the option to do it isn’t easily available.
I know I can make a swapfile myself and set it up. I just don’t understand why it has to be a finnicky manual process, why not just a flip switch in the ui and/or similar on command line (systemctl enable hibernate or whatever).
It’s a very basic and very old and very useful feature of WIndows and of MacOS. If you close a Windows laptop or a MacBook, it will go into sleep. The two OS’es do it in slightly different ways, but they both do it and they both have features in hardware to help with it. Different levels of sleep, the ability to wake up at regular intervals or other conditions to then suspend to disk, hibernate. If you close a Windows laptop or a MacBook and leave it for a month closed, it will eventually run out of battery. Before it does so, it will have suspended to disk. The only inconvenience is that it takes a little longer to start again after this. The upside is that your state is intact.
The feature of course exists in Linux land and it utilizes the same features of the hardware to do so. I can enable it myself, but only by doing all sorts of finicky stuff. Why?
An easily available option wouldn’t make life worse for people not using the feature and would be a lot easier for people who use it.