»NVIDIA, Debian, and Xorg

I have been using the Debian distribution of Linux since about 1998, after having gone through Slackware and Red Hat during college. I like Debian, but moreover, I am used to it. So, while I would love to experiment with a newer distro like Arch, in my precious free time that isn't at the top of my list.

The biggest drawback of using Debian for anything cutting-edge is that it moves very slowly: even the unstable distribution is often well behind my needs. I run into this with the NVIDIA drivers more often than anything else. Since I prefer gaming in Linux (even with hibernate, dual booting is kind of a pain), I occasionally run into a situation in which the stable/testing NVIDIA drivers are not new enough to play something. I have been searching for a solution to this problem for years that doesn't involve me trying to build my own .debs from an NVIDIA .run driver package, and it looks like NVIDIA has themselves done it: the official CUDA repo can be used to get access to the latest released NVIDIA graphics drivers in .deb form in a way that appears clean and compatible with Debian 13 (Trixie). It worked almost out-of-the-box according to those instructions, but I had to take two additional steps:

  1. Set an apt pin for packages from the NVIDIA origin. You can do this with this simple addition to your apt preferences:

     Package: *:any
     Pin: release o=NVIDIA
     Pin-Priority: 995

    NB: This is potentially a security risk because it will override any package that exists in that repo. You could limit it to particular package name patterns if you are concerned about this possibility. I personally use:

     Package: /nvid|^libnv|^libxnv|cuda|dkms/:any
  2. I had to add a symlink from /usr/lib/xorg/modules/extensions/libglxserver_nvidia.so to libglxserver_nvidia.so.<VERSION> in the same directory. The mess of Debian alternatives symlink chains handle this for the Debian-packaged stack, but for some reason this link wasn't populated by the CUDA packages, which broke GLX (OpenGL). It took me a day to run into this problem because I don't use a lot of OpenGL applications, but I found it strange that Borderlands 4 ran (albeit with severe—but AFAICT unrelated—visual artifacts) while the ancient City of Heroes brought up a black screen along with the ominous console message glx: failed to create dri3 screen. I discovered the cause of the problem by first checking inxi -Gxz, which showed me that the wrong stack was in use for OpenGL, even though EGL and Vulkan were both handled properly; and then by noticing a line in my Xorg.0.log:

     NVIDIA: Failed to load module "glxserver_nvidia" (module does not exist, 0)

    A quick locate glxserver_nvidia later, along with a comparison to a machine still using the Debian-packaged stack, led to the obvious workaround.