If you're on a laptop, swap is where your hibernation contents go. (This is probably a bad idea, but that's what happens.) So you need slightly more than RAM, at a minimum, or you don't do hibernation.
I recommend not doing hibernation unless you absolutely need it.
I used to hibernate religiously in the Windows XP days. Now I don’t even have that option because my Linux distro of choice (and many other distros now) doesn’t enable it by default. Some popular Linux distros don’t even create swap by default nowadays. I think Ubuntu Server is one of them.
I don’t recall seeing an option to hibernate in Windows 11 either, but I may be mistaken.
Hibernation seems less essential on a laptop than a desktop, but I don’t miss it in either case. It’s very rare that a power outage makes me reboot normally on a desktop.
I also ensure hibernation is set up on my laptops, and systemd has this hybrid sleep-first-then-hibernate thing where I've got the hibernation set for 4H of sleep. As my Dell 9320 doesn't have "real" S3 sleep, just the s0ix "connected standby" thing (which uses a lot more power when idle, despite my best efforts) it means I still have battery left if I don't use my laptop for more than 3 days.
I disable sleep on Linux because sometimes the laptop would wake up and either overheat in a bag or just make the battery dead-flat. Both those outcomes are highly undesirable. Old Dell XPS so sleep and hibernate are supported.
I find boot times quick enough on modern laptops that shutting down and restart is fine.
If I want to leave session alive during the day I just lock it and leave it running. Hibernate is enabled for if battery gets low but I hardly ever manually hibernate.
> I find boot times quick enough on modern laptops that shutting down and restart is fine.
How mobile are you with your laptop? If I had to restart (i.e., lose all my xterms' state, etc.) every time I'd stopped using my laptop for a day or so it would totally kill my workflow
Hibernation success also depends on device driver support and so many devices don't correctly support hibernation, for example, by failing to come back to life after machine is resumed, or certain functions becoming broken due to software/hardware bugs.
This is one of the best parts about hibernation. Shutting down is saving state. Booting? The kernel starts booting as usual, entirely the same as a normal boot. It gets quite far along, has already loaded a bunch of drivers, and then it finds the hibernation state & loads that.
Where-as with most s3 and s2idle suspends, there really is a lot of system level bios support required to make things happen. Many systems just do it wrong, not to spec, or desktops often not at all. These are non-issues in hibernation.
To your point though, I did have a laptop on which the wifi would disappear every other hibernation. I'd tend to hibernate it, immediately wake it up, and hibernate again, so when I really turned it on it would be good to go. For a while I had been packing a USB wifi card because I hadn't put it together. So yeah I've seen issues. A kernel upgrade half a decade ago seemed to have fixed that, but yeah I guess it's some evidence of problems. Still, the amount of time I've spent trying to get systems to suspend has been long & sad & difficult, with little evidence of what's happening. Hibernation has been a pretty reliable & consistent tool that I feel like I can almost always rely on.
Which... seems quite wrong given I can put my laptop to sleep lol. But thanks for the pointer, even though I was aware LTT did the video on sleep it'd fallen out of my memory (pun not intended).
Edit: I think I partially solved it. Running powercfg /a reveals...
The following sleep states are available on this system:
Standby (S0 Low Power Idle) Network Connected
Hibernate
Fast Startup
The following sleep states are not available on this system:
Standby (S1)
The system firmware does not support this standby state.
This standby state is disabled when S0 low power idle is supported.
Standby (S2)
The system firmware does not support this standby state.
This standby state is disabled when S0 low power idle is supported.
Standby (S3)
The system firmware does not support this standby state.
This standby state is disabled when S0 low power idle is supported.
Hybrid Sleep
Standby (S3) is not available.
The hypervisor does not support this standby state.
(I have hyper V enabled.) So it does look like S0 sleep is the culprit.
Hibernation is great! It compresses with lzo (which should be a good bit smaller than memory size) and soon one will be able to use whatever they want from the kernel crypto apis to compress (lz4 seems to be a focus but maybe Zstd too?).
S3 and s2idle both require good bios support. Many desktops flat out won't suspend. But hibernate? To hibernate requires nothing. The kernel writes it's state as it shuts down, and a kernel when loading looks for hibernation state & loads it if found. The boot path looks normal, works normally, until a good way through the kernel initializing itself. This makes it so much more reliable & available, being not dependent on bios support, not requiring special handling.
Not losing any battery when hibernating is excellent. Just yesterday I turned on a laptop for the first time in a month, and it has a full charge & my full previous state. I love that so much.
I am curious how the kernel handles making space for the hibernation state. Having to dump main memory into some space feels like it has to create a lot of pressure. If swap is already being used, thats got to be quite the effort to hibernate. It seems like it should be failing to hibernate sometimes! Somehow though I've never hit any issues, never heard of any issues.
I recommend not doing hibernation unless you absolutely need it.