Skip to content

About

A fix to enable hibernation resume on Omarchy systems with GTX 1650.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

NVIDIA Hibernation Fix Guide for Linux (Arch-based Systems)

This guide fixes hibernation issues on Linux systems with NVIDIA GPUs, specifically addressing the "PM: hibernation: resume failed (-5)" error caused by conflicts between early KMS and NVIDIA's video memory preservation.

Problem

When attempting to hibernate with an NVIDIA GPU, the system either:

  • Fails to hibernate with error: Call to Hibernate failed: Specified resume device is missing or is not an active swap device
  • Hibernates successfully but resumes as a fresh boot, losing all application state
  • Shows error in logs: nvidia 0000:01:00.0: PM: pci_pm_freeze(): nv_pmops_freeze [nvidia] returns -5

Prerequisites

  • NVIDIA proprietary drivers installed
  • Swap space configured (swapfile or swap partition) with size ≥ RAM
  • Root access to your system

Step 1: Get Correct Swap Information

For Swapfile Users

First, identify your swapfile location and get the correct offset:

# Show active swap
swapon --show

# Get the UUID of the partition containing your swapfile
findmnt -no UUID -T /swap/swapfile

# Get the swapfile offset (IMPORTANT: This is unique to your system)
sudo btrfs inspect-internal map-swapfile -r /swap/swapfile

Note: The offset command varies by filesystem:

  • Btrfs: sudo btrfs inspect-internal map-swapfile -r /swap/swapfile
  • ext4/other: sudo filefrag -v /swap/swapfile | head -n 4 | tail -n 1 | awk '{print $4}' | sed 's/\.\.//'

Save these values - you'll need them in the next steps.

For Swap Partition Users

# Find your swap partition UUID
lsblk -o NAME,UUID,TYPE | grep swap

You won't need an offset for swap partitions.

Step 2: Configure Kernel Parameters

For Limine Bootloader (Omarchy and similar)

Edit the Limine configuration:

sudo nano /etc/default/limine

Add or modify the resume parameters:

For swapfile:

KERNEL_CMDLINE[default]+="resume=UUID=YOUR-UUID-HERE resume_offset=YOUR-OFFSET-HERE"

For swap partition:

KERNEL_CMDLINE[default]+="resume=UUID=YOUR-SWAP-UUID-HERE"

Also update /etc/kernel/cmdline to include the same parameters.

For GRUB Bootloader

Edit GRUB configuration:

sudo nano /etc/default/grub

Add to GRUB_CMDLINE_LINUX_DEFAULT:

For swapfile:

GRUB_CMDLINE_LINUX_DEFAULT="... resume=UUID=YOUR-UUID-HERE resume_offset=YOUR-OFFSET-HERE"

For swap partition:

GRUB_CMDLINE_LINUX_DEFAULT="... resume=UUID=YOUR-SWAP-UUID-HERE"

Then regenerate GRUB config:

sudo grub-mkconfig -o /boot/grub/grub.cfg

For systemd-boot

Edit your boot entry (usually in /boot/loader/entries/):

sudo nano /boot/loader/entries/arch.conf

Add to the options line:

For swapfile:

options ... resume=UUID=YOUR-UUID-HERE resume_offset=YOUR-OFFSET-HERE

For swap partition:

options ... resume=UUID=YOUR-SWAP-UUID-HERE

Step 3: Configure NVIDIA Power Management

Create or edit the NVIDIA modprobe configuration:

sudo nano /etc/modprobe.d/nvidia.conf

Add these lines:

options nvidia NVreg_PreserveVideoMemoryAllocations=1
options nvidia_drm modeset=1

Step 4: Enable NVIDIA Systemd Services

Enable the NVIDIA power management services:

sudo systemctl enable nvidia-suspend.service
sudo systemctl enable nvidia-hibernate.service
sudo systemctl enable nvidia-resume.service

Step 5: Configure mkinitcpio (THE CRITICAL FIX)

This is the key step that resolves the conflict between early KMS and NVIDIA hibernation.

Edit mkinitcpio configuration:

sudo nano /etc/mkinitcpio.conf

Remove NVIDIA modules from the MODULES array:

Change this:

MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)

To this:

MODULES=()

Ensure the resume hook is present after filesystems:

HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block encrypt filesystems resume fsck)

The resume hook must come after filesystems and before fsck.

Note: If you have encrypted storage, ensure encrypt comes before filesystems.

Step 6: Rebuild Initramfs

Rebuild your initramfs with the new configuration:

For standard Arch/mkinitcpio:

sudo mkinitcpio -P

For Omarchy/limine-mkinitcpio:

sudo limine-mkinitcpio -P

Step 7: Reboot and Test

Reboot your system:

sudo reboot

After reboot, verify the configuration:

# Check that the resume offset is correct
cat /sys/power/resume_offset

# Check that PreserveVideoMemoryAllocations is enabled
cat /proc/driver/nvidia/params | grep PreserveVideoMemoryAllocations

The output should show PreserveVideoMemoryAllocations: 1.

Now test hibernation:

systemctl hibernate

Your system should hibernate completely and, upon powering back on, resume with all applications in their previous state.

Troubleshooting

Still getting "resume device is missing" error

  1. Verify your UUID and offset are correct:
cat /proc/cmdline | grep resume
  1. Check that the resume hook is in your initramfs:
lsinitcpio /boot/initramfs-linux.img | grep resume

System hibernates but resumes as fresh boot

  1. Check journal logs for errors:
sudo journalctl -b -1 | grep -i "PM:"
  1. Verify NVIDIA services ran:
sudo journalctl -b -1 -u nvidia-hibernate.service

NVIDIA driver errors during resume

If you see "nv_pmops_freeze returns -5", ensure you completed Step 5 correctly - this is the most common cause.

Swapfile offset changed after system update

If you recreate your swapfile or it gets defragmented, you must:

  1. Get the new offset using the commands in Step 1
  2. Update your bootloader configuration (Step 2)
  3. Rebuild initramfs (Step 6)
  4. Reboot

Why This Works

The issue occurs because:

  1. Loading NVIDIA modules in early initramfs (early KMS) creates a conflict with NVreg_PreserveVideoMemoryAllocations=1
  2. The NVIDIA driver tries to preserve video memory allocations across hibernation, but early KMS interferes with this process
  3. By removing NVIDIA modules from the initramfs and letting them load normally during boot, the hibernation/resume process can properly save and restore the GPU state

The NVIDIA drivers still load correctly - they just load later in the boot process, after the initramfs stage, which allows hibernation to work properly.

Tested On

  • Omarchy Linux with Limine bootloader
  • NVIDIA GTX 1650 / RTX 2080TI
  • NVIDIA driver version 590.48.01
  • Encrypted Btrfs root with swapfile

This guide should work on any Arch-based distribution with similar configurations.

Credits

Solution derived from troubleshooting sessions and Arch Linux forum discussions regarding NVIDIA hibernation conflicts with early KMS.

About

A fix to enable hibernation resume on Omarchy systems with GTX 1650.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors