Skip to content

Instantly share code, notes, and snippets.

@bmcbm
Last active September 20, 2024 17:05
Show Gist options
  • Save bmcbm/375f14eaa17f88756b4bdbbebbcfd029 to your computer and use it in GitHub Desktop.
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
@wezel
Copy link

wezel commented May 5, 2023

The method works. In case you need fresh files install the services, you can get your driver version from NVIDIA. Use nvidia-smi to get the exact version and then run the .run file with --extract-only flag: sudo bash NVIDIA-Linux-x86_64-515.65.01.run --extract-only.

Then you run the given commands setting the TMPL_PATH to the path where you've extracted the files. Keep in mind that the files for this driver (515.65.01) have a slightly different locations as stated in the original post. So the updated commands should be like this:

TMPL_PATH=/home/user/Downloads/NVIDIA-Linux-x86_64-515.65.01/systemd

sudo install --mode 644 "${TMPL_PATH}/system/nvidia-suspend.service" /etc/systemd/system
sudo install --mode 644 "${TMPL_PATH}/system/nvidia-hibernate.service" /etc/systemd/system
sudo install --mode 644 "${TMPL_PATH}/system/nvidia-resume.service" /etc/systemd/system
sudo install "${TMPL_PATH}/system-sleep/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

I have the 530.30.02 drivers and this worked for me thanks! I almost gave up on it.

@Sahas-Ananth
Copy link

The method works. In case you need fresh files install the services, you can get your driver version from NVIDIA. Use nvidia-smi to get the exact version and then run the .run file with --extract-only flag: sudo bash NVIDIA-Linux-x86_64-515.65.01.run --extract-only.
Then you run the given commands setting the TMPL_PATH to the path where you've extracted the files. Keep in mind that the files for this driver (515.65.01) have a slightly different locations as stated in the original post. So the updated commands should be like this:

TMPL_PATH=/home/user/Downloads/NVIDIA-Linux-x86_64-515.65.01/systemd

sudo install --mode 644 "${TMPL_PATH}/system/nvidia-suspend.service" /etc/systemd/system
sudo install --mode 644 "${TMPL_PATH}/system/nvidia-hibernate.service" /etc/systemd/system
sudo install --mode 644 "${TMPL_PATH}/system/nvidia-resume.service" /etc/systemd/system
sudo install "${TMPL_PATH}/system-sleep/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

I have the 530.30.02 drivers and this worked for me thanks! I almost gave up on it.

Did you change the above command to 530.30.02 (your driver version) or 515.65.01 (The one given in the script)?

@wezel
Copy link

wezel commented May 9, 2023

Sort of. I downloaded the closest driver, to mine, I could "easily" find from the nvidia driver website and used the name of that version in the script. Which means that I changed all instances of 515.65.01 in the above command to 530.41.03. I hope this helps.
(do note: It would probably be better to match the exact version)

@tvld
Copy link

tvld commented Jul 10, 2023

sudo rm /etc/systemd/system/systemd-hibernate.service.requires/nvidia-resume.service
sudo rm /etc/systemd/system/systemd-hibernate.service.requires/nvidia-hibernate.service
sudo rm /etc/systemd/system/systemd-suspend.service.requires/nvidia-resume.service
sudo rm /etc/systemd/system/systemd-suspend.service.requires/nvidia-suspend.service

This works perfectly

This fails at first for me. Suspend still freezes on my XPS 9560 with Ubuntu 22.04

Edit: But after I restored the link, it seemed to work for a while:

sudo ln -s  /lib/systemd/system/nvidia-hibernate.service /etc/systemd/system/systemd-hibernate.service.requires/nvidia-hibernate.service 
sudo ln -s /lib/systemd/system/nvidia-resume.service /etc/systemd/system/systemd-hibernate.service.requires/nvidia-resume.service  
sudo ln -s /lib/systemd/system/nvidia-resume.service /etc/systemd/system/systemd-suspend.service.requires/nvidia-resume.service  
sudo ln -s  /lib/systemd/system/nvidia-suspend.service /etc/systemd/system/systemd-suspend.service.requires/nvidia-suspend.service 

... but next day same issue: resume after suspend will freeze system. I can login with ssh though...

@pbattin
Copy link

pbattin commented Jul 11, 2023

sudo rm /etc/systemd/system/systemd-hibernate.service.requires/nvidia-resume.service
sudo rm /etc/systemd/system/systemd-hibernate.service.requires/nvidia-hibernate.service
sudo rm /etc/systemd/system/systemd-suspend.service.requires/nvidia-resume.service
sudo rm /etc/systemd/system/systemd-suspend.service.requires/nvidia-suspend.service

This works perfectly

This fails at first for me. Suspend still freezes on my XPS 9560 with Ubuntu 22.04

Edit: But after I restored the link, it seemed to work for a while:

sudo ln -s  /lib/systemd/system/nvidia-hibernate.service /etc/systemd/system/systemd-hibernate.service.requires/nvidia-hibernate.service 
sudo ln -s /lib/systemd/system/nvidia-resume.service /etc/systemd/system/systemd-hibernate.service.requires/nvidia-resume.service  
sudo ln -s /lib/systemd/system/nvidia-resume.service /etc/systemd/system/systemd-suspend.service.requires/nvidia-resume.service  
sudo ln -s  /lib/systemd/system/nvidia-suspend.service /etc/systemd/system/systemd-suspend.service.requires/nvidia-suspend.service 

... but next day same issue: resume after suspend will freeze system. I can login with ssh though...

Yea same, im running ver. 535.54.03 and it just freezes when I try to start the suspend command manually. When I try to enter from the desktop it just ends up logging out

@tvld
Copy link

tvld commented Jul 12, 2023

Same 535.54.03 for me. As long as I have "Prime select" on "intel", suspend works flawless, by the way. Just Nvidia not.. )

@cryptolake
Copy link

is there any reason this is not set by default? i'm using kubuntu 23.04 with 535 driver and i had to follow this to get suspend working working, although i had to only enable the services.

@tvld
Copy link

tvld commented Jul 13, 2023

is there any reason this is not set by default? i'm using kubuntu 23.04 with 535 driver and i had to follow this to get suspend working working, although i had to only enable the services.

What is "this"... you mean prime-select? ... if it is not on "Nvidia-on-demand" we can not use discrete graphics on the laptop..

@Tanzeel159
Copy link

I currently have prime and Optimus manager installed. Driver version is 535.54.03 . I am facing the suspend issue when laptop is in hybrid or discrete graphics mode but no issue on integrated mode. What steps should I follow to solve this issue?

@shrihari007
Copy link

Hi I'm also facing the same issue on ubuntu 22.10 / Nvidia-driver-535. I'm not sure what exact steps to be taken to resolve the suspend issue. The device wakes up immediately after suspend. If manually suspended, the graphics has issues after wakeup and external monitor does not work post suspend.

@Tanzeel159
Copy link

Tanzeel159 commented Aug 10, 2023

Yeah . I didn't face that issue earlier . It's fairly recent for me. I was on Fedora 37 when I started facing the issue.. I tried everything then but it didn't work . Then I switched to EndeavourOS and followed the steps mentioned in post but the issue didn't resolve. I came across post where they mentioned sometimes having less SWAP partition can cause that issue so I created new SWAP partition and again the issue didn't resolve.

I was earlier dual booting with windows 10, since this issue was not resolved I reverted back to Windows removing the Linux partition. Main issue is without suspend there is constant use of device and there is high power consumption, suspending will reboot system causing loss of work. Suspend works fine on integrated graphics but that's not viable since I can't use my external display . So I switched. Hopefully someone will figure out what exactly is the issue!

@NicolasPrimeau
Copy link

NicolasPrimeau commented Sep 1, 2023

The solution by @ermenkov is the only thing that worked. Ubuntu 22.02 / driver version 535.104.05

The other issue was bluetooth waking up the system immediately after suspend. That was fixed with this script in /lib/systemd/system-sleep/bluetooth-suspend (From stack overflow or a forum, I forget where)

#!/bin/bash
# Makes sure bluetooth service is not running while suspended.

if [ "${1}" == "pre" ]; then
    service bluetooth stop
elif [ "${1}" == "post" ]; then
    service bluetooth start
fi

@Ahwar
Copy link

Ahwar commented Sep 6, 2023

Whoever gave this idea worked for me:

sudo rm /etc/systemd/system/systemd-hibernate.service.requires/nvidia-resume.service
sudo rm /etc/systemd/system/systemd-hibernate.service.requires/nvidia-hibernate.service
sudo rm /etc/systemd/system/systemd-suspend.service.requires/nvidia-resume.service
sudo rm /etc/systemd/system/systemd-suspend.service.requires/nvidia-suspend.service

My nvidia info using nvidia-smi command:

Wed Sep  6 19:56:52 2023       
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.104.05             Driver Version: 535.104.05   CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce RTX 3060 Ti     Off | 00000000:B3:00.0  On |                  N/A |
|  0%   48C    P8              21W / 240W |    345MiB /  8192MiB |     36%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
                                                                                         
+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A      2404      G   /usr/lib/xorg/Xorg                          179MiB |
|    0   N/A  N/A      2575      G   /usr/bin/gnome-shell                         98MiB |
|    0   N/A  N/A     50045      G   ...2403833,13679958894095400614,262144       58MiB |
+---------------------------------------------------------------------------------------+

System Name:
Dell Inc. Precision 5820 Tower
Ubuntu 22.04.3 LTS

@matbun
Copy link

matbun commented Sep 17, 2023

I'm on Ubuntu 22.04, and after installing CUDA I was unable to suspend. The following steps worked for me:

  • Inside /etc/systemd, delete all of the files that include nvidia and suspend or hibernate. There are three services inside /etc/systemd/system, which I deleted. There are also some other dead nvidia links inside systemd-hibernate.service.requires, systemd-suspend.service.requires, which I deleted.

I wish I knew the exact names of the files that I deleted, but since they're now gone, I can't remember their exact paths. But in a nutshell, go into /etc/systemd, and do find . -iname nv*, and then delete all the of the suspend, resume, and hibernate scripts.

DO NOT DELETE nvidia-powerd.service and nvidia-persistenced.service.

Once you're done with that, do systemctl daemon-reload.

Worked for me as well!

I have a Dell Inspiron 15 5000 with Nvidia driver 470.199.02 on Ubuntu 20.04 LTS.

@BLuFeNiX
Copy link

BLuFeNiX commented Nov 6, 2023

sudo rm /etc/systemd/system/systemd-hibernate.service.requires/nvidia-resume.service
sudo rm /etc/systemd/system/systemd-hibernate.service.requires/nvidia-hibernate.service
sudo rm /etc/systemd/system/systemd-suspend.service.requires/nvidia-resume.service
sudo rm /etc/systemd/system/systemd-suspend.service.requires/nvidia-suspend.service

This works perfectly

Also worked for me after installing CUDA libraries on Ubuntu 22.04. Prior to this I had Nvidia drivers working with suspend without issue.

@skwzrd
Copy link

skwzrd commented Nov 13, 2023

I know this gist is for NVIDIA drivers with versions <470, but I wanted to if anyone has had any luck getting drivers 525, or 535 to work.

GPU: Nvidia 4060 TI
Driver: 535.129.03
CUDA Version: 12.2
CPU: AMD 5700X
Board: Gigabyte 550 Gaming V2
OS: Ubuntu 22.04.3 LTS

Basically, when I select suspend on Ubuntu, my screens turn off, and my fans spin up to a very high RPM. Then I am unable to wake it up from this state, and must toggle the PSU switch off and on again. After that, the login screen is displayed.

I know this is an Ubuntu related issue because I can put my computer to sleep on Windows 10, and wake it back up again.

What I've tried:

  • Editing /etc/defaults/grub (GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" GRUB_CMDLINE_LINUX="nouveau.blacklist=1")
  • Removing all NVIDIA services in /etc/systemd (https://askubuntu.com/a/1409631/1554429)
  • Installing different Nvidia drivers, both open source and proprietary options
  • Setting the Nvidia sleep shell script to only execute exit 0
  • Disabled secure boot in BIOS
  • Disabled CSM in BIOS
  • Enabled mouse and key presses to wake in BIOS
  • Disabling Nvidia systemd state management, https://askubuntu.com/a/1436923/1554429
  • Other stuff...

@7o9
Copy link

7o9 commented Dec 7, 2023

Yes, I got it to run on an IBM Thinkpad P52 with:

GPU: NVIDIA GP107GLM [Quadro P2000 Mobile]
Driver: 535.129.03
CPU: Intel Xeon E-2176M
Distro: Linux Mint 21.2 Victoria
base: Ubuntu 22.04 jammy
Kernel: 5.15.0-89-generic x86_64
Desktop: Xfce 4.18.1

My 'trick' ist to only use:

sudo pm-suspend

Anything related to systemd suspend, closing lid etc. else will fail miserably, end with a hanging OS and a hard reboot. Very disappointing, for quite a long time already.

@l3ifk
Copy link

l3ifk commented Dec 28, 2023

I'm on Ubuntu 22.04, and after installing CUDA I was unable to suspend. The following steps worked for me:

  • Inside /etc/systemd, delete all of the files that include nvidia and suspend or hibernate. There are three services inside /etc/systemd/system, which I deleted. There are also some other dead nvidia links inside systemd-hibernate.service.requires, systemd-suspend.service.requires, which I deleted.

I wish I knew the exact names of the files that I deleted, but since they're now gone, I can't remember their exact paths. But in a nutshell, go into /etc/systemd, and do find . -iname nv*, and then delete all the of the suspend, resume, and hibernate scripts.
DO NOT DELETE nvidia-powerd.service and nvidia-persistenced.service.
Once you're done with that, do systemctl daemon-reload.

Worked for me as well!

I have a Dell Inspiron 15 5000 with Nvidia driver 470.199.02 on Ubuntu 20.04 LTS.

This worked for me too! I have a Razer Blade 14 2022 with Nvidia driver 535.129.03 on Ubuntu 23.10

@jmoraispk
Copy link

jmoraispk commented Apr 8, 2024

This also worked for me on an XPS 15 with a 3050 Ti (Ampere), Ubuntu 22.04, driver 550.

This fixed my pci_pm_suspend() and the PreserveVideoMemory stuff that would pop up and prevent laptop sleep.

If you deleted the service files, like nvidia-powerd.service or nvidia-persistenced.service, you either find them here or you can reinstall the drivers like this.

After reinstalling, I was able to see the service files, and then doing what the OP said worked.

Doing systemctl list-unit-files | grep nvidia now gets me:

joao@joao-XPS-15-9520:~$ systemctl list-unit-files | grep nvidia
nvidia-hibernate.service                                                  enabled         enabled
nvidia-persistenced.service                                               static          -
nvidia-resume.service                                                     enabled         enabled
nvidia-suspend.service                                                    enabled         enabled

Good luck!

@the-rich-piana
Copy link

This also worked for me on an XPS 15 with a 3050 Ti (Ampere), Ubuntu 22.04, driver 550.

...

So far seems to have work on my Lenovo Legion Slim 7 4060 PopOS kernel 6.8, also driver 550. Kind of frustrating because PopOS ships with nvidia drivers and so everytime I have to update OS it updates my drivers 😅 and I have to repeat this process.

nvidia-hibernate.service                         enabled         enabled
nvidia-powerd.service                            enabled         enabled
nvidia-resume.service                            enabled         enabled
nvidia-suspend.service                           enabled         enabled

@dispensable
Copy link

The method works. In case you need fresh files install the services, you can get your driver version from NVIDIA. Use nvidia-smi to get the exact version and then run the .run file with --extract-only flag: sudo bash NVIDIA-Linux-x86_64-515.65.01.run --extract-only.

Then you run the given commands setting the TMPL_PATH to the path where you've extracted the files. Keep in mind that the files for this driver (515.65.01) have a slightly different locations as stated in the original post. So the updated commands should be like this:

TMPL_PATH=/home/user/Downloads/NVIDIA-Linux-x86_64-515.65.01/systemd

sudo install --mode 644 "${TMPL_PATH}/system/nvidia-suspend.service" /etc/systemd/system
sudo install --mode 644 "${TMPL_PATH}/system/nvidia-hibernate.service" /etc/systemd/system
sudo install --mode 644 "${TMPL_PATH}/system/nvidia-resume.service" /etc/systemd/system
sudo install "${TMPL_PATH}/system-sleep/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

535.183.01 works! thanks !

@bilallamal07
Copy link

Can’t resume after suspend with 535 driver on OS: Linux Mint 21.3 x86_64
Kernel: 5.15.0-118-generic

l am experiencing an issue where your Linux Mint 21.3 system can’t resume after being suspended when using the nvidia-driver-535. with NVIDIA drivers on Linux systems. Let’s clarify the situation:

My system boots up normally with the NVIDIA driver installed.
When l put the computer to sleep (suspend mode), it appears to enter sleep mode successfully.

meaning When you try to wake the computer from sleep, it fails to resume properly. it stopped to resume with black screen with all system information displayed on the screen, then l need do nothing until I hard-restarted o options
this is very frustrating,

I’m happy to provide further information about the system

Thanks in advance for any assistance you can provide.

@inspiron:~$ nvidia-smi
Fri Aug 9 11:12:52 2024
±--------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.183.01 Driver Version: 535.183.01 CUDA Version: 12.2 |
|-----------------------------------------±---------------------±---------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA GeForce GTX 960M Off | 00000000:02:00.0 Off | N/A |
| N/A 41C P8 N/A / 200W | 6MiB / 4096MiB | 0% Default |
| | | N/A |
±----------------------------------------±---------------------±---------------------+

±--------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| 0 N/A N/A 1209 G /usr/lib/xorg/Xorg 2MiB |
±--------------------------------------------------------------------------------------+

inxi -Sx
System:
Host: Inspiron Kernel: 5.15.0-118-generic x86_64 bits: 64 compiler: gcc
v: 11.4.0 Desktop: Cinnamon 6.0.4 Distro: Linux Mint 21.3 Virginia
base: Ubuntu 22.04 jammy

inxi -Gx
Graphics:
Device-1: Intel HD Graphics 530 vendor: Dell driver: i915 v: kernel
bus-ID: 00:02.0
Device-2: NVIDIA GM107M [GeForce GTX 960M] vendor: Dell driver: nvidia
v: 535.183.01 bus-ID: 02:00.0
Device-3: Sunplus Innovation Integrated_Webcam_HD type: USB
driver: uvcvideo bus-ID: 1-4:3
Display: x11 server: X.Org v: 1.21.1.4 driver: X:
loaded: modesetting,nvidia unloaded: fbdev,nouveau,vesa gpu: i915
resolution: 1: 1600x90060Hz 2: 1600x90060Hz
OpenGL: renderer: Mesa Intel HD Graphics 530 (SKL GT2)
v: 4.6 Mesa 23.2.1-1ubuntu3.1~22.04.2 direct render: Yes

systemctl | grep nvidia
sys-bus-pci-drivers-nvidia.device loaded active plugged /sys/bus/pci/drivers/nvidia
nvidia-persistenced.service loaded active running NVIDIA Persistence Daemon

@chanh2018
Copy link

After so many trials I found a solution for myself. I'm not sure it'll work for yours but at least it's working for my system now.
Here' what I did:

  • Switch back to nouveau open source driver (if you're using proprietary driver)
  • Manually install Nvidia 550 driver ( sudo apt install nvidia-driver-550)
  • Reboot system and check if Nvidia 550 is installed
  • Create nvidia.conf file and add these lines into it (not sure about yours, but my system doesn't have this file)
  • nvidia.conf file will be in /etc/modprobe.d
    sudo nano /etc/modprobe.d/nvidia.conf
  • Add these lines into it:
    options nvidia-drm fbdev=1
    options nvidia NVreg_PreserveVideoMemoryAllocations=1
    options nvidia NVreg_TemporaryFilePath=/var/tmp
  • Reboot your system.
  • That's work for me

My system info:
Dell Optiplex 9020 Intel i7-4790 4GHz
Memory 16GBytes
Video card: Nvidia GeForce GTX 745
Kernel 6.8.0-41-generic
Linux Mint 22, Cinammon 6.2.9

(By the way, I tried this method on Nvidia driver 535 but it didn't work. Also, I got some ACPI errors before restart/shutdown, but not on start up, other than that, the system is running fine)
I hope this info help someone who is looking for a solution of not wake-up from suspend as mind.
Cheers !!!

@bilallamal07
Copy link

bilallamal07 commented Aug 22, 2024 via email

@bilallamal07
Copy link

After so many trials I found a solution for myself. I'm not sure it'll work for yours but at least it's working for my system now. Here' what I did:

  • Switch back to nouveau open source driver (if you're using proprietary driver)
  • Manually install Nvidia 550 driver ( sudo apt install nvidia-driver-550)
  • Reboot system and check if Nvidia 550 is installed
  • Create nvidia.conf file and add these lines into it (not sure about yours, but my system doesn't have this file)
  • nvidia.conf file will be in /etc/modprobe.d
    sudo nano /etc/modprobe.d/nvidia.conf
  • Add these lines into it:
    options nvidia-drm fbdev=1
    options nvidia NVreg_PreserveVideoMemoryAllocations=1
    options nvidia NVreg_TemporaryFilePath=/var/tmp
  • Reboot your system.
  • That's work for me

My system info: Dell Optiplex 9020 Intel i7-4790 4GHz Memory 16GBytes Video card: Nvidia GeForce GTX 745 Kernel 6.8.0-41-generic Linux Mint 22, Cinammon 6.2.9

(By the way, I tried this method on Nvidia driver 535 but it didn't work. Also, I got some ACPI errors before restart/shutdown, but not on start up, other than that, the system is running fine) I hope this info help someone who is looking for a solution of not wake-up from suspend as mind. Cheers !!!

l have tried this hack NVIDIA sleep script: /usr/bin/nvidia-sleep.sh

Adding exit 0 at the top of this script solved the problem.

This solution effectively bypasses the NVIDIA-specific sleep handling,
which was causing the suspend/resume issues. Here's how to implement this
fix properly many thanks :

Open the NVIDIA sleep script with sudo privileges:
sudo nano /usr/bin/nvidia-sleep.sh

Add exit 0 as the second line of the file,

#!/bin/bash
exit 0 <<---- This is the ;-) Hack

it worked for while, than the issue back again Can’t resume after suspend with 550 driver on OS: Linux Mint 21.3 x86_64
Kernel: 5.15.0-118-generic

Wed Sep 4 15:11:48 2024
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.107.02 Driver Version: 550.107.02 CUDA Version: 12.4 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce GTX 960M Off | 00000000:02:00.0 Off | N/A |
| N/A 39C P8 N/A / 200W | 7MiB / 4096MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| 0 N/A N/A 1115 G /usr/lib/xorg/Xorg 2MiB |
+-----------------------------------------------------------------------------------------+

l have also tried

nvidia.conf file will be in /etc/modprobe.d # tried this not working for me
sudo nano /etc/modprobe.d/nvidia.conf
Add these lines into it:
options nvidia-drm fbdev=1
options nvidia NVreg_PreserveVideoMemoryAllocations=1
options nvidia NVreg_TemporaryFilePath=/var/tmp

No Joy ;-( still have the same issue any help or pointer that would be greatly appreciated

@chanh2018
Copy link

This is my current setting and it's working for me (Linux Mint 22, Nvidia GeForce GTX 745 using Nvidia 550.107.02 driver)

sudo nano /etc/modprobe.d/nvidia-graphics-drivers-kms.conf

and add these lines into it:

options nvidia-drm fbdev=1
options nvidia NVreg_PreserveVideoMemoryAllocations=1
options nvidia NVreg_TemporaryFilePath=/var/tmp

@wuqi001s
Copy link

wuqi001s commented Sep 6, 2024

The method works. In case you need fresh files install the services, you can get your driver version from NVIDIA. Use nvidia-smi to get the exact version and then run the .run file with --extract-only flag: sudo bash NVIDIA-Linux-x86_64-515.65.01.run --extract-only.该方法有效。如果您需要新文件,请安装服务,您可以从 NVIDIA 获取您的驱动程序版本。使用 nvidia-smi 获取确切版本,然后使用 .run 文件和 --extract-only 标志运行: sudo bash NVIDIA-Linux-x86_64-515.65.01.run --extract-only
Then you run the given commands setting the TMPL_PATH to the path where you've extracted the files. Keep in mind that the files for this driver (515.65.01) have a slightly different locations as stated in the original post. So the updated commands should be like this:然后,您运行给定的命令,将 TMPL_PATH 设置为您提取文件的路径。请记住,此驱动程序 (515.65.01) 的文件位置与原始帖子中所述略有不同。因此,更新后的命令应如下所示:

TMPL_PATH=/home/user/Downloads/NVIDIA-Linux-x86_64-515.65.01/systemd

sudo install --mode 644 "${TMPL_PATH}/system/nvidia-suspend.service" /etc/systemd/system
sudo install --mode 644 "${TMPL_PATH}/system/nvidia-hibernate.service" /etc/systemd/system
sudo install --mode 644 "${TMPL_PATH}/system/nvidia-resume.service" /etc/systemd/system
sudo install "${TMPL_PATH}/system-sleep/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

535.183.01 works! thanks !535.183.01 有用!谢谢!

Sadly,it doesn't work for me.same is 535.183.01. Until now ,I have tried almost all methods ,no one work for me.It's so terrible.

@tabascoz
Copy link

same with me - Gentoo fully up to date as of today. - I'm not able to go past over 535.183.01 or kernel 6.9. Terrible.

@the-rich-piana
Copy link

Fix also stopped working for me. Frustrating. @chanh2018 what do these changes do?

@chanh2018
Copy link

Fix also stopped working for me. Frustrating. @chanh2018 what do these changes do?

To preserve video memory for NVIDIA. It works for me.

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