# 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 | |
For me, with nvidia-driver-495, the simple solution was to remove the damaged symlinks from systemd. You most likely have them if you upgraded from nvidia-driver-470, because 470 still included the .service files in /lib/systemd/system/. The files are no longer included in 495 but the postinst script does not remove the symlinks. So, remove them with:
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
Works instantly, no need of rebooting or logging off.
This does the job. Thank you.
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
Thank you, This worked in my case.
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
worked for me. Thank you very much.