How to fix the sleep/suspend Issue/glitch with crashing Nvidia propietary drivers and X11 / Wayland on KDE Plasma, Arch/ EndeavourOS

Dear eos comrades,

So I think this has been reported multiple times already, but I cannot find the Bug Reports on bus.kde.org. Maybe someone can contribute that. Here there is a previous reddit post reporting the same issue:
https://www.reddit.com/r/kde/comments/131jyog/when_resuming_from_sleep_kde_is_always_glitchy/

I myself had this issue with manjaro and now also with endeavouros, that when I sent my PC to sleep or it went to sleep by itself it always would up wake up glitched out, with the graphic driver crashing.

plasmashell --replace

Would fix the graphic glitch issue but would not bring back the graphic driver itself, until reboot…The issue was that the proprietary drivers on nvidia don’t save the vram before suspend. Had similar issues with manjaro and could fix it through this blog post: https://blenderartists.org/t/failed-to-create-cuda-context-illegal-adress/1278322/8 After a whole day of figuring out how to do it on EOS here is the fix: run following three commands in your terminal:

sudo systemctl enable nvidia-suspend.service

sudo systemctl enable nvidia-hibernate.service

sudo systemctl enable nvidia-resume.service

then: cd /lib/modeprobe.d

sudo nano systemd.conf

Add following line at the end of the file:

options nvidia NVreg_PreserveVideoMemoryAllocations=1

CTRL-X and save file out.

Then run:

sudo dracut --force

reboot for good measure. Voila your PC with EOS can now go to sleep and wake up properly without crashing graphic drives… Tested with KDE-Plasma with Wayland and 2080ti. Should also work for Xorg X11 (with manjaro I had X11).

But I have an issue now that everytime there is a new kernel update, I have to manually reinstall the kernel through this steps before rebooting. otherwise i get an boot error at start up which says could not find/mount efi partition. That why after each kernel update before reboot I run following commands:

sudo reinstall-kernels

bootctl list

then run (with the respected config listed in bootctl)
sudo bootctl set-default 123456789123456789.conf

Maybe someone has a fix for the issue?

Also upon restart (not very often but maybe 1 out of 10 times) one or two of my three monitors just freezes (unresponsive image of splashscreen or desktop). The other one works fine… I do not know if this is related or another known issue…

Thanks,
Delphine

options nvidia NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=/var/tmp

In a file /etc/modprobe.d/nvidia-power-management.conf
Worked for me - Lenovo Legion5 RTX3070.

1 Like