If you have been having any issues with your computer not resuming from sleep correctly when using an Nvidia GPU (garbled display, or black screen), I am happy to report that this has worked for me. This should work for other SysD distros that use KDE, however Step 7 below will not be the same. This should work for both Wayland and X11.
After doing the steps below, I am thinking that the only necessary steps were 4 through 8, as I am pretty sure that the first three were already working but I failed to check beforehand. If you are trying this out, I suggest looking to see if those services are already running
systemctl list-unit-files --state=enabled | grep nvidia
If you see three entries marked “enabled ennabled”, skip to step 4. If not start at step 1.
1 ) In a term type:
sudo systemctl enable nvidia-suspend.service
2 ) followed by:
sudo systemctl enable nvidia-hibernate.service
3 ) then type
sudo systemctl enable nvidia-resume.service
4 ) Now tell the kernel you want to change a parameter:
kate /lib/modprobe.d/systemd.conf
5 ) At the end of the file make a comment:
# Nvidia memory mod for sleep/resume
6 ) Then below that add:
options nvidia NVreg_PreserveVideoMemoryAllocations=1
Save the file in Kate. It will prompt you for the password as its a root system file.
7 ) Now you need to tell the kernel you made the changes:
sudo update-initramfs -k all -u
8 ) Reboot your computer and then test out the sleep function. Ideally leave it for at least 4 1/2 hours to allow it to hibernate. Unlike Windows, my computer does not resume from a keypress in Linux even though it is set in the bios to allow it. You may have different results. If the keyboard does not wake the computer, a single short press of the power button should wake it.
I may look into seeing if I can fix that too.