DEV Community

Cover image for How to Enable Hibernation on Dual Boot Linux Mint?
Ganesh Kumar
Ganesh Kumar

Posted on

How to Enable Hibernation on Dual Boot Linux Mint?

Hello, I'm Ganesh. I'm working on FreeDevTools online, currently building a single platform for all development tools, cheat codes, and TL; DRs — a free, open-source hub where developers can quickly find and use tools without the hassle of searching the internet.

Hibernation is a feature that saves your entire session (open apps, documents) to the drive, then powers down completely, using zero energy. This allows you to resume exactly where you left off, unlike sleep mode, which uses low power for quick resumes.

In many modern Linux distros, they have removed this feature as hibernation often fails silently due to misconfiguration. The screen might go black and immediately come back on, or the computer might just restart instead of resuming.

It doesn't mean your PC won't hibernate or Linux won't support hibernation. For technical inconvenience, it has been removed.

I have correctly set it up on my pc. So here is how I did

Prerequisites

Before modifying your system configs, you need to check two things.

1. Disable Secure Boot

Linux hibernation usually does not work if Secure Boot is enabled in your BIOS because the kernel cannot verify the hibernation image during boot.

Check your status by running this command in the terminal:

mokutil --sb-state

Enter fullscreen mode Exit fullscreen mode
  • If it says SecureBoot disabled, you are good to go.
  • If it says enabled, restart your laptop, enter the BIOS setup, and disable Secure Boot. You can check on Google how to do it for your system, as it may vary with motherboard.

2. Check Your Swap Size

To hibernate, your computer dumps everything currently in RAM onto your hard disk. Therefore, your Swap space must be larger than your RAM.

A safe rule is to have Swap = 2x RAM.

Since I have 16GB of RAM, I created a 32GB Swap File (/swapfile).

The Problem: Finding the File

If you use a Swap Partition, Linux usually finds it automatically. However, most modern installations use a Swap File.

The bootloader (GRUB) cannot read the file system to find this file while the computer is booting. We need to give it the exact physical coordinates of the file on the disk.

Step 1: Get Physical Location Of Swapfile

We need two pieces of information: the UUID (ID of the disk) and the Physical Offset (where the file starts).

1. Find the Disk UUID
Run this command:

findmnt -no UUID -T /swapfile

Enter fullscreen mode Exit fullscreen mode

Copy the long string of text it outputs.

2. Find the Resume Offset
Run this command:

sudo filefrag -v /swapfile | head -n 4

Enter fullscreen mode Exit fullscreen mode

You will see a table. Look at the first row and find the number under the physical_offset column.
Copy that number.

Step 2: Edit the GRUB Configuration

Now we need to tell the computer where to look for the hibernation data.

  1. Open the GRUB config file:
sudo nano /etc/default/grub

Enter fullscreen mode Exit fullscreen mode
  1. Find the line that starts with GRUB_CMDLINE_LINUX_DEFAULT. It usually looks like this:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

Enter fullscreen mode Exit fullscreen mode
  1. Add your UUID and Offset to the end of the line (inside the quotes). It should look like this:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=YOUR_UUID_HERE resume_offset=YOUR_OFFSET_NUMBER_HERE"
Enter fullscreen mode Exit fullscreen mode

(Replace YOUR_UUID_HERE and YOUR_OFFSET_NUMBER_HERE with the numbers you copied in Step 1).

Ex: In My case I have setup like this.

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=30
GRUB_DISTRIBUTOR=`( . /etc/os-release; echo ${NAME:-Ubuntu} ) 2>/dev/null || echo Ubuntu`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=f4dc19e8-89af-49db-8ec5-3a518e4fd4c0 resume_offset=32473088"
GRUB_CMDLINE_LINUX=""

Enter fullscreen mode Exit fullscreen mode
  1. Save the file (Ctrl+O, Enter) and exit (Ctrl+X).

Step 3: Update and Reboot

For the changes to take effect, you must update the bootloader.

sudo update-grub

Enter fullscreen mode Exit fullscreen mode

Now, restart your computer.

Step 4: Test and Verify

Once you have rebooted and logged back in, open a few apps (like a browser or text editor) to test if the session saves correctly.

Run this command to force hibernation:

sudo systemctl hibernate

Enter fullscreen mode Exit fullscreen mode

If your screen turns off and the laptop shuts down completely, you have succeeded! When you power it back on, you should be right back where you left off.

Conclution

I hope it worked with you also. Stay tuned to get more Linux hacks


FreeDevTools

I’ve been building for FreeDevTools.

A collection of UI/UX-focused tools crafted to simplify workflows, save time, and reduce friction when searching for tools and materials.

Any feedback or contributions are welcome!

It’s online, open-source, and ready for anyone to use.

👉 Check it out: FreeDevTools

⭐ Star it on GitHub: freedevtools

Source

Why is hibernation so complicated on Ubuntu (and other Linux distributions)?

Hibernation

Top comments (0)