Fedora 34 KDE unable to suspend after nvidia driver update

Hi, I’ve been running Fedora 34 KDE for a couple of months with a Nvidia RTX 2060 and the proprietary nvidia driver. Today I updated the system(Ryzen 5 3600 desktop) which I do once or twice a week and it fetched among other things newer nvidia drivers, NVIDIA 470.63.01 to be exact and after a reboot the machine will not suspend. If I do like I’ve done for months:

systemctl suspend

The screen blinks once or twice and it seems as if it’s going to suspend but then doesn’t. It has always worked prior to today’s update.

Journal says:

aug 21 18:56:04 feds kernel: sd 3:0:0:0: [sdc] Stopping disk
aug 21 18:56:04 feds kernel: NVRM: GPU 0000:05: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 >
aug 21 18:56:04 feds kernel: PM: pci_pm_suspend(): nv_pmops_suspend+0x0/0x20 [nvidia] returns -5
aug 21 18:56:04 feds kernel: PM: dpm_run_callback(): pci_pm_suspend+0x0/0x160 returns -5
aug 21 18:56:04 feds kernel: nvidia 0000:05:00.0: PM: failed to suspend async: error -5`

The nvidia drivers were initially installed via

sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fed
ora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

sudo dnf install akmod-nvidia
sudo dnf install xorg-x11-drv-nvidia-cuda
sudo dnf install xorg-x11-drv-nvidia-devel
(if it matters)

Any wisdom?

2 Likes

Saw 763129 – x11-drivers/nvidia-drivers-460.27.04: Suspend mode is not working. via Gentoo Forums :: View topic - [Solved]Problem on sleep mentioning the same problem . Same solution was applicable, ie

NVreg_PreserveVideoMemoryAllocations=0

(in /usr/lib/modprobe.d/nvidia-power-management.conf on my system/Fedora)

CUDA (OpenCL) does seem to work (clinfo reports as usual, Darktable finds an OpenCL device) after suspend and wake, as opposed to for a commenter in the bug thread.

2 Likes

Hi, I couldn’t find that last night for some reason. This solution works for me. Thank you so much!

1 Like

Hi, I’ve experienced the same problem and found this post at the Nvidia forums: Occassional failure to resume: pci_pm_suspend(): nv_pmops_suspend+0x0/0x20 [nvidia] returns -5 - Linux - NVIDIA Developer Forums.
The problem seems to be related to inactive systemd units which I enabled like be found in Chapter 21. Configuring Power Management Support in Nvidias readme Chapter 21. Configuring Power Management Support.

So I did:
• sudo systemctl enable nvidia-suspend.service
• sudo systemctl enable nvidia-hibernate.service
• sudo systemctl enable nvidia-resume.service
Now the suspending function works fine.

1 Like

Hi Rainer. Thanks for the link. If I were to venture a guess, I would say the problem begins with NVreg_PreserveVideoMemoryAllocations being set from 0 to 1, for it seems to be part of the

To better support power management with these types of applications, the NVIDIA Linux driver provides a custom power management interface intended for integration with system management tools like systemd . This interface is still considered experimental. It is not used by default, but can be taken advantage of by configuring the system as described in this chapter.

Additionally, to unlock the full functionality of the interface, the NVIDIA Linux kernel module nvidia.ko needs to be loaded with the NVreg_PreserveVideoMemoryAllocations=1 module parameter. This changes the default video memory save/restore strategy to save and restore all video memory allocations.

So, use the default kernel driver callback for handling the nvidia card’s suspend and hibernate, and PreserveVideoMemoryAllocations=0 or enable the nvidia systemd services for hibernate and suspend (that you mention) and set the above param to 1. Both things appear to enable my machine to suspend and wake like clockwork.

However … the nvidia power management article mentions that a benefit with the newer systemd way is “It supports power management with advanced CUDA features (such as UVM)” , which may not be applicable to everyone, but in a way it is to me :slight_smile: for it has always been the case prior that if I suspend the machine with Darktable (or anything else using OpenCL) running and wake it,

clinfo

will reveal no devices and Darktable will say that no OpenCL devices are detected (anymore), which could only be fixed via a relog/boot*. Enabling the three Nvidia systemd services (and setting the mentioned parameter to 1) OpenCL continues to be available in the same session after a wake from suspend. Huzzah for new and experimental features (it would be great if all parts of them were enabled at once but huzzah anyway for Fedora is free :slight_smile: )

*When I wrote “CUDA (OpenCL) does seem to work (clinfo reports as usual, Darktable finds an OpenCL device) after suspend and wake” I meant if Darktable wasn’t running when the machine suspended, that’s how I took the bug comment to mean (it doesn’t specify). Anyways, am glad to have learnt something new, particularly about this, even if I still am anticipating Alchemist…

I also found this post some days ago, and after enabling the three services suspend worked on my laptop. However, very recently suspend stops working again on my laptop. When I tried to rerun the commands to enable the three services I got the following prompt:

Failed to enable unit: Unit file nvidia-suspend.service does not exist.

(This is the prompt for nvidia-suspend and it is the same for the other two services.) Also, when I tried to suspend I actually logged out of my account, which did not happen before. Does anyone have any idea about why this happens and how I can resolve the new problem?

Edit: this turns out to be a silly problem… I found that if a service is enabled you cannot enable it again, and after disabling the service and using the workaround in this post suspend now works!

Hi ytliu, I had the same experience, the nvidia services disappeared after the last update; see the last post in the thread you link to (mine). I could not get my machine to suspend via creating a .conf file and setting the param to 0, it worked last time but not now. What did work and what works better, for me, as I use OpenCL, is

sudo dnf install xorg-x11-drv-nvidia-power
sudo systemctl enable nvidia-{suspend,resume,hibernate}

which restored the new nvidia power saving mode.

As Howto/NVIDIA - RPM Fusion says, "

NVIDIA has provided some experimental scripts to enable clean resume on suspend to RAM or suspend to disk (hibernate) that might be specially needed in some environment. Theses scripts will prevent artefacts on resume by moving the full content of the graphic memory into either host RAM (or disk). Packaging is currently (as of 2021-08-23) in in-between state and will be improved as discussed in…
"

so we’ll see whether we need to either reinstall the nvidia-power package (the three systemd services) or recreate a conf file in either modprobe.d folder (/etc or /usr/lib) with NVreg_PreserveVideoMemoryAllocations=0 to enable the old powersave mode with the coming nvidia driver updates.

worked for my Quadro M1200 on Dell Precision 5520, thank you.
I noticed the post below too with the power package, that may indeed be the cause.