Skip to Content
DocsReferenceHardwareSuspend & Hibernate

Laptop Suspend & Hibernate

Basic Concepts

ModeNameDescription
SuspendSuspend (S3)State saved to RAM, low power, fast resume
HibernateHibernate (S4)State written to disk swap, fully powered off, slower resume
Hybrid SleepHybrid SleepState saved to both RAM and disk, balancing speed and safety

Testing Suspend

# Suspend to RAM sudo systemctl suspend # Check supported sleep modes cat /sys/power/state

Configuring Hibernate

Prerequisites

Hibernate requires swap space no smaller than the physical memory size.

# Check memory and swap free -h # Check swap partition/file swapon --show

Using a Swap File for Hibernate

If using a swap file instead of a swap partition:

# Create a swap file equal to RAM size (example: 16GB) sudo fallocate -l 16G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile # Write to /etc/fstab for persistence echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

Configuring Kernel Parameters

Find the physical offset of the swap file:

sudo filefrag -v /swapfile | head -4

Note the physical_offset value from the first row. Then find the UUID of the partition containing the swap file:

findmnt -no UUID -T /swapfile

Edit the GRUB configuration:

sudo nano /etc/default/grub

Modify GRUB_CMDLINE_LINUX_DEFAULT:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=YOUR_UUID resume_offset=OFFSET_VALUE"

Update GRUB and initramfs:

sudo update-grub # Ubuntu 26.04 generates the initramfs with Dracut by default: sudo dracut -f --regenerate-all # On legacy initramfs-tools systems use instead: sudo update-initramfs -u -k all

Testing Hibernate

sudo systemctl hibernate

Hybrid Sleep

sudo systemctl hybrid-sleep

Lid Close and Power Button Behavior

Edit /etc/systemd/logind.conf:

[Login] HandleLidSwitch=suspend HandleLidSwitchExternalPower=ignore HandlePowerKey=poweroff HandleSuspendKey=suspend

Available values: ignore, poweroff, reboot, halt, suspend, hibernate, hybrid-sleep, lock

Restart the service after making changes:

sudo systemctl restart systemd-logind

Common Issues

Cannot wake up after suspend

  1. Check kernel logs:
journalctl -b -1 | grep -i "suspend\|resume\|sleep"
  1. Try adding kernel parameters in GRUB:
acpi_osi=Linux acpi_backlight=vendor
  1. For NVIDIA GPU users, make sure the driver version is recent and power management is enabled:
sudo systemctl enable nvidia-suspend nvidia-resume nvidia-hibernate

Cannot resume after hibernate

Confirm that the resume parameters are correctly configured, and check whether initramfs includes the resume module:

# Ubuntu 26.04 uses Dracut by default; list initramfs contents with lsinitrd: sudo lsinitrd /boot/initrd.img-$(uname -r) | grep resume # On legacy initramfs-tools systems use instead: lsinitramfs /boot/initrd.img-$(uname -r) | grep resume

Wi-Fi unavailable after wake

sudo systemctl restart NetworkManager # Or reload the wireless module sudo modprobe -r iwlwifi && sudo modprobe iwlwifi

Bluetooth unavailable after wake

sudo systemctl restart bluetooth sudo rfkill unblock bluetooth

Power Management Optimization

Install TLP for laptop power optimization:

sudo apt install tlp tlp-rdw sudo systemctl enable tlp sudo tlp start

Check battery status:

tlp-stat -b
Last updated on