Skip to content

Resume from hibernation always fails when the driver is in the initramfs: nv_pm_notifier does not handle PM_RESTORE_PREPARE #1343

Open

Description

@professoramx

Summary

When the NVIDIA modules are loaded from the initramfs (the default on Arch Linux, and
therefore on Arch-derived distributions), resume from hibernation fails 100% of the time
with nv_pmops_freeze returning -EIO, provided NVreg_PreserveVideoMemoryAllocations=1 —
which Arch's own packaging sets by default.

Writing the hibernation image always succeeds. Only the restore fails, and it fails one step
after the image has been read back correctly.

This is distinct from the Blackwell early-KMS hibernation hangs discussed in distribution
trackers: this reproduces on Turing, and it is a logic gap in the PM notifier that is visible
in the source rather than a modesetting problem.

Environment

Driver nvidia-open-dkms 610.57.04
GPU Quadro T2000 (Turing, TU117GLM), 0000:01:00.0
Machine Lenovo ThinkPad P53 (20QN), Optimus laptop
Kernel 7.1.9-arch1-2
Distro Omarchy (Arch-based)
Display topology Only connected output is eDP-1 on the Intel iGPU. nvidia-drm logs Cannot find any crtc or sizes.

Relevant module parameters, all distro defaults:

PreserveVideoMemoryAllocations: 1     # /usr/lib/modprobe.d/gsr-nvidia.conf
UseKernelSuspendNotifiers:      1     # /usr/lib/modprobe.d/nvidia-sleep.conf

Modules early-loaded into the initramfs by /etc/mkinitcpio.conf.d/nvidia.conf:

MODULES+=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)

Steps to reproduce

  1. Arch-based system, nvidia-open-dkms, NVIDIA modules in the initramfs MODULES array.
  2. NVreg_PreserveVideoMemoryAllocations=1 (default if gpu-screen-recorder is installed).
  3. A working hibernation setup — valid resume= and resume_offset=.
  4. systemctl hibernate.
  5. Power the machine back on.

Expected: the session is restored.
Actual: the image is found and read back successfully, then the restore is abandoned and the
machine continues into a fresh boot.

Log

Run /init as init process
nvidia: loading out-of-tree module ...                          <- initramfs
[drm] Initialized nvidia-drm 0.0.0 for 0000:01:00.0 on minor 1
nvidia 0000:01:00.0: [drm] Cannot find any crtc or sizes
PM: Image signature found, resuming
PM: hibernation: Read 5563848 kbytes in 3.28 seconds (1696.29 MB/s)
PM: Image successfully loaded
NVRM: GPU 0000:01:00.0: PreserveVideoMemoryAllocations module parameter is set.
      System Power Management attempted without driver procfs suspend interface. ...
nvidia 0000:01:00.0: PM: pci_pm_freeze(): nv_pmops_freeze [nvidia] returns -5
nvidia 0000:01:00.0: PM: failed to quiesce async: error -5
PM: hibernation: Failed to load image, recovering.
PM: hibernation: resume failed (-5)

Note that the image was read back at 1.7 GB/s with a valid signature — the hibernation setup
itself is entirely correct. The failure is strictly after Image successfully loaded.

Analysis

Restoring a hibernation image is a two-kernel operation. The freshly booted resume kernel
loads the image, then must quiesce its own devices —
hibernation_restore() → dpm_suspend_start(PMSG_QUIESCE) → each driver's .freeze —
before jumping into the restored image. Because the driver is in the initramfs, that resume
kernel has a live, initialised NVIDIA device to freeze.

kernel-open/nvidia/nv.c — nv_pmops_freeze() calls
nvidia_suspend(dev, NV_PM_ACTION_HIBERNATE, is_procfs_suspend=NV_FALSE), and
nvidia_suspend() contains:

if (nv->preserve_vidmem_allocations &&
    nv_dev_needs_vidmem_preservation(nv) &&
    !is_procfs_suspend)
{
    ...
    status = NV_ERR_NOT_SUPPORTED;
    goto done;
}

All three conditions hold on the resume path:

  • preserve_vidmem_allocations — set, via NVreg_PreserveVideoMemoryAllocations=1.
  • nv_dev_needs_vidmem_preservation() (common/inc/nv.h) returns
    !is_tegra_pci_igpu && !NV_IS_SOC_DISPLAY_DEVICE, true for a discrete PCI GPU.
  • is_procfs_suspend is NV_FALSE, because this is the kernel PM callback.

NV_ERR_NOT_SUPPORTED → nv_pmops_freeze returns -EIO → the restore is abandoned.

Why the save path does not hit this. With NVreg_UseKernelSuspendNotifiers=1 the driver
registers nv_pm_notifier. On the way down the kernel fires PM_HIBERNATION_PREPARE, the
notifier runs nv_suspend_devices(), which calls nvidia_suspend(..., is_procfs_suspend=NV_TRUE)
— the permitted path — saves video memory and sets NV_FLAG_SUSPENDED. The subsequent
nv_pmops_freeze then short-circuits on that flag and returns success.

The gap. On the way back up, software_resume() fires PM_RESTORE_PREPARE, and
nv_pm_notifier's switch handles only:

case PM_SUSPEND_PREPARE:
case PM_HIBERNATION_PREPARE:
case PM_POST_SUSPEND:
case PM_POST_HIBERNATION:
default:  return NOTIFY_DONE;      /* PM_RESTORE_PREPARE lands here */

PM_RESTORE_PREPARE falls through to default. Nothing pre-authorises the freeze,
NV_FLAG_SUSPENDED is clear, and the refusal above fires unconditionally.

This is deterministic, not intermittent.

Suggested fix

Handle PM_RESTORE_PREPARE in nv_pm_notifier alongside PM_HIBERNATION_PREPARE, so the
resume kernel's devices are quiesced through the same permitted path the suspend side uses.

Workaround

Keep the NVIDIA modules out of the initramfs, so the resume kernel has no NVIDIA device bound
and there is no .freeze callback to refuse:

# /etc/mkinitcpio.conf.d/zz-nvidia-no-early-load.conf   (must sort last)
_mods=()
for _m in "${MODULES[@]}"; do
  case $_m in nvidia|nvidia_modeset|nvidia_uvm|nvidia_drm) ;; *) _mods+=("$_m") ;; esac
done
MODULES=("${_mods[@]}")
unset _mods _m

Then rebuild the initramfs. On this machine that restored hibernation completely: entry at
11:06:39, resume at 11:07:53, no PM errors, same boot ID — a genuine restore rather than a
fresh boot.

This costs nothing on an Optimus laptop whose only connected display is on the iGPU. It would
not be acceptable on a system where NVIDIA drives the panel and early KMS is wanted, which is
why it is a workaround rather than a fix.

Impact

Any configuration that early-loads the NVIDIA modules with
NVreg_PreserveVideoMemoryAllocations=1 cannot resume from hibernation. On Arch that is the
default pairing: nvidia.conf puts the modules in the initramfs, and gsr-nvidia.conf
(shipped with gpu-screen-recorder) sets the flag.

Activity

  1. tzalkind commented on Sep 8, 2026

    @tzalkind

    Driver: nvidia-open-dkms 610.57.04 (open modules), Ada.
    Related: forum thread "PreserveVideoMemoryAllocations + systemd services causes resume from hibernate to fail" (forums.developer.nvidia.com/t/233643), omarchy #5554, open-gpu-kernel-modules #1080.

    Summary

    When the nvidia driver is loaded inside the initramfs (early KMS), resuming from a hibernate image fails at the driver freeze step with -5, the session is lost, and the system falls back to a fresh boot. When the same driver loads after switch_root (no early KMS), resume completes cleanly. This is reproducible and the fix is local and verified.

    Failure mode with early KMS

    Image writes fine. On the restore boot the initramfs resume hook loads the image, then:

    NVRM: GPU 0000:01:00.0: PreserveVideoMemoryAllocations module parameter is set.
          System Power Management attempted without driver procfs suspend interface.
    nvidia 0000:01:00.0: PM: pci_pm_freeze(): nv_pmops_freeze [nvidia] returns -5
    PM: hibernation: resume failed (-5)
    PM: hibernation: Failed to load image, recovering
    

    Fresh boot follows, session gone.
    With PreserveVideoMemoryAllocations=0 instead of the -5, the image restores and then the GPU dies ~20-55 s later with a Xid cascade (Xid 13 against the compositor, Xid 31 MMU fault charged to post-resume modprobe, uvm global fatal 0x60, "OS Reboot"). Same early-KMS condition. Matches the open upstream reports on Blackwell; confirmed on Ada (RTX 4070 SUPER) here.

    Root cause hypothesis (from 610.57.04 source)

    nv_pm_notifier() (nv.c) registers for PM_SUSPEND_PREPARE, PM_HIBERNATION_PREPARE, PM_POST_SUSPEND, PM_POST_HIBERNATION and falls through to NOTIFY_DONE for PM_RESTORE_PREPARE / PM_POST_RESTORE, the two events the kernel fires on the restore path. The write side passes is_procfs_suspend = NV_TRUE and works; the restore side reaches .freeze -> nv_pmops_freeze -> nvidia_suspend(..., NV_FALSE) on a freshly loaded driver with NV_FLAG_SUSPENDED clear, which trips a guard and returns -EIO (surfacing as -5).
    The initramfs load is the deciding factor: on a restore boot the driver is loaded before systemd runs, so the procfs/notifier suspend handshake cannot happen before .freeze is called. Without early KMS, the driver loads post-switch_root and the resume path completes.

    Fix (verified on this box)

    Remove nvidia from the initramfs. No early KMS.

    sudo mv /etc/mkinitcpio.conf.d/nvidia.conf ~/nvidia.conf.bak
    sudo limine-mkinitcpio

    Result: the console during the initramfs is drawn by simpledrm on the firmware framebuffer (the LUKS prompt still renders), nvidia loads after switch_root, and hibernate restore completes cleanly with no -5 and no Xid cascade. Verified across multiple restore cycles, including after real power-off (S5) restores and platform-mode cycles.
    Note: this contradicts the Blackwell finding recorded in omarchy #5554 (Test 3: removing early KMS gave a black screen on a 5090). On this Ada system with a monitor attached to the dGPU and simpledrm available, removing early KMS is the fix, not a regression.

    Ask

    1. Is the missing PM_RESTORE_PREPARE / PM_POST_RESTORE handling in nv_pm_notifier() intentional?
    2. Should a driver loaded in the initramfs be able to resume from hibernate at all? The Arch wiki and omarchy guidance say early KMS and hibernate are incompatible; if that is a hard limitation, it would be useful documented explicitly per driver branch.
      Happy to attach nvidia-bug-report.sh output or test a candidate fix.
  2. tomaszstachera commented on Sep 27, 2026

    @tomaszstachera

    Confirming this on a discrete desktop GPU, in case the existing reports are all hybrid/laptop — this is not Optimus-specific.

    Environment

    • RTX 4060 Ti 16 GB (AD106), single GPU, no integrated graphics in use
    • Ubuntu 24.04, kernel 7.0.0-34-generic (also reproduced on 7.0.0-31-generic)
    • Driver 580.178.04, proprietary kernel modules; also reproduced on 580.173.02 with the open modules
    • GSP firmware active (GSP Firmware Version: 580.178.04)
    • GNOME 46 / Wayland
    • 36 GiB swapfile on ext4, resume_offset verified against filefrag
    • mem_sleep_default=deep, firmware reports S0 S3 S4 S5
    • nvidia modules are present in the initramfs — lsinitramfs | grep -c nvidia → 561 (Ubuntu's default MODULES=most)

    Behaviour

    The hibernation image writes and reads back perfectly; only the device-freeze step on the resume side fails:

    PM: Image loading progress: 100%
    PM: Image loading done
    PM: hibernation: Read 7302824 kbytes in 3.39 seconds (2154.22 MB/s)
    PM: Image successfully loaded
    nvidia 0000:05:00.0: PM: pci_pm_freeze(): nv_pmops_freeze [nvidia] returns -5
    nvidia 0000:05:00.0: PM: dpm_run_callback(): pci_pm_freeze returns -5
    nvidia 0000:05:00.0: PM: failed to quiesce async: error -5
    PM: hibernation: Failed to load image, recovering.
    PM: hibernation: resume failed (-5)
    

    The machine then continues into a normal boot, discarding a valid image.

    Ruled out

    Still to test: removing the driver from the initramfs, per the title of this issue. Will report back.

    Worth noting this has been present for a while — I filed the same nv_pmops_freeze ... -5 signature against 580.126.09 on 6.17.0-1020-oem nine months ago and it's unchanged across both branches since.

    Separately (different bug, mentioning only so the logs aren't confusing): on Wayland the hibernate write path also deadlocks, with nvidia-sleep.sh blocking on an rw-semaphore held by gnome-shell inside nv_drm_mmap → __nv_drm_gem_nvkms_map. Switching to a text VT before hibernating makes the compositor drop DRM master and avoids it, which is how I get far enough to hit the resume failure above.

  3. astiak commented on Sep 29, 2026

    @astiak

    Confirming this on a different setup: same failure, same workaround, and it also happens with PreserveVideoMemoryAllocations at its default of 2, not just =1.

    System

    • GPU: GeForce RTX 2070 Mobile (Turing), hybrid with Intel iGPU (i7-8750H)
    • Driver: NVIDIA open kernel modules 615.71.09, DKMS-built
    • Kernel: 7.2.7-zen1-1.1-zen (Arch Linux, linux-zen)
    • Modules loaded from the initramfs via MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm) in /etc/mkinitcpio.conf
    • Display topology: the laptop panel is on the Intel GPU; my external monitor (DP) is on the NVIDIA GPU (0000:01:00.0)

    Parameters

    • NVreg_UseKernelSuspendNotifiers=1 (from Arch's nvidia-utils.conf)
    • NVreg_TemporaryFilePath=/var/tmp
    • I do not set NVreg_PreserveVideoMemoryAllocations, and nothing in /etc/modprobe.d or /usr/lib/modprobe.d sets it. /proc/driver/nvidia/params shows PreserveVideoMemoryAllocations: 2.
    • nvidia-suspend, nvidia-hibernate and nvidia-resume services are disabled.

    Behaviour
    Hibernate entry succeeds every time; restore fails every time:

    PM: Image signature found, resuming
    PM: hibernation: Read 12000500 kbytes in 26.78 seconds (448.11 MB/s)
    PM: Image successfully loaded
    NVRM: GPU 0000:01:00.0: PreserveVideoMemoryAllocations module parameter is set. System Power Management attempted without driver procfs suspend interface. Please refer to the 'Configuring Power Management Support' section in the driver README.
    nvidia 0000:01:00.0: PM: pci_pm_freeze(): nv_pmops_freeze [nvidia] returns -5
    nvidia 0000:01:00.0: PM: failed to quiesce async: error -5
    PM: hibernation: Failed to load image, recovering.
    PM: hibernation: resume failed (-5)
    

    The machine then continues into a fresh boot, so the session is lost. This matches the analysis above about PM_RESTORE_PREPARE, and it shows the guard is also hit with the default value 2.

    Workaround
    Setting MODULES=() in /etc/mkinitcpio.conf and rebuilding the initramfs, so that no NVIDIA modules are present in it (lsinitcpio shows no nvidia .ko files), makes hibernate resume work. NVIDIA loads after switch_root instead. This is on a system where NVIDIA drives an external monitor, so the workaround does not depend on NVIDIA having no connected display.

    Side observation (unconfirmed cause)
    After the failed resume, the kernel TPM resource manager was left in a bad state until a full power-off: tpm2_save_context: failed with a TPM error 0x0901, then A TPM error (459) occurred flushing context and tpm2_commit_space: error -14. I have not established whether the driver abort caused this.

  4. prior commented on Oct 3, 2026

    @prior

    Additional data point from an Ada desktop. This does not replace the initramfs -5 report already in this issue. Two results differ from the RTX 4070 SUPER note.

    System

    • Desktop. Discrete RTX 4080 SUPER (10de:2702, AD103). The only monitor is attached to that card's DisplayPort.
    • Idle AMD Raphael iGPU (1002:164e) on an MSI board. Nothing is plugged into the iGPU.
    • nvidia-open 610.57.04, kernel 7.2.5-3-omarchy, Hyprland on Wayland.
    • NVreg_UseKernelSuspendNotifiers=1. nvidia-suspend.service, nvidia-hibernate.service, and nvidia-resume.service disabled. /proc/driver/nvidia/suspend does not exist.

    S3 works on the stock parameters, with the driver loaded from the initramfs. After a reboot onto PreserveVideoMemoryAllocations=1, suspend-to-RAM (mem_sleep=deep) returned to the same session:

    PM: suspend entry (deep)
    PM: suspend exit
    

    No Xid, no modeset error, no compositor crash. This GPU can complete the suspend notifier path that nv_pm_notifier does implement.

    S4 still kills the GPU after the image is restored, even when the driver is not in the initramfs. With PreserveVideoMemoryAllocations=0, and with both the NVIDIA modules and the kms hook left out of the initramfs, resume logged PM: hibernation: hibernation exit in the same boot, then:

    NVRM: Xid: 13, Graphics Exception: Shader Program Header 11 Error
    nvidia-drm: Failed to apply atomic modeset. Error code: -11
    NVRM: Xid: 13, name=Hyprland
    NVRM: Xid: 13, name=quickshell
    nvidia-drm: Flip event timeout on head 0
    NVRM: Xid: 31, MMU Fault: ENGINE CE2_PBDMA0 HUBCLIENT_ESC, FAULT_PDE, ACCESS_TYPE_VIRT_READ
    NVRM: Xid: 154, GPU recovery action changed from None to OS Reboot
    NVRM: uvm encountered global fatal error 0x60, requiring os reboot to recover
    

    Hyprland crashed on the first frame. The driver required a reboot. On the 4070 SUPER, leaving the modules out of the initramfs produced a clean restore. It did not here.

    This was not the combination reported working on an RTX 5070 Ti (early KMS removed, PreserveVideoMemoryAllocations left at 1, and the three NVIDIA sleep services enabled). That combination was not tested on this machine.

    The same Xid 13, modeset -11, Xid 154 sequence also happened on an S3 wake while the running kernel still had PreserveVideoMemoryAllocations=0 loaded from an earlier boot. After rebooting so the parameter was actually 1, S3 was clean, as above.

    (authored by grok)

  5. vnt-83 commented on Oct 4, 2026

    @vnt-83

    Confirming this on another setup, this time Ampere + EndeavourOS/dracut, with the current 615 branch. Same failure signature and the same workaround fixes it.

    System

    • Laptop: ASUS TUF Gaming F17 FX706HE
    • GPU: GeForce RTX 3050 Ti Laptop GPU (Ampere) + Intel iGPU
    • Distro: EndeavourOS
    • Kernel: 7.2.7-zen1-1-zen
    • Driver: nvidia-open-dkms 615.71.09
    • systemd: 262
    • initramfs: dracut (112_eos-1)
    • dedicated swap partition, resume=UUID=... configured correctly
    • /proc/driver/nvidia/params:
      • PreserveVideoMemoryAllocations: 2
      • UseKernelSuspendNotifiers: 1
    • nvidia-suspend.service, nvidia-hibernate.service, and nvidia-resume.service are disabled.

    Failure with NVIDIA in initramfs

    Hibernate entry itself succeeds and the machine powers off normally.

    On power-on, the image is found and completely read:

    PM: Image signature found, resuming
    PM: hibernation: resume from hibernation
    PM: Loading and decompressing image data (6228867 pages)...
    PM: Image loading done
    PM: hibernation: Read 24915468 kbytes in 9.61 seconds (2592.66 MB/s)
    PM: Image successfully loaded
    

    Immediately afterwards:

    NVRM: GPU 0000:01:00.0: PreserveVideoMemoryAllocations module parameter is set.
    System Power Management attempted without driver procfs suspend interface.
    
    nvidia 0000:01:00.0: PM: pci_pm_freeze(): nv_pmops_freeze [nvidia] returns -5
    nvidia 0000:01:00.0: PM: dpm_run_callback(): pci_pm_freeze returns -5
    nvidia 0000:01:00.0: PM: failed to quiesce async: error -5
    PM: hibernation: Failed to load image, recovering.
    PM: hibernation: resume failed (-5)
    

    The system then continues with a fresh boot.

    This confirms that the swap/resume setup is working; the failure happens after Image successfully loaded.

    Workaround with dracut

    I excluded NVIDIA from the initramfs:

    # /etc/dracut.conf.d/omit-nvidia-hibernate.conf
    omit_drivers+=" nvidia nvidia_drm nvidia_modeset nvidia_uvm "

    Then rebuilt the images with:

    reinstall-kernels

    Verified afterwards for both installed kernels:

    7.2.7-zen1-1-zen:
    NVIDIA_IN_INITRD=NO
    RESUME_MODULE=YES
    
    7.2.7-arch1-1:
    NVIDIA_IN_INITRD=NO
    RESUME_MODULE=YES
    

    After reboot the ordering changed as expected:

    ~1.63s  Starting Resume from hibernation...
    ~1.65s  Finished Resume from hibernation.
    
    ~3.75s  nvidia: loading out-of-tree module
    ~5.56s  NVRM: loading NVIDIA UNIX Open Kernel Module 615.71.09
    

    Result

    A subsequent real S4 test succeeded.

    After manually powering the laptop back on:

    PM: hibernation: hibernation exit
    System returned from sleep operation 'hibernate'.
    Operation 'hibernate' finished.
    

    The boot ID remained unchanged, confirming a genuine image restore rather than a fresh boot.

    The previous nv_pmops_freeze ... returns -5 / resume failed (-5) errors were absent, and the NVIDIA GPU remained functional afterwards:

    NVIDIA GeForce RTX 3050 Ti Laptop GPU, 615.71.09
    

    So this reproduces #1343 on Ampere / 615.71.09 / dracut, and keeping the NVIDIA modules out of the initramfs fixes hibernate resume on this machine as well.

  6. thisfilipe commented on Oct 18, 2026

    @thisfilipe

    Datapoint: reproduces on Pop!_OS 24.04 with the distribution's NVIDIA 595 branch
    (595.104.02, open kernel modules, DKMS), and the deciding factor is the initramfs —
    confirming the title of this issue, and showing the guard is also hit with
    PreserveVideoMemoryAllocations at its default of 2.

    Environment

    • Pop!_OS 24.04; ASUS TUF Gaming A15 FA506NCR; panel driven by the AMD iGPU
    • GPU: NVIDIA RTX 3050 Mobile (GA107M, 10de:25a2), Optimus
    • Driver: nvidia-driver-595 / nvidia-dkms-595 595.104.02 (open modules, DKMS)
    • Kernel: 7.2.6-76070206-generic (fails) vs 7.1.5-76070105-generic (works)
    • Swap partition + resume=UUID=...; nothing custom in
      /usr/lib/systemd/system-sleep/
    • Parameters: PreserveVideoMemoryAllocations: 2 (nothing in /etc/modprobe.d or
      /usr/lib/modprobe.d sets it), UseKernelSuspendNotifiers: 1,
      TemporaryFilePath: "/var/tmp", /proc/driver/nvidia/suspend absent

    With the modules in the initramfs (kernel 7.2.6) — fails 2/2, deterministic

    PM: Image signature found, resuming
    PM: hibernation: Read 3178516 kbytes in 1.76 seconds (1805.97 MB/s)
    PM: Image successfully loaded
    NVRM: GPU 0000:01:00.0: PreserveVideoMemoryAllocations module parameter is set.
          System Power Management attempted without driver procfs suspend interface.
    nvidia 0000:01:00.0: PM: pci_pm_freeze(): nv_pmops_freeze [nvidia] returns -5
    nvidia 0000:01:00.0: PM: failed to quiesce async: error -5
    PM: hibernation: Failed to load image, recovering. / resume failed (-5)
    

    Driver loaded early in that same boot:

    Run /init as init process
    nvidia: loading out-of-tree module taints kernel.
    NVRM: loading NVIDIA UNIX Open Kernel Module for x86_64  595.104.02
    PM: Image signature found, resuming
    

    Without the modules in the initramfs (kernel 7.1.5) — resumes 6/6, session restored

    The distribution hook (/usr/share/initramfs-tools/hooks/framebuffer-nvidia, from
    nvidia-kernel-common-595) only copies files matching nvidia*.ko. For 7.1.5, DKMS
    produced nvidia*.ko.zst (compressed), so nothing was copied; for 7.2.6 it produced
    uncompressed nvidia*.ko and the hook copied all five modules into the initramfs
    (initrd 137 MB → 225 MB). Real power-off cycles on 7.1.5 restored the same boot ID
    (six cycles, including one right after the 7.2.6 failures).

    Question

    Given that the write path relies on PM_HIBERNATION_PREPARE (handled) while the restore
    path fires PM_RESTORE_PREPARE (not handled): is handling PM_RESTORE_PREPARE /
    PM_POST_RESTORE in nv_pm_notifier() still the planned fix, and is there any
    recommended mitigation for kernels/distributions that load the driver from the initramfs by
    default? Happy to attach nvidia-bug-report.sh output or test a candidate fix.

  7. luke-pritch commented on Oct 23, 2026

    @luke-pritch

    Additional report: RTX 4090 / NVIDIA open 615.78.08 / Omarchy. My observed failure matches the image-load-then-freeze-error sequence in this issue.

    Environment

    • GPU: GeForce RTX 4090 (AD102, PCI ID 10de:2684), device 0000:01:00.0.
    • Distribution: Omarchy 4.0.6-1 (Arch-based), Hyprland/Wayland.
    • Kernel: 7.2.8-9-omarchy.
    • Packages: nvidia-open-dkms 615.78.08-1, nvidia-utils 615.78.08-1, gpu-screen-recorder 6.1.4-1.
    • Display: HDMI, 3840×2160 at approximately 180 Hz.
    • Storage: Btrfs swapfile /swap/swapfile on encrypted root, approximately 60.4 GiB.
    • Boot parameters include resume=/dev/mapper/root resume_offset=1928558.
    • NVIDIA suspend, hibernate, and resume systemd services are disabled.

    Relevant configuration

    /proc/driver/nvidia/params:

    PreserveVideoMemoryAllocations: 1
    UseKernelSuspendNotifiers: 1
    TemporaryFilePath: "/var/tmp"
    

    /etc/mkinitcpio.conf.d/nvidia.conf:

    MODULES+=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)

    /etc/mkinitcpio.conf.d/omarchy_resume.conf:

    HOOKS+=(resume)

    PreserveVideoMemoryAllocations=1 is explicitly set by /usr/lib/modprobe.d/gsr-nvidia.conf:

    options nvidia NVreg_PreserveVideoMemoryAllocations=1
    

    Observed failure

    On October 23, 2026 at 16:38:32 EDT, hypridle executed systemctl hibernate after 30 minutes of inactivity. The machine powered off. At the subsequent startup, the kernel found the hibernation image and read it completely, then NVIDIA's freeze callback failed. Startup continued into a fresh session rather than restoring my applications.

    Relevant kernel log from that startup:

    PM: Image signature found, resuming
    PM: hibernation: Read 20844088 kbytes in 5.45 seconds (3824.60 MB/s)
    PM: Image successfully loaded
    NVRM: GPU 0000:01:00.0: PreserveVideoMemoryAllocations module parameter is set. System Power Management attempted without driver procfs suspend interface. Please refer to the 'Configuring Power Management Support' section in the driver README.
    nvidia 0000:01:00.0: PM: pci_pm_freeze(): nv_pmops_freeze [nvidia] returns -5
    nvidia 0000:01:00.0: PM: dpm_run_callback(): pci_pm_freeze returns -5
    nvidia 0000:01:00.0: PM: failed to quiesce async: error -5
    PM: hibernation: Failed to load image, recovering.
    PM: hibernation: resume failed (-5)
    

    This establishes that the resume device and offset were sufficient to locate and read the image; the logged failure happens afterward in the NVIDIA device-freeze step. The underlying notifier explanation in this issue appears consistent with my logs, but I have not independently verified the driver source-level cause.

    Testing status

    This report covers one observed failed restore. I have disabled automatic idle hibernation to prevent further session loss. I have not yet tested removing NVIDIA from the initramfs, changing video-memory preservation, or patching the driver.

  8. michsob commented on Nov 6, 2026

    @michsob

    Another data point, from a Blackwell desktop where NVIDIA is the only GPU, plus a workaround that keeps early KMS on normal boots.

    System

    • GeForce RTX 5060 Ti (10de:2d04) at 0000:0a:00.0; desktop, no iGPU, every monitor on the NVIDIA card
    • Omarchy (Arch-based), kernel 7.1.8-arch1-3, now 7.2.8-9-omarchy
    • nvidia-open-dkms 610.57.04, now 615.78.08; modules in the initramfs via mkinitcpio (MODULES+=(nvidia nvidia_modeset nvidia_uvm nvidia_drm), busybox init)
    • PreserveVideoMemoryAllocations: 1 (from gpu-screen-recorder's gsr-nvidia.conf), UseKernelSuspendNotifiers: 1; nvidia-{suspend,hibernate,resume}.service disabled; /proc/driver/nvidia/suspend absent
    • LUKS root, btrfs swapfile, resume=/dev/mapper/root resume_offset=...

    Failure (610.57.04), same signature as the issue:

    PM: Image successfully loaded
    NVRM: GPU 0000:0a:00.0: PreserveVideoMemoryAllocations module parameter is set.
          System Power Management attempted without driver procfs suspend interface.
    nvidia 0000:0a:00.0: PM: pci_pm_freeze(): nv_pmops_freeze [nvidia] returns -5
    PM: hibernation: Failed to load image, recovering.
    PM: hibernation: resume failed (-5)
    

    I haven't re-run 615.78.08 without the workaround below, but the notifier is unchanged there, and the Omarchy / 615.78.08 report above shows the same failure.

    Still unhandled in 620.70.06. At tag 620.70.06, nv_pm_notifier() in kernel-open/nvidia/nv.c (L4683-4694) still handles only PM_SUSPEND_PREPARE, PM_HIBERNATION_PREPARE, PM_POST_SUSPEND and PM_POST_HIBERNATION, as in 610.57.04 and 615.78.08.

    PreserveVideoMemoryAllocations=0 doesn't work around it on Blackwell either. The image restored, then Hyprland hit a GL assertion about 65 s later, and restarting it produced Xid 31 (MMU fault) followed by Xid 154 (recovery action: OS Reboot). That matches the Ada reports above.

    Workaround: unload the driver in the resume kernel only. Taking the modules out of the initramfs works, but it costs early KMS on every boot. Only the resume kernel needs the driver gone, and that kernel is discarded once the image is loaded. So a mkinitcpio hook ordered right before resume reads the swap signature at resume=/resume_offset=:

    • S1SUSPEND (an image is waiting): quit Plymouth, then rmmod nvidia_uvm nvidia_drm nvidia_modeset nvidia. With no NVIDIA device bound there is nothing for .freeze to refuse. The restored kernel still has its own driver, suspended through PM_HIBERNATION_PREPARE with VRAM preserved.
    • Anything else: do nothing. Normal boots keep Plymouth and the LUKS prompt on the NVIDIA framebuffer.
    • If the image turns out not to restore, a late hook reloads the modules so the fresh boot still has the driver.

    Results: 25 clean restores on 610.57.04 (Aug 23 - Oct 16) and 13 on 615.78.08 (Oct 20 - Nov 6). Every hibernation entry/exit pair stayed in the same boot ID, with no Xid and no nv_pmops errors, and the GPU and Hyprland session came back intact. The only cost is an extra blank/modeset between the LUKS prompt and the restored session.

    My first version of the hook failed with the same -5 because the unload didn't happen, and with quiet there was nothing in the log to say so: mkinitcpio's msg() is silent, and init runs resume regardless of a hook's return value. The version below logs every step to /dev/kmsg, quits Plymouth with plymouth --wait quit (Plymouth holds /dev/dri/card0 and therefore nvidia_drm), retries rmmod, and unbinds fbcon from the nvidia-drm framebuffer if nvidia_drm stays busy. I didn't isolate which of those changes was the one that mattered.

    Hook files (mkinitcpio, busybox init), as tested

    /etc/initcpio/hooks/nvidia-resume-unload:

    #!/usr/bin/ash
    # Runs right before the `resume` hook.
    #
    # Why: with early KMS the NVIDIA modules are already bound to the GPU when the kernel
    # tries to restore a hibernation image. The restore path sends PM_RESTORE_PREPARE,
    # which the driver's PM notifier ignores (nv.c: nv_pm_notifier only handles
    # *_PREPARE for suspend/hibernate and the POST_* events), so the subsequent freeze()
    # callback finds an initialised GPU, PreserveVideoMemoryAllocations=1 and no procfs
    # suspend -> returns -EIO -> "PM: hibernation: resume failed (-5)".
    #
    # Fix: if, and only if, the swap header says an image is present, quit Plymouth and
    # unload nvidia_uvm/nvidia_drm/nvidia_modeset/nvidia so there is nothing for the
    # kernel to freeze. The boot kernel is discarded once the image is loaded; the
    # restored kernel carries its own driver state. Normal boots (no image) are left
    # completely untouched -- Plymouth and the LUKS prompt stay on the NVIDIA framebuffer.
    #
    # Everything this hook does is written to /dev/kmsg, so it shows up in
    # `journalctl -b -k | grep nvidia-resume-unload` of the boot that follows (mkinitcpio's
    # own msg() is silent under `quiet`).
    
    nru_log() {
        echo "<6>nvidia-resume-unload: $*" > /dev/kmsg 2>/dev/null
    }
    
    # processes holding /dev/dri/*, /dev/fb* or /dev/nvidia* open (diagnostics only)
    nru_openers() {
        local p
        for p in /proc/[0-9]*; do
            ls -l "$p/fd" 2>/dev/null | grep -q -E '/dev/(dri/|fb|nvidia)' &&
                printf '%s(%s) ' "${p#/proc/}" "$(cat "$p/comm" 2>/dev/null)"
        done
    }
    
    nru_unbind_fbcon() {
        local c
        for c in /sys/class/vtconsole/vtcon*; do
            grep -q 'frame buffer' "$c/name" 2>/dev/null || continue
            echo 0 > "$c/bind" 2>/dev/null && nru_log "unbound fbcon ($c)"
        done
    }
    
    run_hook() {
        local resume offset dev sig m i
    
        [ -n "$(getarg noresume)" ] && return 0
        if [ ! -d /sys/module/nvidia ]; then
            nru_log "nvidia not loaded in the initramfs, nothing to do"
            return 0
        fi
    
        resume="$(getarg resume)"
        [ -n "$resume" ] || return 0
        offset="$(getarg resume_offset)"
    
        if ! dev="$(resolve_device "$resume")"; then
            nru_log "cannot resolve resume device '$resume'"
            return 0
        fi
    
        # Last 10 bytes of the swap header page: "SWAPSPACE2" normally, "S1SUSPEND" when
        # a hibernation image is waiting. resume_offset is in PAGE_SIZE units.
        sig="$(dd if="$dev" bs=4096 skip="${offset:-0}" count=1 2>/dev/null | tail -c 10 | head -c 9)"
        case "$sig" in
            *SUSPEND) ;;
            *)  nru_log "swap header at $dev +${offset:-0} reads '$sig': no image, normal boot"
                return 0 ;;                         # boot proceeds exactly as before
        esac
    
        nru_log "hibernation image found at $dev +${offset:-0}, unloading NVIDIA driver before resume"
    
        # Plymouth holds /dev/dri/card0 (a module reference on nvidia_drm). --wait makes the
        # client return only after the daemon has actually exited.
        if plymouth --ping 2>/dev/null; then
            plymouth --wait quit 2>/dev/null
            nru_log "plymouth quit (rc=$?)"
        fi
    
        for m in nvidia_uvm nvidia_drm nvidia_modeset nvidia; do
            [ -d "/sys/module/$m" ] || continue
            i=0
            while ! rmmod "$m" 2>/dev/null; do
                i=$((i + 1))
                # fbcon bound to the nvidia-drm framebuffer can keep nvidia_drm busy
                [ "$i" -eq 5 ] && [ "$m" = nvidia_drm ] && nru_unbind_fbcon
                if [ "$i" -ge 25 ]; then
                    nru_log "FAILED to unload $m after ${i} tries: refcnt=$(cat "/sys/module/$m/refcnt" 2>/dev/null) holders=[$(echo $(ls "/sys/module/$m/holders" 2>/dev/null))] openers=[$(nru_openers)]"
                    err "nvidia-resume-unload: could not unload $m, resume will probably fail"
                    return 1
                fi
                sleep 0.2
            done
            nru_log "unloaded $m (tries: $((i + 1)))"
        done
    
        : > /run/nvidia-resume-unload
        nru_log "driver unloaded, handing over to resume"
        return 0
    }
    
    # Only reached if the image was found but the kernel came back from /sys/power/resume,
    # i.e. the restore failed for some other reason. Put the driver back so the normal
    # boot that follows still has it.
    run_latehook() {
        [ -e /run/nvidia-resume-unload ] || return 0
        nru_log "image was not restored, reloading NVIDIA driver"
        err "nvidia-resume-unload: image was not restored, reloading NVIDIA driver"
        modprobe -a nvidia nvidia_modeset nvidia_uvm nvidia_drm 2>/dev/null
        rm -f /run/nvidia-resume-unload
        return 0
    }
    
    # vim: set ft=sh ts=4 sw=4 et:

    /etc/initcpio/install/nvidia-resume-unload:

    #!/usr/bin/env bash
    # mkinitcpio install hook for nvidia-resume-unload (see the runtime hook for what it does).
    
    build() {
        add_runscript
    }
    
    help() {
        cat <<HELPEOF
    Unloads the NVIDIA kernel modules right before the 'resume' hook, but only when
    the swap header at resume=/resume_offset= carries a hibernation image. Keeps
    early KMS (Plymouth + LUKS prompt on the NVIDIA framebuffer) while avoiding the
    driver's failing freeze callback during image restore. Must be ordered before
    'resume' in HOOKS.
    HELPEOF
    }
    
    # vim: set ft=sh ts=4 sw=4 et:

    /etc/mkinitcpio.conf.d/zz-nvidia-resume-unload.conf (places the hook directly before resume; must sort after the drop-in that adds resume):

    # Hibernation fix 04: insert the nvidia-resume-unload hook directly before `resume`.
    # Sorts after omarchy_resume.conf (which appends resume), so it sees the final HOOKS.
    _nru_hooks=()
    for _nru_hook in ${HOOKS[@]+"${HOOKS[@]}"}; do
        [[ $_nru_hook == resume ]] && _nru_hooks+=(nvidia-resume-unload)
        _nru_hooks+=("$_nru_hook")
    done
    HOOKS=(${_nru_hooks[@]+"${_nru_hooks[@]}"})
    unset _nru_hooks _nru_hook

    Then rebuild the initramfs. A dracut system would need the same logic in a pre-resume hook; I haven't tried that.

    This is only a workaround. The fix is still to handle PM_RESTORE_PREPARE / PM_POST_RESTORE in nv_pm_notifier() as proposed in the issue. I'm happy to test a candidate patch on this card.

  9. orium commented on Nov 30, 2026

    @orium

    Same failure on a Blackwell laptop: RTX 5070 Ti Laptop GPU (GB205M, 10de:2f58) in an ASUS ROG Strix G16 (G614FR), with an AMD iGPU driving the panel. Arch Linux, kernel 7.2.15, nvidia-open 615.78.08, parameters at their defaults (PreserveVideoMemoryAllocations: 2, UseKernelSuspendNotifiers: 1), modules in the initramfs. Same log as in the issue, from PM: Image successfully loaded to PM: hibernation: resume failed (-5).

    Two things that aren't in this thread yet:

    1. It defeats hybrid sleep on low battery. My image didn't come from systemctl hibernate: UPower ran hybrid-sleep at low battery (it does that instead of a configured Suspend unless AllowRiskyCriticalPowerAction=true). The image was written, the laptop didn't wake from the suspend part, and on the next boot the restore failed as above. Hybrid sleep writes that image for exactly this case, so with the driver in the initramfs, laptops lose the session in the one situation the image exists for.
    2. It's still there in 620.73.04. nv_pm_notifier() still only handles PM_SUSPEND_PREPARE, PM_HIBERNATION_PREPARE, PM_POST_SUSPEND and PM_POST_HIBERNATION.

    Keeping the modules out of the initramfs (MODULES=()) fixes it here too: on 620.73.04 and kernel 7.3.6, after systemctl hibernate and a power-on, the session is restored in the same boot, with no nv_pmops errors.

  10. migbernsil commented on Dec 1, 2026

    @migbernsil

    Another data point: Ada laptop, 615.78.08, and nv_pm_notifier() is still unchanged in 620.73.04.

    • Dell Precision 7680: RTX 2000 Ada Laptop (AD107GLM) + Intel Raptor Lake iGPU. External monitor on the NVIDIA GPU's outputs (tested over USB-C DisplayPort and HDMI).
    • Omarchy (Arch-based), kernel 7.2.15, nvidia-open-dkms 615.78.08, modules early-loaded from the initramfs (busybox mkinitcpio).
    • PreserveVideoMemoryAllocations: 1, UseKernelSuspendNotifiers: 1, /proc/driver/nvidia/suspend absent.
    • Same failure: Image successfully loaded, then nv_pmops_freeze returns -5 and resume failed (-5), on every attempt.

    I compared nv_pm_notifier() across tags 595.112.13, 610.57.04, 615.78.08, 620.70.06 and 620.73.04. None of them handles PM_RESTORE_PREPARE or PM_POST_RESTORE.

    The workaround described above by michsob, unloading the modules before resume and only when the swap holds an image, works on this machine. I've proposed it to Omarchy (omacom/omarchy#21042). A driver-side fix would make it unnecessary. One way: on PM_RESTORE_PREPARE, let nv_pmops_freeze() quiesce without preserving video memory, since the boot kernel's GPU state is thrown away once the image is restored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions