Symptoms include:
* nvidia persistence errors and DKMS errors while building/installing modules;
* lines like *`Failed to query NVIDIA devices. Please ensure that the NVIDIA device files (/dev/nvidia) exist ' ** in your /var/log/syslog
Caveat: I'm doing this on devuan/debian.
First, make sure you have the nvidia drivers and headers for your kernel installed(mine are 6.12.57+deb13-amd64) :
$ sudo apt install nvidia-drivers linux-headers-6.12.57+deb13-amd64
and next, MANUALLY enable nvidia persistence (why this doesn't get enabled automatically, IDFK):
$ sudo nvidia-smi -pm 1 (nvidia-smi installs from package nvidia-driver)
Next we make sure the module is built and installed to the correct place:
$ sudo apt install --reinstall nvidia-kernel-dkms
and then a reboot.
This has worked consistently for me once I found the solution, and I hope it helps someone else before they make themselves bald.