Skip to content

Instantly share code, notes, and snippets.

@bmcbm
Last active April 6, 2026 19:23
Show Gist options
  • Select an option

  • Save bmcbm/375f14eaa17f88756b4bdbbebbcfd029 to your computer and use it in GitHub Desktop.

Select an option

Save bmcbm/375f14eaa17f88756b4bdbbebbcfd029 to your computer and use it in GitHub Desktop.
NVIDIA Suspend fix
# Use systemd for managing NVIDIA driver suspend in drivers ====>>> PRIOR to version 470 <<<=====
# https://download.nvidia.com/XFree86/Linux-x86_64/450.66/README/powermanagement.html
# https://forums.developer.nvidia.com/t/unable-to-set-nvidia-kernel-module-parameters/161306
# Please note: In Fedora Linux you may need to just install the xorg-x11-drv-nvidia-power pakage
# as sugested by @goombah88 in the comments below.
TMP_PATH=/var/tmp
TMPL_PATH=/usr/share/doc/nvidia-driver-460/
echo "options nvidia NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=${TMP_PATH}" | sudo tee /etc/modprobe.d/nvidia-power-management.conf
sudo install --mode 644 "${TMPL_PATH}/nvidia-suspend.service" /etc/systemd/system
sudo install --mode 644 "${TMPL_PATH}/nvidia-hibernate.service" /etc/systemd/system
sudo install --mode 644 "${TMPL_PATH}/nvidia-resume.service" /etc/systemd/system
sudo install "${TMPL_PATH}/nvidia" /lib/systemd/system-sleep
sudo install "${TMPL_PATH}/nvidia-sleep.sh" /usr/bin
sudo systemctl enable nvidia-suspend.service
sudo systemctl enable nvidia-hibernate.service
sudo systemctl enable nvidia-resume.service
@lobsang-yangjin
Copy link
Copy Markdown

It works for me. I got Ubuntu 24.04 and nvidia driver Version: 575.57.08.

The original status was:

$ systemctl list-unit-files | grep nvidia
nvidia-hibernate.service                       disabled        enabled
nvidia-persistenced.service                    enabled         enabled
nvidia-powerd.service                          disabled        enabled
nvidia-resume.service                          disabled        enabled
nvidia-suspend-then-hibernate.service          disabled        enabled
nvidia-suspend.service                         disabled        enabled

I ran the following command:

$ sudo systemctl enable nvidia-suspend.service
sudo systemctl enable nvidia-hibernate.service
sudo systemctl enable nvidia-resume.service
Created symlink /etc/systemd/system/systemd-suspend.service.wants/nvidia-suspend.service → /usr/lib/systemd/system/nvidia-suspend.service.
Created symlink /etc/systemd/system/systemd-hibernate.service.wants/nvidia-hibernate.service → /usr/lib/systemd/system/nvidia-hibernate.service.
Created symlink /etc/systemd/system/systemd-suspend.service.wants/nvidia-resume.service → /usr/lib/systemd/system/nvidia-resume.service.
Created symlink /etc/systemd/system/systemd-hibernate.service.wants/nvidia-resume.service → /usr/lib/systemd/system/nvidia-resume.service.
Created symlink /etc/systemd/system/systemd-suspend-then-hibernate.service.wants/nvidia-resume.service → /usr/lib/systemd/system/nvidia-resume.service.

And then the problem is fixed. It does not wake up immediately after suspending any more:

$ systemctl list-unit-files | grep nvidia
nvidia-hibernate.service                       enabled         enabled
nvidia-persistenced.service                    enabled         enabled
nvidia-powerd.service                          disabled        enabled
nvidia-resume.service                          enabled         enabled
nvidia-suspend-then-hibernate.service          disabled        enabled
nvidia-suspend.service                         enabled         enabled

@actinks
Copy link
Copy Markdown

actinks commented Oct 8, 2025

sudo systemctl unmask nvidia-suspend
sudo systemctl enable nvidia-suspend
sudo systemctl unmask nvidia-resume
sudo systemctl enable nvidia-resume
sudo systemctl unmask nvidia-hibernate
sudo systemctl enable nvidia-hibernate

This fixed my issues! Ubuntu 24.04.3 LTS, Driver Version: 580.82.07, CUDA Version: 12.8

@audio441
Copy link
Copy Markdown

Initial tests, this works for me on Mint 22.2, Driver Version: 580.105.08 to get suspend working:
systemctl enable nvidia-suspend.service
systemctl enable nvidia-hibernate.service
systemctl enable nvidia-resume.service

my /etc/modprobe.d/nvidia-graphics-drivers-kms.conf:
options nvidia-drm modeset=1
options nvidia NVreg_PreserveVideoMemoryAllocations=0
options nvidia NVreg_TemporaryFilePath=/var/tmp

@rosscondie
Copy link
Copy Markdown

Fedora 43 Workstation
ThinkPad P16s Gen 2
6.18.6-200.fc43.x86_64
GNOME 49.3
GPU 1: NVIDIA RTX A500 Laptop GPU
GPU 2: Intel Iris Xe Graphics @ 1.50GHz [Integrated]

/etc/modeprobe.d/nvidia.conf:

# Disable Nvidia modesetting for hyprid graphics
options nvidia-drm modeset=0

# Enable dynamic power management
options nvidia NVreg_DynamicPowerManagement=0x02

# Disable GSP firmware (can cause issues on some laptops)
options nvidia NVreg_EnableGpuFirmware=0

# Preserve video memory allocations across suspend/resume
options nvidia NVreg_PreserveVideoMemoryAllocations=1

# Disable S0ix power management
options nvidia NVreg_EnableS0ixPowerManagement=0

I tried the systemctl enable nvidia commands but this never fixed my problem.

What worked for me was disabling USB and THunderbolt wake:

# Disable XHCI (USB)
echo XHCI | sudo tee /proc/acpi/wakeup

# Disable TXHC (Thunderbolt)
echo TXHC | sudo tee /proc/acpi/wakeup

# Verify both are disabled
cat /proc/acpi/wakeup | grep -E "XHCI|TXHC"

Both should be *disabled - I have to use my laptop keyboard/trackpad to resume but I am fine with that so keep it in mind if you are not using a laptop.

I think that something was sending wake signals hence why I disabled those.

To make it permanent create a service for it:

/etc/systemd/system/disable-usb-wakeup.service:

[Unit]
Description=Disable USB wakeup to prevent spurious wake events
After=multi-user.target

[Service]
Type=oneshot
ExecStart=/bin/sh -c 'echo XHCI > /proc/acpi/wakeup; echo TXHC > /proc/acpi/wakeup'

[Install]
WantedBy=multi-user.target
sudo systemctl enable disable-usb-wakeup.service
sudo systemctl start disable-usb-wakeup.service

@thandal
Copy link
Copy Markdown

thandal commented Feb 22, 2026

Ubuntu 24.04
nvidia-driver-590-open 590.48.01
NVIDIA GeForce RTX 3080

$ echo $XDG_SESSION_TYPE
x11

(not running Wayland)

The first line below (from journalctl -b -1) was key for me:

kernel: 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.
kernel: nvidia 0000:01:00.0: PM: pci_pm_suspend(): nv_pmops_suspend+0x0/0x50 [nvidia] returns -5
kernel: nvidia 0000:01:00.0: PM: dpm_run_callback(): pci_pm_suspend+0x0/0x1b0 returns -5
kernel: nvidia 0000:01:00.0: PM: failed to suspend async: error -5
kernel: PM: Some devices failed to suspend, or early wake event detected

Following that clue (and working my way through all the ideas described in this thread), I edited /etc/modprobe.d/nvidia-graphics-drivers-kms.conf to

# This file was generated by nvidia-driver-590
# Set value to 0 to disable modesetting
options nvidia_drm modeset=1

# Preserve video memory on suspend/resume
options nvidia NVreg_PreserveVideoMemoryAllocations=0  # <-- this is all I changed
options nvidia NVreg_TemporaryFilePath=/var

and ran sudo update-initramfs -u and rebooted.

... I also enabled a bunch of services, but I'm not sure it was necessary (and definitely wasn't sufficient):

$ systemctl list-unit-files | grep nvidia
nvidia-hibernate.service                     enabled         enabled
nvidia-persistenced.service                  static          -
nvidia-resume.service                        enabled         enabled
nvidia-suspend-then-hibernate.service        enabled         enabled
nvidia-suspend.service                       enabled         enabled

@simevo
Copy link
Copy Markdown

simevo commented Feb 22, 2026

On Debian 13 (Trixie) I have fiddled with nvidia CUDA toolkit installed from https://developer.nvidia.com/cuda-downloads, then uninstalled it and opted for the Debian native packages (nvidia-cuda-toolkit).

As reported by others here, after the reboot suspend is broken, and there are broken symlinks:

find /etc/systemd -type l -exec file {} \; | grep broken | grep nvidia
/etc/systemd/system/systemd-suspend.service.wants/nvidia-suspend.service: broken symbolic link to /usr/lib/systemd/system/nvidia-suspend.service
/etc/systemd/system/systemd-suspend.service.wants/nvidia-resume.service: broken symbolic link to /usr/lib/systemd/system/nvidia-resume.service
/etc/systemd/system/systemd-hibernate.service.wants/nvidia-resume.service: broken symbolic link to /usr/lib/systemd/system/nvidia-resume.service
/etc/systemd/system/systemd-hibernate.service.wants/nvidia-hibernate.service: broken symbolic link to /usr/lib/systemd/system/nvidia-hibernate.service

ls -l /etc/systemd/system/systemd-suspend.service.wants/nvidia-resume.service
lrwxrwxrwx 1 root root 45 12 set 07.16 /etc/systemd/system/systemd-suspend.service.wants/nvidia-resume.service -> /usr/lib/systemd/system/nvidia-resume.service

In my case though, I fixed not by removing the symlinks, but by restoring the targets:

sudo apt remove nvidia-suspend-common
sudo apt install nvidia-suspend-common
ls -l /usr/lib/systemd/system/nvidia*
-rw-r--r-- 1 root root  270  8 apr  2025 /usr/lib/systemd/system/nvidia-hibernate.service
-rw-r--r-- 1 root root 1501 17 dic 02.37 /usr/lib/systemd/system/nvidia-persistenced.service
-rw-r--r-- 1 root root  321  8 apr  2025 /usr/lib/systemd/system/nvidia-resume.service
-rw-r--r-- 1 root root  258  8 apr  2025 /usr/lib/systemd/system/nvidia-suspend.service

Now the symlinks are not broken anymore and suspend/resume works again! Hope this helps

@Thermionix
Copy link
Copy Markdown

Attempting to solve wake to unresponsive blackscreen on a Acer Nitro ANV16S-41 (Latest BIOS is 1.12) w/ RTX 5050
Archlinux w/ KDE 6.6.3
Not responsive to TTY swithc or SSH upon wake; have to SysRq reboot
Following ArchWiki - Preserve_video_memory_after_suspend
No useful errors in journalctl output?

$ cat /sys/class/dmi/id/product_name
Nitro ANV16S-41

$ cat /sys/class/dmi/id/bios_version
V1.12

$ uname -r
6.19.11-arch1-1

$ nvidia-smi --version
DRIVER version      : 595.58.03

$ cat /etc/modprobe.d/blacklist.conf
blacklist amdgpu

$  systemctl is-enabled nvidia-suspend.service nvidia-hibernate.service nvidia-resume.service
disabled
disabled
disabled

$ cat /etc/modprobe.d/nvidia.conf
options nvidia-drm modeset=1
options nvidia NVreg_PreserveVideoMemoryAllocations=1
options nvidia NVreg_TemporaryFilePath=/var/tmp

$ cat /boot/loader/entries/2025-11-28_23-23-32_linux.conf
options ..... nvidia_drm.modeset=1

$  sort /proc/driver/nvidia/params | grep -iE 'Preserve|Kernel|Temp'
PreserveVideoMemoryAllocations: 1
TemporaryFilePath: "/var/tmp"
UseKernelSuspendNotifiers: 1

$ journalctl -b -1 --no-hostname -n30
Apr 06 13:52:15 NetworkManager[799]: <info>  [1775449335.4799] device (wlan0): set-hw-addr: set MAC address to CE:E3:6C:F8:F3:71 (scanning)
Apr 06 13:52:15 NetworkManager[799]: <info>  [1775449335.5498] device (wlan0): state change: disconnected -> unmanaged (reason 'unmanaged-nm-disabled', managed-type: 'full')
Apr 06 13:52:15 NetworkManager[799]: <info>  [1775449335.5967] device (wlan0): set-hw-addr: reset MAC address to 50:BB:B5:0A:68:A8 (unmanage)
Apr 06 13:52:15 systemd[1]: Reached target Sleep.
Apr 06 13:52:15 systemd[1]: Starting System Suspend...
Apr 06 13:52:15 wpa_supplicant[1087]: p2p-dev-wlan0: CTRL-EVENT-DSCP-POLICY clear_all
Apr 06 13:52:15 wpa_supplicant[1087]: p2p-dev-wlan0: CTRL-EVENT-DSCP-POLICY clear_all
Apr 06 13:52:15 wpa_supplicant[1087]: nl80211: deinit ifname=p2p-dev-wlan0 disabled_11b_rates=0
Apr 06 13:52:15 systemd-sleep[2351]: User sessions remain unfrozen on explicit request ($SYSTEMD_SLEEP_FREEZE_USER_SESSIONS=0).
Apr 06 13:52:15 systemd-sleep[2351]: This is not recommended, and might result in unexpected behavior, particularly
Apr 06 13:52:15 systemd-sleep[2351]: in suspend-then-hibernate operations or setups with encrypted home directories.
Apr 06 13:52:15 wpa_supplicant[1087]: wlan0: CTRL-EVENT-DSCP-POLICY clear_all
Apr 06 13:52:15 systemd-sleep[2351]: Performing sleep operation 'suspend'...
Apr 06 13:52:15 kernel: PM: suspend entry (s2idle)
Apr 06 13:52:15 kernel: Filesystems sync: 0.007 seconds
Apr 06 13:52:15 wpa_supplicant[1087]: wlan0: CTRL-EVENT-DSCP-POLICY clear_all
Apr 06 13:52:15 wpa_supplicant[1087]: nl80211: deinit ifname=wlan0 disabled_11b_rates=0
Apr 06 13:52:15 plasmashell[1324]: No object for name "alsa_input.pci-0000_64_00.6.analog-stereo"
Apr 06 13:52:15 kded6[1307]: No object for name "alsa_input.pci-0000_64_00.6.analog-stereo"
Apr 06 13:52:15 kded6[1307]: No object for name "alsa_output.pci-0000_64_00.6.analog-stereo"
Apr 06 13:52:15 kded6[1307]: No object for name "alsa_input.pci-0000_64_00.6.analog-stereo"
Apr 06 13:52:15 plasmashell[1324]: No object for name "alsa_output.pci-0000_64_00.6.analog-stereo"
Apr 06 13:52:15 plasmashell[1324]: No object for name "alsa_input.pci-0000_64_00.6.analog-stereo"
Apr 06 13:52:15 kded6[1307]: No object for name "@DEFAULT_SINK@"
Apr 06 13:52:15 kded6[1307]: No object for name "@DEFAULT_SOURCE@"
Apr 06 13:52:15 plasmashell[1324]: No object for name "@DEFAULT_SINK@"
Apr 06 13:52:15 plasmashell[1324]: No object for name "@DEFAULT_SOURCE@"
Apr 06 13:52:15 kded6[1307]: No object for name "@DEFAULT_SINK@"
Apr 06 13:52:15 kded6[1307]: No object for name "@DEFAULT_SOURCE@"
Apr 06 13:52:15 plasmashell[1324]: No object for name "@DEFAULT_SINK@"

$ journalctl -b -1 --no-hostname | grep -iE "nvidia|gpu|drm|kwin"
Apr 06 13:37:07 kernel: Command line: initrd=\initramfs-linux.img root=PARTUUID=a551359f-39b5-4ef6-8bc2-96c50912db5b zswap.enabled=0 rw rootfstype=ext4 nvidia_drm.modeset=1
Apr 06 13:37:07 kernel: Kernel command line: initrd=\initramfs-linux.img root=PARTUUID=a551359f-39b5-4ef6-8bc2-96c50912db5b zswap.enabled=0 rw rootfstype=ext4 nvidia_drm.modeset=1
Apr 06 13:37:07 kernel: ACPI: bus type drm_connector registered
Apr 06 13:37:07 kernel: simple-framebuffer simple-framebuffer.0: [drm] Registered 1 planes with drm panic
Apr 06 13:37:07 kernel: [drm] Initialized simpledrm 1.0.0 for simple-framebuffer.0 on minor 0
Apr 06 13:37:07 kernel: simple-framebuffer simple-framebuffer.0: [drm] fb0: simpledrmdrmfb frame buffer device
Apr 06 13:37:07 kernel: nvidia: loading out-of-tree module taints kernel.
Apr 06 13:37:07 kernel: nvidia: module verification failed: signature and/or required key missing - tainting kernel
Apr 06 13:37:07 kernel: nvidia-nvlink: Nvlink Core is being initialized, major device number 239
Apr 06 13:37:07 kernel: nvidia 0000:01:00.0: vgaarb: VGA decodes changed: olddecodes=io+mem,decodes=none:owns=none
Apr 06 13:37:07 kernel: NVRM: loading NVIDIA UNIX Open Kernel Module for x86_64  595.58.03  Release Build  (root@)
Apr 06 13:37:07 kernel: nvidia-modeset: Loading NVIDIA UNIX Open Kernel Mode Setting Driver for x86_64  595.58.03  Release Build  (root@)
Apr 06 13:37:07 kernel: [drm] [nvidia-drm] [GPU ID 0x00000100] Loading driver
Apr 06 13:37:07 kernel: [drm] Initialized nvidia-drm 0.0.0 for 0000:01:00.0 on minor 1
Apr 06 13:37:07 kernel: nvidia 0000:01:00.0: vgaarb: deactivate vga console
Apr 06 13:37:07 kernel: fbcon: nvidia-drmdrmfb (fb0) is primary device
Apr 06 13:37:07 kernel: nvidia 0000:01:00.0: [drm] fb0: nvidia-drmdrmfb frame buffer device
Apr 06 13:37:07 systemd[1]: Load Kernel Module drm skipped, unmet condition check ConditionKernelModuleLoaded=!drm
Apr 06 13:37:08 systemd[1]: Starting Load/Save Screen Backlight Brightness of backlight:nvidia_0...
Apr 06 13:37:08 systemd[1]: Finished Load/Save Screen Backlight Brightness of backlight:nvidia_0.
Apr 06 13:37:09 kernel: input: HDA NVidia HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:01.1/0000:01:00.1/sound/card0/input24
Apr 06 13:37:09 kernel: input: HDA NVidia HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:01.1/0000:01:00.1/sound/card0/input25
Apr 06 13:37:09 kernel: input: HDA NVidia HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:01.1/0000:01:00.1/sound/card0/input26
Apr 06 13:37:09 kernel: input: HDA NVidia HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:01.1/0000:01:00.1/sound/card0/input27
Apr 06 13:37:12 kwin_wayland[1144]: No backend specified, automatically choosing drm
Apr 06 13:37:14 systemd[1]: Created slice Slice /system/dbus-:1.2-org.kde.powerdevil.discretegpuhelper.
Apr 06 13:37:14 systemd[1]: Started dbus-:1.2-org.kde.powerdevil.discretegpuhelper@0.service.
Apr 06 13:37:14 kwin_wayland[1144]: Failed to register with host portal QDBusError("org.freedesktop.portal.Error.Failed", "Could not register app ID: Unable to open /proc/1144/root")
Apr 06 13:37:14 kwin_wayland[1144]: Failed to register with host portal QDBusError("org.freedesktop.portal.Error.Failed", "Could not register app ID: Unable to open /proc/1144/root")
Apr 06 13:37:23 systemd[1]: dbus-:1.2-org.kde.powerdevil.discretegpuhelper@0.service: Deactivated successfully.

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