Can’t Suspend? Try Hibernation.

A disabled feature may give your laptop a longer life.

Linux penguin “Tux” wearing a sleeping cap, next to the text “Hibernation on Linux”

Hibernation on Linux: A Primer

Hibernation works by writing the contents of your RAM (volatile memory) to your hard disk (non-volatile memory) before powering your computer off. The next time that you boot, the memory stored on disk is restored to RAM. On Linux, hibernation writes your memory to swap. When resuming, the bootloader has to be able to access and read the swap space. If your swap is encrypted, it has to be decrypted, adding more complexity.

Problem 1. Swap Files

Since around 2016/17, major Linux distributions have been using swap files instead of swap partitions by default. Since the bootloader has to access swap to resume, the swap file makes things difficult. While it’s possible to hibernate to a swap file, it isn’t straightforward. If you want to enable hibernation, I strongly recommend using a separate partition.

Problem 2. Swap Size

Since hibernation writes the entirety of RAM to disk, your swap partition or file has to be as large as the amount of RAM you have. 32GB? You need 32GB of swap to hold it all. Laptops are still shipping with little disk space, so all disk usage is at a premium.

Problem 3. Encryption

If you’re using an encrypted swap (and you really should), hibernation gets even trickier. Unfortunately, you’ll also be in unsupported territory, and the Ubuntu guide makes it clear that Canonical does not support this method. Essentially, you’ll be setting a new password that will be required every time you boot or resume from hibernation.

Problem 4. Documentation

Search online for instructions on setting up hibernation, and you’ll get a lot of very different answers. And with each of those answers, you’ll find both positive and negative feedback. What gives? Even in Fedora 34, which seems like it may support hibernation out of the box, there are conflicting instructions on setting it up.

Making It Work

Since I’ve got an older laptop and mainly use it to write at home, I’ve opted not to encrypt my partitions. I first tried with elementary 6 Odin, but attempts to hibernate with various guides would only lock my session. However, I wanted instant gratification, so my next attempt was with Fedora 34. With 16GB of RAM and two disks, I opted for a btrfs root filesystem, ext4 home, and 32GB of swap (I wanted to make sure it works).

Suspend? Never again.

Wrapping Up

I can’t guarantee that setting up hibernation will be this easy for you. However, I was pleasantly surprised that it worked as easily as it did. So if you’ve got a device that cannot suspend, whether it’s because suspension doesn’t work, or perhaps your battery has given up on life, give hibernation a try. It might just spare you an expensive laptop purchase.

Useful Links

Main Image Credits

Xubuntu, Xfce, and elementary contributor. Free software advocate. My opinions are my own. Writing about FOSS, gaming, tech, and more.