Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save oprizal/998635a2ff5cbecb0519455c12b2994f to your computer and use it in GitHub Desktop.
Save oprizal/998635a2ff5cbecb0519455c12b2994f to your computer and use it in GitHub Desktop.
Install Nvidia legacy driver 340xx on Debian 11 Bullseye

How to Install Nvidia Legacy 340xx Driver on Debian 11 Bullseye

DE/WM: Xfce4 & i3

First of all, always update the system first.

$ sudo apt update && sudo apt upgrade

Then adding Debian SID repository since there are no available Nvidia 340xx legacy driver available on Debian 11---or at least it's not available if we read the Debian documentation here: Debian Nvidia Documentation.

There we can see that on Bullseye and Bookworm the only available are version 390xx and 460xx for Bullseye then 390xx and 470xx for Bookworm.

But bare in mind, it's not stable. But on my system with GeForce 310M it's working fine.

WARNING: It's important to run sudo apt update above BEFORE adding Debian SID repositories. You don't want to mix your current installed system Bullseye version with SID version. All we need only access to Nvidia legacy 340xx driver that's not available on Bullseye repositories.

Create a *.list file on /etc/apt/sources.list.d/. Then edit it and add Debian SID repositories address.

$ sudo touch /etc/apt/sources.list.d/sid-repositories.list
$ sudo nano /etc/apt/sources.list.d/sid-repositories.list

Below are Debian SID repositories address.

# Insert this line to /etc/apt/sources.list.d/sid-repositories.list
# we created above.
# Debian Sid.
deb http://deb.debian.org/debian/ sid main contrib non-free

After that install the Nvidia proprietary driver and let it finished.

$ sudo apt update && sudo apt install nvidia-legacy-340xx-driver firmware-misc-nonfree

You'll get a message prompt mentioning about conflict with nouveau driver, but this is ok. Read carefully. This message prompt only remainder to reboot your system after installation has finished.

After installation finished, then reboot your system.

$ systemctl reboot

When you successfully reboot and login to the system, you should remove the file---we created above---which have Debian SID address to prevent mixing the system version.

There should be no more update with Nvidia 340xx driver since it's no more development to this driver version---as long as I remember. That's why it must be safe to not using Debian SID repositories address again in the future.

$ sudo rm /etc/apt/sources.list.d/sid-repositories.list

Check if your driver successfully installed.

$ lsmod | grep -i nvidia

You should get drm mentioning nvidia.

Once more, it doesn't work with wayland.

@fr33m0nk
Copy link

I followed the instructions but "apt install nvidia-legacy-340xx-driver" replied "Unable to locate package nvidia-legacy-340xx-driver". It also complained that "firmware-misc-nonfree is not available". I didn't include the comments in the sid-repositories.list file. Are they necessary?

The comments aren't necessary.
You may have missed executing sudo apt-get update after adding the sid repositories.

@NikolayKuraga
Copy link

Боже правый!
Worked for Devuan 5 (daedalus), runit, Linux 6.1.0-17-amd64:

  1. Commented sources in /etc/apt/sources.list, then added there this line:
    deb http://deb.devuan.org/merged ceres main contrib non-free non-free-firmware
  2. sudo apt update && sudo apt install nvidia-legacy-340xx-driver firmware-misc-nonfree
  3. Uncommented sources in /etc/apt/sources.list, removed added previously line
  4. sudo reboot

Thank you very much!

@Anakiev2
Copy link

Anakiev2 commented Apr 16, 2024

This method will mix your stable packages with packages from unstable.
Try this method instead it won't mix your packages. It's for Debian 12 but will probably work on Debian 11 too:
https://gist.github.com/Anakiev2/b828ed2972c04359d52a44e9e5cf2c63

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