-
Star
(101)
You must be signed in to star a gist -
Fork
(2)
You must be signed in to fork a gist
-
-
Save bmcbm/375f14eaa17f88756b4bdbbebbcfd029 to your computer and use it in GitHub Desktop.
# 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 | |
FYI, there's a new systemd service for newer nvidia driver versions. So if someone uses suspend-then-hibernate
on their system, you might need to enable that too for nvidia:
sudo systemctl enable nvidia-suspend-then-hibernate.service
Thank you for the hint! On Fedora 42, all I needed to do was install xorg-x11-drv-nvidia-470xx-power (I have an older card)
I found solution for my system, tested with nvidia driver
570.153.02
. To get suspend/hibernation working correctly i had to change my kernel version to6.13.7
and setNVreg_EnableGpuFirmware
to 0 fornvidia
kernel module. With other kernel versions(i tested6.12.29
lts and mainline6.14.6
) i get a black screen when trying to resume from suspend/hibernate1.
@gdim47 , thank you for this solution!
It works also in my case with Fedora 42 running on my ASUS ROG laptop with 32 GB RAM and GeForce RTX 4070 Max-Q and Nvidia driver version 575.64
.
The problem was after a couple of updates the system stopped to hibernate with the messages in the /var/log/messages
saying that
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
and
nvidia 0000:01:00.0: PM: failed to freeze async: error -5
After adding two last options from your config (the 1st one had been already in its place) in my one the problem seemed to vanish.
UPDATE
OOPS :( It occurred to be too early to celebrate because the second hibernate command failed to finish successfully due to nvidia PM failed to freeze async.
I found solution for my system, tested with nvidia driver
570.153.02
. To get suspend/hibernation working correctly i had to change my kernel version to6.13.7
and setNVreg_EnableGpuFirmware
to 0 fornvidia
kernel module. With other kernel versions(i tested6.12.29
lts and mainline6.14.6
) i get a black screen when trying to resume from suspend/hibernate1.Here is modprobe.d config for nvidia module(
/etc/modprobe.d/nvidia.conf
):options nvidia NVreg_PreserveVideoMemoryAllocations=1 options nvidia NVreg_TemporaryFilePath=/var/tmp options nvidia NVreg_EnableGpuFirmware=0
Enabled nvidia systemd services:
sudo systemctl enable nvidia-hibernate sudo systemctl enable nvidia-suspend sudo systemctl enable nvidia-resume
My system:
- Lenovo Legion R7000 AHP9
- AMD Ryzen 7 8745H
- 32 GB ram
- Video: Nvidia RTX 4050(dGPU) + AMD Radeon 780M(iGPU)
- OS: Fedora 41, KDE 6.3.5 with Kwin wayland session
- Nvidia driver version:
570.153.02
Footnotes
- As workaround I found that with magic SysRq request for SIGTERM to all processes, i can bypass/kill hanged nvidia(?) scripts. Keyboard shortcut: Alt+SysRq(PrtSc)+e ↩
Update: after upgrading nvidia driver to 575.64
and linux to 6.14.11
, hibernation works correctly.
But have issues with video playback in chromium(page content freezes when starting video playback). Nvidia :)
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
I found solution for my system, tested with nvidia driver
570.153.02
.To get suspend/hibernation working correctly i had to change my kernel version to
6.13.7
and setNVreg_EnableGpuFirmware
to 0 fornvidia
kernel module.With other kernel versions(i tested
6.12.29
lts and mainline6.14.6
) i get a black screen when trying to resume from suspend/hibernate1.Here is modprobe.d config for nvidia module(
/etc/modprobe.d/nvidia.conf
):Enabled nvidia systemd services:
My system:
570.153.02
Footnotes
As workaround I found that with magic SysRq request for SIGTERM to all processes, i can bypass/kill hanged nvidia(?) scripts. Keyboard shortcut: Alt+SysRq(PrtSc)+e ↩