Ubuntu doesn’t enable hibernate by default because it “might not work reliably.” But when it does work, it’s magic - full system state saved to disk, zero battery drain, instant resume with all your windows exactly where you left them.

Prerequisites

You need a swap partition or swap file at least as large as your RAM.

1
2
3
4
5
# Check current swap size
free -h

# Check swap location
swapon --show

If you don’t have enough swap, create a larger swap file first.

Test if hibernate works

Before configuring, test if your hardware supports it:

1
2
# Test hibernate (system will shut down)
sudo systemctl hibernate

If your system hibernates and resumes successfully with all your programs intact, you’re good to go. If not, your hardware might not support it reliably.

Enable hibernate

1. Find your swap UUID and offset

1
2
3
4
5
# Get swap UUID
sudo findmnt -no UUID -T /swapfile

# For swap partition instead of swapfile
sudo blkid | grep swap

If using a swap file (not partition), also get the offset:

1
2
# Get swap file offset
sudo filefrag -v /swapfile | head -n 4 | tail -n 1 | awk '{print $4}' | sed 's/\.\.//'

2. Update GRUB configuration

Edit GRUB config:

1
sudo nano /etc/default/grub

Find the line starting with GRUB_CMDLINE_LINUX_DEFAULT and add resume parameters:

For swap partition:

1
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=your-swap-uuid"

For swap file:

1
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=your-root-uuid resume_offset=your-offset"

Replace:

  • your-swap-uuid with the UUID from step 1
  • your-root-uuid with your root partition UUID (run sudo findmnt -no UUID /)
  • your-offset with the offset number from step 1

Save and update GRUB:

1
sudo update-grub

3. Update initramfs

Edit resume configuration:

1
sudo nano /etc/initramfs-tools/conf.d/resume

Add this line:

For swap partition:

1
RESUME=UUID=your-swap-uuid

For swap file:

1
RESUME=UUID=your-root-uuid resume_offset=your-offset

Update initramfs:

1
sudo update-initramfs -u

4. Enable hibernate in systemd

Test if systemd hibernate works:

1
sudo systemctl hibernate

5. Add hibernate to power menu (GNOME)

Install extension or use this workaround:

1
2
# Create polkit rule to allow hibernate
sudo nano /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

Add:

1
2
3
4
5
6
7
8
9
[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
ResultActive=yes

Reboot for changes to take effect:

1
sudo reboot

Quick test commands

1
2
3
4
5
6
7
8
# Hibernate now
sudo systemctl hibernate

# Suspend to RAM (regular sleep)
sudo systemctl suspend

# Hybrid sleep (suspend + hibernate backup)
sudo systemctl hybrid-sleep

Troubleshooting

Hibernate fails

Check logs:

1
journalctl -b -u systemd-hibernate

Resume fails (boots normally instead of resuming)

Double-check your resume UUID and offset:

1
2
3
4
5
6
7
8
# Verify GRUB config
grep resume /etc/default/grub

# Verify initramfs config
cat /etc/initramfs-tools/conf.d/resume

# Verify GRUB command line
cat /proc/cmdline

All three should have matching UUID and offset values.

Hibernate option still not in GUI

GNOME hides hibernate by default. Use this extension:

Or hibernate from terminal/script.

Create hibernate shortcut

Add to your keyboard shortcuts:

1
2
3
4
5
# Command to hibernate
systemctl hibernate

# Or with confirmation
zenity --question --text="Hibernate now?" && systemctl hibernate

Pro tip: Once configured, sudo systemctl hibernate is faster than suspend for long-term laptop storage. Your battery won’t drain at all, and you resume exactly where you left off - even weeks later. Perfect for travel.