Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save Anakiev2/8d62e261c66554d3012bc7ff855a22a7 to your computer and use it in GitHub Desktop.

Select an option

Save Anakiev2/8d62e261c66554d3012bc7ff855a22a7 to your computer and use it in GitHub Desktop.
How to install the Nvidia legacy driver (340xx or 390xx) on Debian 13 Trixie

How to install the Nvidia legacy driver (340xx or 390xx) on Debian 13 Trixie

This guide will show you how to compile and install the legacy Nvidia driver on Debian. The steps bellow are compatible with both nvidia-legacy-340xx-driver and nvidia-legacy-390xx-driver and can be installed on Debian 13 (Trixie) as well as Debian 12 (Bookworm) or Debian 11 (Bullseye) in both 64-bit and 32-bit version. Execute the lines one by one and wait for every line to finish before proceeding to next. Only the lines starting with sudo should be executed as root. The lines with sudo pbuilder will take a lot of time.

To install the nvidia-legacy-390xx-driver version replace 340xx with 390xx everywhere bellow.
To install both 64-bit and 32-bit libraries for wine/steam you should run Step 2. twice.
It was confirmed that this method also works with the nvidia-tesla-470-driver version.

Step 1. Prepare:

Update, upgrade and install the required packages.
If you use 32-bit system do not install linux-headers-amd64.
If you plan on using both 64-bit and 32-bit libraries check if your mirror list support both amd64 and i386. If not select one which does before you install pbuilder.

sudo apt update
sudo apt upgrade
sudo apt install pbuilder linux-headers-amd64

Edit your /etc/apt/sources.list by adding contrib to the end of every line which starts with deb (if it's not already there).
Add this line too.

deb-src http://httpredir.debian.org/debian unstable main non-free contrib

Download the source code from Debian Sid.

sudo apt update
mkdir "$HOME/nvidia-340xx" "$HOME/nvidia-settings"
cd "$HOME/nvidia-340xx"
apt source --download-only nvidia-legacy-340xx-driver
cd "$HOME/nvidia-settings"
apt source --download-only nvidia-settings-legacy-340xx

Edit /etc/apt/sources.list and remove this line.

deb-src http://httpredir.debian.org/debian unstable main non-free contrib

Step 2. Compile:

To compile the 64-bit version replace ???? with amd64.
To compile the 32-bit version replace ???? with i386.
In case you want both amd64 and i386 libraries on a 64-bit system run Step 2. twice.

sudo apt update
sudo pbuilder create --distribution trixie --architecture ????
cd "$HOME/nvidia-340xx"
sudo pbuilder build nvidia-graphics-drivers-legacy-340xx_340.108-25.dsc
cd "$HOME/nvidia-settings"
sudo pbuilder build nvidia-settings-legacy-340xx_340.108-7.dsc

Optional: If you no longer need the files created during this process.

sudo rm /var/cache/pbuilder/aptcache/*
sudo rm /var/cache/pbuilder/base.tgz
rm -r "$HOME/nvidia-340xx" "$HOME/nvidia-settings"

Step 3. Install:

Create a local repository for automated install with apt.
The -m flag is only required if you want both amd64 and i386 versions.

cd /var/cache/pbuilder/result
sudo sh -c 'dpkg-scanpackages -m . > Packages'

Edit your /etc/apt/sources.list once more to add this line.

deb [trusted=yes] file:/var/cache/pbuilder/result ./

Optional: Run the next step only if you are on 64-bit system and want both 64-bit and 32-bit libraries.

sudo dpkg --add-architecture i386

Optional: The following was not required for my 340xx gpu. But recommended many times in the comments.

Edit /etc/default/grub and find the line starting with GRUB_CMDLINE_LINUX_DEFAULT. Make it like this.

GRUB_CMDLINE_LINUX_DEFAULT="nvidia_drm.modeset=1 noplymouth nosplash"

Then update grub.

sudo update-grub

Before you proceed make sure that you have matching linux-headers for every single linux-image version on your system.

sudo apt update
sudo apt install nvidia-legacy-340xx-driver nvidia-settings-legacy-340xx

Optional: I recommend to create /etc/X11/xorg.conf file.

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
EndSection

Section "ServerFlags"
    Option         "IgnoreABI" "1"
EndSection

Reboot your computer and you are done.

FAQ and Troubleshooting:

-> Was this tested?
Yes, it was tested on Debian 13 and Debian 12 with lxde and bspwm.
But I won't be surprised if modern desktop environments like GNOME or KDE Plasma don't work.

-> Does suspend to RAM work?
Yes, it does.

-> Which display manager works?
I've only tested lxdm and lightdm but should work with others as well.

-> Why should I even bother with this when I can just install from Debian Sid?
The drivers in Sid are compiled with newer version libraries which are not compatible with your current system. Installing them may look fine at first glance but will also install new incompatible packages and will overwrite some of your existing packages with ones from Sid. This may result in insatiability or even in unrecoverable system.

-> Is Wayland supported?
No.

-> My mouse and keyboard work in tty but not in Xorg.
Install xserver-xorg-input-all.

-> Some applications don't start. Especially the GTK4 ones.
GTK4 is not supported by this driver. But there is a workaround. Open a terminal-emulator and prepend GSK_RENDERER=cairo before the application's name, like this.

GSK_RENDERER=cairo pavucontrol
GSK_RENDERER=cairo ghb

Do not put GSK_RENDERER=cairo in /etc/environment or in any other way as environment variable. Because this will force almost all GUI programs to run in Cairo fallback renderer.

-> VDPAU doesn't work in mpv.
The version of mpv in the repositories doesn't include the x11 backend.
It can be added by recompiling mpv with this rule enabled -Dgl-x11=enabled. Then start mpv like this.

mpv --gpu-context=x11 --hwdec=vdpau

-> I've followed every single step but it doesn't work.
Run these and see if you have matching linux-headers for every linux-image.

apt list --installed | grep linux-image
apt list --installed | grep linux-headers

If there are missing ones, install them and go to the next question.

-> I've installed the linux-headers (after the Nvidia driver) but doesn't work. How to fix it?
Installing the headers after the driver doesn't trigger dkms. Run this.

sudo apt reinstall nvidia-legacy-340xx-kernel-dkms

-> Still doesn't work.
There might be a problem with /etc/X11/xorg.conf. Delete this file and try without it.
If doesn't work try to delete everything in /etc/X11/xorg.conf.d/ except 20-nvidia-legacy-340xx.conf.
Another possible solution is to generate new Xorg configuration with nvidia-xconfig.

-> How to use the deb822-style format sources?
If you prefer to use this format append the @macflav snipped to /etc/apt/sources.list.d/debian.sources.
I haven't tested this method yet.

# added for building nvidia-legacy driver
# deb-src http://httpredir.debian.org/debian unstable main non-free contrib
Types: deb-src
URIs: http://httpredir.debian.org/debian/
Suites: unstable
Components: main non-free contrib
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
#
# deb [trusted=yes] file:/var/cache/pbuilder/result ./
Types: deb
URIs: file:/var/cache/pbuilder/result/
Suites: trixie
Components: main
Trusted: yes
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

Then you have to move all amd64 packages from /var/cache/pbuilder/result to /var/cache/pbuilder/result/dists/trixie/main/binary-amd64/.
If you have any i386 they go to /var/cache/pbuilder/result/dists/trixie/main/binary-i386/.

-> Why pbuilder complains that either i386 or amd64 packages were not found even though I've updated my mirror list?
Modifying /etc/apt/sources.list after the pbuilder installation doesn't affect pbuilder. Fix your mirrors then run.

sudo apt purge pbuilder
sudo apt install pbuilder

-> I have Nvidia Optimus what should I do?
I don't have such hardware to test but this has been discussed in my previous guide.

-> In my case apt didn't automatically install the i386 packages.
Try to install them like this.
The third line is optional.

sudo dpkg --add-architecture i386
sudo apt install nvidia-legacy-340xx-driver-libs-i386
sudo apt install libnvidia-legacy-340xx-cuda1-i386

-> Should I keep the source?
Yes, you will have to recompile the driver once in a while.
Some day the Debian team will deprecate these drivers and delete the source from the servers.
Then you will have hard time finding the source elsewhere.

-> How often should I recompile the driver?
I don't know the exact answer but I have few assumptions.

Every time any of the dependencies is updated.
Every time GCC is updated.
If the driver stops working.
If dkms fails.

Before you start recompiling you can run these just in case.

sudo rm /var/cache/pbuilder/base.tgz
sudo rm /var/cache/pbuilder/result/*

-> Can I somehow make pbuilder faster?
Yes, if you use HDD and you have at least 8GB RAM you can significantly speed the process up.
If you use SSD there won't be much difference.
I can't find this method documented so I'm not sure if I can recommended it or not.

sudo mount -t tmpfs -o size=4G tmpfs /var/cache/pbuilder/build

When you finish using pbuilder run.
Everything in /var/cache/pbuilder/build will be instantly deleted after this command.

sudo umount /var/cache/pbuilder/build

-> Wine/Steam doesn't work. Failed to load libGL: libGL.so.1:... No such file or directory...
Read the very first comment in the comments section below.

-> I see RIP warnings in the kernel log.
I was able to remove them (except one), by the following...
The nvidia-340xx source doesn't include this patch, while nvidia-390xx does.

--- a/nv-drm.c
+++ b/nv-drm.c
@@ -168,6 +168,9 @@
     .poll = drm_poll,
     .read = drm_read,
     .llseek = noop_llseek,
+#if defined(FOP_UNSIGNED_OFFSET)
+    .fop_flags   = FOP_UNSIGNED_OFFSET,
+#endif
 };
 
 static struct drm_driver nv_drm_driver = {

The easiest way to install it is to apply the patch directly to /usr/src/nvidia-legacy-340xx-340.108/nv-drm.c then run.

sudo apt reinstall nvidia-legacy-340xx-kernel-dkms

Uninstalling these, since I don't use them, removed the rest RIP warnings.

libnvidia-legacy-340xx-cuda1
libnvidia-legacy-340xx-nvcuvid1
libnvidia-legacy-340xx-encode1

-> I have other video drivers should I keep them?
These are not necessary.
Purging xserver-xorg will also delete /etc/X11/xorg.conf. Recreate it if necessary.

xserver-xorg
xserver-xorg-video-all
xserver-xorg-video-amdgpu
xserver-xorg-video-ati
xserver-xorg-video-dummy
xserver-xorg-video-fbdev
xserver-xorg-video-nouveau
xserver-xorg-video-vesa
xserver-xorg-video-vmware

-> My question is not listed here.
I've made an earlier version of this guide here where a lot has been discussed. You might find something useful reading there.

Useful logs and tools for troubleshooting:

Replace lxdm with your display manager.

systemctl status lxdm.service
cat /var/log/Xorg.0.log
journalctl
dmesg

lsmod | grep nouveau
lsmod | grep nvidia
modprobe -r nouveau
modprobe nvidia
nvidia-settings
nvidia-xconfig
nvidia-smi
vdpauinfo
glxgears
glxinfo
lspci
@Anakiev2
Copy link
Copy Markdown
Author

Anakiev2 commented Oct 8, 2025

I think most of the problems you have are caused by plymouth. It's useless just delete it.

@AnonEx-Machina
Copy link
Copy Markdown

@Anakiev2 Thankyou for your hardwork. Very appeciated.

https://wiki.archlinux.org/title/Table_of_contents

GRUB_CMDLINE_LINUX="nvidia_drm.modeset=1 noplymouth nosplash"

@Anakiev2
Copy link
Copy Markdown
Author

@tokamakfusionreactor Is this the correct URL?

@gorlik
Copy link
Copy Markdown

gorlik commented Oct 12, 2025

Thanks for the tutorial.
I still get the RIP upon driver load. There is a debian bug report on this. [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1099016]
glxgears works, 3D apps in wine work.
I can't get kicad, freecad or tuxracer to work. All crash immediately with:
[ 39.952562] kicad[3695]: segfault at 7fc160203370 ip 00007fc160203370 sp 00007fff9c172188 error 14 in libnvidia-tls.so.340.108[3370,7fc160203000+1ff000] likely on CPU 1 (core 1, socket 0)

@Anakiev2
Copy link
Copy Markdown
Author

@gorlik KiCad is hard and time consuming you have to recompile wxWidgets first than kicad without egl but if you do that every other application which uses wxWidgets won't work. I've made a tutorial some time ago (for Arch Linux) but it's much easier to switch to nouveau instead.
https://bbs.archlinux.org/viewtopic.php?id=286442

@BlackMoses2017
Copy link
Copy Markdown

Thank you so so much. You saved me buying a new card.

20220408_015229_IMG_5581

@Anakiev2
Copy link
Copy Markdown
Author

I had some time to update the guide. Hopefully this will fix the most issues.

@mahdi-salimi05
Copy link
Copy Markdown

mahdi-salimi05 commented Oct 24, 2025

When I attempt to run GTK applications (like all gtk4 or some gtk3); this error appears and the program won't run:

‍‍

(epiphany:2): epiphany-WARNING **: 14:24:35.018: Failed to search secrets in password schema: org.freedesktop.DBus.Error.ServiceUnknown
No provider of glGenSamplers found. Requires one of:
Desktop OpenGL 3.3
GL_ARB_sampler_objects
OpenGL ES 3.0

because this driver's EGL 1.4 only supports GLES GLSL ES 1.0. To fix, you can run those applications with GSK_RENDERER=cairo to disable hardware acceleration for rendering and it degrades performance for GTK, but it's certainly working. You can instead use GDK_DEBUG=gl-prefer-gl GSK_RENDERER=gl or (with 4.16) GDK_DISABLE=egl,gles-api,wgl,vulkan,dmabuf,offload,threads,glx GSK_RENDERER=gl to force those applications use GL instead of EGL or even GLX (those applications runs with GLX but it is buggy and the application has flickering issues).
Some Qt6 apps that have GLX problems should run with QT_XCB_GL_INTEGRATION=xcb_egl to use EGL.

To make these changes for all apps, put this to /etc/environment:(this will force all apps to use accelerated GL)

GDK_DEBUG=gl-prefer-gl
GDK_DISABLE=egl,gles-api,wgl,vulkan,dmabuf,offload,threads,glx
QT_XCB_GL_INTEGRATION=xcb_egl
GSK_RENDERER=gl

@Anakiev2
Copy link
Copy Markdown
Author

@mahdi-salimi05 Thanks for sharing this information I will put it in the faq.

@sickel
Copy link
Copy Markdown

sickel commented Nov 8, 2025

Thanks a lot for the guide, but I am stuck, When trying to start X, It never comes up and in the Xorg.0.log, I find:

[ 617.863] (II) LoadModule: "nvidia"
[ 617.863] (WW) Warning, couldn't open module nvidia
[ 617.863] (EE) Failed to load module "nvidia" (module does not exist, 0)
[ 617.863] (EE) No drivers available.
[ 617.863] (EE)
Fatal server error:
[ 617.864] (EE) no screens found(EE)

Any idea what to do? I have an NVIDIA Corporation GF106GL [Quadro 2000] (rev a1), so I am using the 390 driver. The PC was running with the noveau-driver, but I have uninstalled all xserver-xorg packages except for the nvidia-legacy-390XX

@Anakiev2
Copy link
Copy Markdown
Author

Anakiev2 commented Nov 9, 2025

You should keep xserver-xorg-video-nvidia-legacy-390xx.
This is what I have currently installed.

firmware-nvidia-graphics
glx-alternative-nvidia
libegl1-nvidia-legacy-340xx
libgl1-nvidia-legacy-340xx-glx
libgles1-nvidia-legacy-340xx
libgles2-nvidia-legacy-340xx
libnvidia-legacy-340xx-cfg1
libnvidia-legacy-340xx-eglcore
libnvidia-legacy-340xx-glcore
libnvidia-legacy-340xx-ml1
nvidia-installer-cleanup
nvidia-kernel-common
nvidia-legacy-340xx-alternative
nvidia-legacy-340xx-driver
nvidia-legacy-340xx-driver-bin
nvidia-legacy-340xx-driver-libs
nvidia-legacy-340xx-kernel-dkms
nvidia-legacy-340xx-kernel-support
nvidia-legacy-340xx-vdpau-driver
nvidia-modprobe
nvidia-settings-legacy-340xx
nvidia-support
x11-xserver-utils
xserver-common
xserver-xorg-core
xserver-xorg-input-all
xserver-xorg-input-libinput
xserver-xorg-video-nvidia-legacy-340xx

@sickel
Copy link
Copy Markdown

sickel commented Nov 13, 2025

To solve the nvidia driver not found problem, I had to remove a few more of the old nvidia packages, but I also had to manually copy the diver:

sudo cp /usr/lib/nvidia/legacy-390xx/nvidia_drv.so /usr/lib/xorg/modules/drivers/

and some of the config files:

sudo cp /etc/nvidia/legacy-390xx/* /etc/modprobe.d/

and at least for the initial startup, I had to give myself read and write access to all ttys (probably probing for mouse...)

then it is working, at least for starting X manually.

Thanks a lot for your work explaining how to compile and install the driver!

(running trixie on Dell precision T5500 with a GF106GL / Quadro 2000 )

I have the following relevant packages installed:

$ apt list --installed | grep nvidia
firmware-nvidia-graphics/stable,now 20250410-2 all [installed,automatic]
glx-alternative-nvidia/stable,now 1.2.2 amd64 [installed,automatic]
libegl-nvidia-legacy-390xx0/unknown,now 390.157-14 amd64 [installed,automatic]
libgl1-nvidia-legacy-390xx-glvnd-glx/unknown,now 390.157-14 amd64 [installed,automatic]
libgles-nvidia-legacy-390xx1/unknown,now 390.157-14 amd64 [installed,automatic]
libgles-nvidia-legacy-390xx2/unknown,now 390.157-14 amd64 [installed,automatic]
libglx-nvidia-legacy-390xx0/unknown,now 390.157-14 amd64 [installed,automatic]
libglx-nvidia0/stable,now 550.163.01-2 amd64 [installed,automatic]
libnvidia-cfg1/stable,now 550.163.01-2 amd64 [installed,automatic]
libnvidia-eglcore/stable,now 550.163.01-2 amd64 [installed,automatic]
libnvidia-encode1/stable,now 550.163.01-2 amd64 [installed,automatic]
libnvidia-glcore/stable,now 550.163.01-2 amd64 [installed,automatic]
libnvidia-glvkspirv/stable,now 550.163.01-2 amd64 [installed,automatic]
libnvidia-gpucomp/stable,now 550.163.01-2 amd64 [installed,automatic]
libnvidia-legacy-390xx-cfg1/unknown,now 390.157-14 amd64 [installed,automatic]
libnvidia-legacy-390xx-cuda1/unknown,now 390.157-14 amd64 [installed,automatic]
libnvidia-legacy-390xx-eglcore/unknown,now 390.157-14 amd64 [installed,automatic]
libnvidia-legacy-390xx-encode1/unknown,now 390.157-14 amd64 [installed,automatic]
libnvidia-legacy-390xx-fatbinaryloader/unknown,now 390.157-14 amd64 [installed,automatic]
libnvidia-legacy-390xx-glcore/unknown,now 390.157-14 amd64 [installed,automatic]
libnvidia-legacy-390xx-ml1/unknown,now 390.157-14 amd64 [installed,automatic]
libnvidia-legacy-390xx-nvcuvid1/unknown,now 390.157-14 amd64 [installed,automatic]
libnvidia-legacy-390xx-ptxjitcompiler1/unknown,now 390.157-14 amd64 [installed,automatic]
libnvidia-pkcs11-openssl3/stable,now 550.163.01-2 amd64 [installed,automatic]
libnvidia-ptxjitcompiler1/stable,now 550.163.01-2 amd64 [installed,automatic]
libnvidia-rtcore/stable,now 550.163.01-2 amd64 [installed,automatic]
nvidia-alternative/stable,now 550.163.01-2 amd64 [installed,automatic]
nvidia-detect/stable,now 550.163.01-2 amd64 [installed]
nvidia-egl-common/stable,now 550.163.01-2 amd64 [installed,automatic]
nvidia-installer-cleanup/stable,now 20240109+1 amd64 [installed,automatic]
nvidia-kernel-common/stable,now 20240109+1 amd64 [installed,automatic]
nvidia-kernel-support/stable,now 550.163.01-2 amd64 [installed,auto-removable]
nvidia-legacy-390xx-alternative/unknown,now 390.157-14 amd64 [installed,automatic]
nvidia-legacy-390xx-driver-bin/unknown,now 390.157-14 amd64 [installed,automatic]
nvidia-legacy-390xx-driver-libs/unknown,now 390.157-14 amd64 [installed,automatic]
nvidia-legacy-390xx-driver/unknown,now 390.157-14 amd64 [installed]
nvidia-legacy-390xx-egl-icd/unknown,now 390.157-14 amd64 [installed,automatic]
nvidia-legacy-390xx-kernel-dkms/unknown,now 390.157-14 amd64 [installed]
nvidia-legacy-390xx-kernel-support/unknown,now 390.157-14 amd64 [installed,automatic]
nvidia-legacy-390xx-smi/unknown,now 390.157-14 amd64 [installed,automatic]
nvidia-legacy-390xx-vdpau-driver/unknown,now 390.157-14 amd64 [installed,automatic]
nvidia-legacy-390xx-vulkan-icd/unknown,now 390.157-14 amd64 [installed,automatic]
nvidia-legacy-check/stable,now 550.163.01-2 amd64 [installed,automatic]
nvidia-modprobe/stable,now 570.133.07-1 amd64 [installed,automatic]
nvidia-persistenced/stable,now 550.163.01-1 amd64 [installed,automatic]
nvidia-settings-legacy-390xx/unknown,now 390.157-1 amd64 [installed]
nvidia-support/stable,now 20240109+1 amd64 [installed,automatic]
nvidia-vulkan-common/stable,now 550.163.01-2 amd64 [installed,automatic]
nvidia-vulkan-icd/stable,now 550.163.01-2 amd64 [installed,automatic]
xserver-xorg-video-nvidia-legacy-390xx/unknown,now 390.157-14 amd64 [installed]

I could/should probaby remove all the 550-packages

$ apt list --installed | grep xorg
xorg-docs-core/stable,now 1:1.7.3-1 all [installed,automatic]
xserver-xorg-core/stable-security,now 2:21.1.16-1.3+deb13u1 amd64 [installed,automatic]
xserver-xorg-input-all/stable,now 1:7.7+24 amd64 [installed]
xserver-xorg-input-libinput/stable,now 1.5.0-1 amd64 [installed,automatic]
xserver-xorg-input-wacom/stable,now 1.2.3-1 amd64 [installed,automatic]
xserver-xorg-legacy/stable-security,now 2:21.1.16-1.3+deb13u1 amd64 [installed,automatic]
xserver-xorg-video-nvidia-legacy-390xx/unknown,now 390.157-14 amd64 [installed]
xserver-xorg/stable,now 1:7.7+24 amd64 [installed,automatic]

@Anakiev2
Copy link
Copy Markdown
Author

@sickel can you try something like this in /etc/X11/xorg.conf without the files you've copied. This is ported from my Arch Linux setup but I am not sure if the first path is correct or it should be /usr/lib/nvidia or something else.

Section "Files"
    ModulePath   "/usr/lib/nvidia/xorg"
    ModulePath   "/usr/lib/xorg/modules"
EndSection

@drnicnic
Copy link
Copy Markdown

this was great, easy to follow. I just had to make a small update in the Compile step, looks like the driver had been updated

nvidia-graphics-drivers-legacy-340xx_340.108-25.dsc to - nvidia-graphics-drivers-legacy-340xx_340.108-26.dsc.

Thanks again!

@sickel
Copy link
Copy Markdown

sickel commented Nov 17, 2025

@Anakiev2 Thanks, I was looking for how to tell x where to look for files. I deleted the nvidia driver I had copied to the /usr/lib/xorg/modules and added this section to xorg.conf:

Section "Files"
Modulepath "/usr/lib/nvidia/legacy-390xx"
ModulePath "/usr/lib/xorg/modules"
EndSection

as I found the nvidia_drv.so file in the legacy-390xx - folder.

That works great, I still have the module loading conf files copied to /etc/modules.d though.

@coolDudeRude
Copy link
Copy Markdown

coolDudeRude commented Jan 11, 2026

@Anakiev2 Thanks for this awesome guide. I've installed both 340xx & 390xx. One problem I encountered with 390xx on debian trixie,
was that kitty (version 0.41.1) would segfault. So, in case anyone else is experiencing the same issue, see this thread for more details.
Basically, you'll have to manually link, libnvidia-tls.so.390.157 against libpthread.
Which can be done with patchelf

sudo patchelf --add-needed /lib/x86_64-linux-gnu/libpthread.so.0 /lib/x86_64-linux-gnu/libnvidia-tls.so.390.157

@sgothel
Copy link
Copy Markdown

sgothel commented Jan 14, 2026

Thank you @Anakiev2, this enabled me to update my son's laptop to Debian 13 with an old card (390xx0 driver). KUDOS!

@attila-v
Copy link
Copy Markdown

attila-v commented Feb 14, 2026

thank you, it is working on HP workstation xw4600 with Quadro FX1800 and i3wm on trixie
but KiCad started with segfault :-(
thanks again

@orestioss
Copy link
Copy Markdown

I just finished setting it up as of 30/3/26. Although i run into a few problems, i was able to get my gpu running normally in KDE X11. Im new to linux and i didnt have that much help, just this repo and claude. I tried other llms for help but they didnt know shit about linux. Just saying that claude can help a lot with a set up like this. I am on an old hp-15 notebook optimus laptop running a Geforce 820m and an intel-i3, one of the problems was that the xorg.conf needs to be configured specifically for optimus systems. For that i just followed this tutorial:
https://wiki.debian.org/NVIDIA%20Optimus#Using_NVIDIA_GPU_as_the_primary_GPU
But then i kept running into the main problem which was that the pbuilder-compiled 390xx package does not fully integrate with Trixie's GLVND diversion system managed by glx-diversions. To fix this, i had to manually add some symlinks that were supposed to be made automatically. Here is exactly what i did/added:

  1. libGL.so.1 was not found in the standard path
    The glx-diversions package diverts libGL.so.1 to /usr/lib/mesa-diverted/x86_64-linux-gnu/ which is my intergraded cpus graphics but nothing restores it for nvidia. Fix:
    sudo ln -s /usr/lib/mesa-diverted/x86_64-linux-gnu/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so.1
    sudo ln -s /usr/lib/mesa-diverted/x86_64-linux-gnu/libGL.so.1.7.0 /usr/lib/x86_64-linux-gnu/libGL.so.1.7.0

  2. libEGL.so.1 same diversion problem. Fix:
    sudo ln -s /usr/lib/mesa-diverted/x86_64-linux-gnu/libEGL.so.1 /usr/lib/x86_64-linux-gnu/libEGL.so.1
    sudo ln -s /usr/lib/mesa-diverted/x86_64-linux-gnu/libEGL.so.1.1.0 /usr/lib/x86_64-linux-gnu/libEGL.so.1.1.0

  3. nvidia_drv.so was missing from Xorg drivers directory
    The package does not place the DDX driver where Xorg expects it. Fix:
    sudo ln -s /usr/lib/nvidia/legacy-390xx/nvidia_drv.so /usr/lib/xorg/modules/drivers/nvidia_drv.so

  4. libglx.so version was wrong in Xorg extensions
    Xorg was loading Mesa's libglx.so instead of nvidia's, causing the error: "Failed to initialize the GLX module". Fix:
    sudo mv /usr/lib/xorg/modules/extensions/libglx.so /usr/lib/xorg/modules/extensions/libglx.so.mesa-backup
    sudo ln -s /usr/lib/nvidia/legacy-390xx/libglx.so /usr/lib/xorg/modules/extensions/libglx.so

  5. Reload the linker cache after all symlinks:
    sudo ldconfig

This survived a reboot, but i was afraid that maybe when glx is updated these could break so i just made them a system service that launches before sddm so they are created no matter what. Here is exactly what i did:

Create a file at: /usr/local/bin/nvidia-symlinks-fix.sh that contains:
#!/bin/bash
MESA_DIR="/usr/lib/mesa-diverted/x86_64-linux-gnu"
SYS_DIR="/usr/lib/x86_64-linux-gnu"

ln -sf "$MESA_DIR/libGL.so.1" "$SYS_DIR/libGL.so.1"
ln -sf "$MESA_DIR/libGL.so.1.7.0" "$SYS_DIR/libGL.so.1.7.0"
ln -sf "$MESA_DIR/libEGL.so.1" "$SYS_DIR/libEGL.so.1"
ln -sf "$MESA_DIR/libEGL.so.1.1.0" "$SYS_DIR/libEGL.so.1.1.0"

ln -sf /usr/lib/nvidia/legacy-390xx/libglx.so
/usr/lib/xorg/modules/extensions/libglx.so

ln -sf /usr/lib/nvidia/legacy-390xx/nvidia_drv.so
/usr/lib/xorg/modules/drivers/nvidia_drv.so

ldconfig

Then create another at: /etc/systemd/system/nvidia-symlinks-fix.service that contains:
[Unit]
Description=Fix NVIDIA legacy-390xx GLX symlinks
Before=display-manager.service
After=local-fs.target

[Service]
Type=oneshot
ExecStart=/usr/local/bin/nvidia-symlinks-fix.sh
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

And finally run these to enable the service:
sudo chmod +x /usr/local/bin/nvidia-symlinks-fix.sh
sudo systemctl daemon-reload
sudo systemctl enable nvidia-symlinks-fix.service

That was it for me after that my system loaded normally with my gpu as my opengl renderer and vendor, sddm and plasma kde started normally no tty or black screens. Although i do have to note that because my gpu is old it has some issues on kde like some slight glitches but nothing that bad.
For some of the fixes you might have to adjust the paths not just copy and paste mine, its best to search first where each file is
NOTE:As i said im new to linux so if any of these were common knowledge or using an ai is prohibited, please dont roast me im still learning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment