How to Install or Upgrade Nvidia Drivers on Debian 11 Bullseye

Most modern Linux Desktop systems such as Debian come with an Nvidia driver pre-installed in the Nouveau open-source graphics device driver for Nvidia video cards. For the most part, this is acceptable; however, if you are using your Linux system for graphical design or gaming, you may get better drivers.

Historically, the Nouveau proprietary drivers are slower than Nvidia’s proprietary drivers, along with lacking the newest features, software technology, and support for the latest graphics card hardware. In most situations, upgrading your Nvidia Drivers using the following guide is more beneficial than not doing it. In some cases, you may see some substantial improvements overall.

In the following tutorial, you will learn how to install Nvidia Graphic Drivers for the series 470.xx / 465.xx / 460.xx / 390.xx and 340.xx from the Nvidia Proprietary Repository, giving you the latest in software available.

Advertisement

Prerequisites

  • Recommended OS: Debian 11 Bullseye
  • User account: A user account with sudo or root access.
  • Required Packages: wget

Update Operating System

Update your Debian operating system to make sure all existing packages are up to date:

sudo apt update && sudo apt upgrade -y

The tutorial will be using the sudo command and assuming you have sudo status.

To verify sudo status on your account:

sudo whoami

Example output showing sudo status:

[joshua@debian~]$ sudo whoami
root

To set up an existing or new sudo account, visit our tutorial on Adding a User to Sudoers on Debian.

To use the root account, use the following command with the root password to log in.

su

Optional – Install Nvidia Beta / New Branch Drivers

The tutorial below focuses on installing stable Nvidia drivers, visit our tutorial on installing the beta or new branch drivers on Debian 11 bullseye by clicking here.

Install Nvidia Drivers

Installation Presetup

By default, Nvidia proprietary drivers do not come with Debian 11 Bullseye. However, this can be achieved by modifying the “/etc/apt/sources.list” and adding the “contrib” and “non-free” to the end of the line “deb http://deb.debian.org/debian/ sid main contrib non-free”.

First, use a text editor to open the sources.list file:

sudo nano /etc/apt/sources.list

Next, find the line:

deb http://deb.debian.org/debian/ bullseye main

Then change to the following, or add the extra parts yourself:

deb http://deb.debian.org/debian/ bullseye main contrib non-free

Once added, update your repository list.

sudo apt update

Before installing any Nvidia drivers, you will need to install the proper kernel headers for the NVIDIA driver to build with. You can install either 64bit or 32bit, and you can find this out by running the lscpu command:

lscpu

Example output:

How to Install or Upgrade Nvidia Drivers on Debian 11 Bullseye

From the output, the system is 64bit, so the following headers need to be installed:

sudo apt install linux-headers-amd64

If you did have a 32bit system, use the following command instead:

32-bit non-PAE kernel:

sudo apt install linux-headers-686

32-bit PAE kernel:

sudo apt install linux-headers-686-pae

Install Nvidia Drivers

Next, you can install the package “nvidia-detect,” which will automatically suggest the best package for your graphics card. To do this, use the following command:

sudo apt install nvidia-detect

Now that Nvidia-detect is installed, run the command to check your current Nvidia Graphics Card:

nvidia-detect

Example output:

How to Install or Upgrade Nvidia Drivers on Debian 11 Bullseye

The output has shown the machine in the example has a GeForce GTX 1650 card and that it is recommended to install the nvidia-driver package. Given the GeForce GTX 1650 is an older card, Nvidia’s default package is the safest bet for stability and security. If you have a bleeding Edge card, this will be covered further on in the tutorial.

Next, install the recommended package:

sudo apt install nvidia-driver linux-image-amd64

Example output with all extra dependencies to be installed:

How to Install or Upgrade Nvidia Drivers on Debian 11 Bullseye

Type “Y,” then press the “ENTER KEY” to proceed with the installation.

During the installation, you will see a prompt as follows:

How to Install or Upgrade Nvidia Drivers on Debian 11 Bullseye

This is due to the free Nouveau graphics driver conflicting with the new driver being installed. As per the message, you will need to reboot to correct this; for now, press the “ENTER KEY” to proceed.

Once installed, reboot your system.

sudo reboot now

Once logged back in, run the “nvidia-smi” command to confirm the new Nvidia Drivers have been installed.

nvidia-smi

Example output:

How to Install or Upgrade Nvidia Drivers on Debian 11 Bullseye

As the output has shown, driver version 460.91.03 has been successfully installed.

Install Nvidia Legacy Drivers

If your Nvidia Graphics card is quite old from 400 Series downwards, you will need to install the legacy drivers. The process is the same, just with a new install command:

sudo apt install nvidia-legacy-390xx-driver firmware-misc-nonfree

Example output:

How to Install or Upgrade Nvidia Drivers on Debian 11 Bullseye

Type “Y,” then press the “ENTER KEY” to proceed with the installation.

Once complete, do not forget to reboot your system.

sudo reboot now

Next, run the “nvidia-smi” command to verify the installation.

nvidia-smi

The 340 series can technically be installed; however, it is no longer supported, and several major security flaws exist in those drivers. It is not advised to install these drivers if you need to replace 390xx to 340xx but be warned that Debian does not recommend this.

Advertisement

Optional. Install Nvidia Drivers Manually

Suppose you require the latest Nvidia packages because your graphics card is a new module that isn’t supported in the default proprietary repository from Nvidia on Debian 11 Bullseye. To install the latest and most up-to-date drivers, you will need to download the .run file from the Nvidia downloads page and install it manually. This process is more involved, but installing the drivers manually means choosing which version you want to be installed to benefit you.

First, visit the Nvidia downloads page and download the latest .run file or get the link and use the wget command.

Example only (make sure to get the latest link):

wget https://us.download.nvidia.com/XFree86/Linux-x86_64/470.74/NVIDIA-Linux-x86_64-470.74.run

Install Linux Headers and compilation dependencies:

sudo apt install linux-headers-$(uname -r) build-essential libglvnd-dev pkg-config

Next, blacklist the nouveau driver create a blacklist file:

sudo nano /etc/modprobe.d/blacklist-nouveau.conf

Once inside the file, add the following:

blacklist nouveau
options nouveau modeset=0

Save the file CTRL+O, then exit CTRL+X. You will then need to regenerate the kernel initramfs:

sudo update-initramfs -u

Now, reboot to the multi-user run level. This will disable the GUI user after reboot:

sudo systemctl set-default multi-user.target
sudo reboot now

Login to your account; it will be a terminal-only screen. Navigate to the directory if needed where you downloaded the .run file too. Next, run the following bash command to start the installation process.

Example only (your version will be different and more updated in the future):

bash NVIDIA-Linux-x86_64-470.74.run

If everything has been set correctly, you will see a screen and loading bar for building the kernel. After a few minutes, you will see your first prompt.

This informs you if you would like to install 32-bit compatibility, select Yes or No to proceed.

Install NVIDIA's 32-bit compatibility libraries?
  
     Yes                                                           No

Next, you will receive another prompt:

You are asked to keep default settings; the recommended option for fresh installs would be Yes.

Would you like to run the nvidia-xconfig utility to automatically update your X configuration
file so that the NVIDIA X driver will be used when you restart X? 
Any pre-existing X configuration file will be backed up.
                                                                                
    Yes                                                            No

Now that the drivers are installed, you need to reboot your system but first, make sure to switch back to the graphical UI:

sudo systemctl set-default graphical.target
sudo reboot now

Now, log back into your Debian desktop and run the “nvidia-smi” command to see if the latest manually downloaded drivers are installed:

nvidia-smi

Example output:

nvidia 470.74 latest bleeding edge drivers example on debian 11 bullseye | LinuxCapable

As you can see, the 470.74 drivers have been successfully installed. Note, the versions will change in the future, but the same principle remains, just updating the commands to suit the new Nvidia version names.

Now, you can launch your Nvidia panel in Activities > Show Applications > NVIDIA X Server.

Example:

activities show applications nvidia gui debian 11 bullseye | LinuxCapable

In the panel, you can adjust settings and see additional information using the Nvidia GUI.

Example:

nvidia x server example debian 11 bullseye | LinuxCapable
Advertisement

Comments and Conclusion

In the tutorial, you learned how to install the latest stable or beta drivers on your Debian 11 Bullseye Desktop. The decision on which drivers to install will come down mainly with the age of the card. For older cards, use the default Nvidia repository, and recommended packages should be installed. The bleeding edge will be the go-to for gamers with the latest cards requiring the most up-to-date packages. Still, the risks of instability and slight potential security issues will increase using the bleeding edge drivers.

Subscribe
Notify of
19 Comments
Inline Feedbacks
View all comments
analogtek
Guest
Wednesday, October 6, 2021 1:19 am

This is the hard way. I go to Nvidia direct. Get the driver of choice/need and install VIA command line root (the old school unix/linux way). But if you need to have the debian configured driver or a new person, this might be the better way.

Chris
Guest
Reply to  analogtek
Tuesday, October 26, 2021 2:02 am

What do you type on the command line to install it from the nvidia website file? Do you mean the .run file? Is this something I can do from putty? Or would I need to put the file on a thumbdrive? I don’t have gnome on my Debian 11.

analogtek
Guest
Reply to  Chris
Tuesday, November 9, 2021 5:56 am

sh nvidia****.run But use the correct syntactic/and spelling. Done it true root mode. This is hard core stuff. As said previously- hard core unix/linux old school way. If you mess up you will destroy!

julian
Guest
Friday, October 15, 2021 9:58 pm

de 32 bit… si no luego no funcionan.

anonimuuu
Guest
Reply to  Joshua James
Saturday, November 20, 2021 1:09 am

He said “where is 32 bit nvidia-drivers?” I guess.

hyperstriker
Guest
Reply to  anonimuuu
Tuesday, November 23, 2021 10:26 pm

of 32 bits, otherwise later on will not work

Andrew
Guest
Saturday, October 16, 2021 12:39 am

I added the contrib and non-free sources, and installed the headers, but when I try to install the driver I get this:

apt install nvidia-driver
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package nvidia-driver is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'nvidia-driver' has no installation candidate

I get the same error when I try to install nvidia-detect.
Debian 11, fresh install, apt is all updated and upgraded.

I haven’t tried installing directly from Nvidia, yet. That’ll be my next step, I guess.

Any suggestions would be appreciated.

Andrew
Guest
Reply to  Joshua James
Sunday, October 17, 2021 1:20 am

I have a GeForce RTX 3060, but it turned out to be user error. I added contrib and non-free to the deb-src line, instead of the deb line. Once I fixed that it worked just fine.

Thanks for the great tutorial!

Chris
Guest
Tuesday, October 26, 2021 2:01 am

When I type Nvidia-SMI it says “NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running” When I type: apt install linux-headers-amd64, it says “linux-header-amd64 is already on the newest version (5.10.70-1) and when I type: apt install nvidia-driver linux-image-amd64, it says ” nvidia-driver is already running the newest version (460.91.03-1). But for some reason it’s still not communicating, can you please help. Also how would I change the resolution if I do not have gnome installed? My monitor is a 3440×1440. Thanks.

Guest
Tuesday, November 23, 2021 1:35 pm

Hi i fighting with this case all night it never works with deb-src and with manual installation.

Please add to you subject extra information. UEFI Boot manager from WINDOWS with install double system, blocking accesss kernel linux to nvidia graphic cards. Needs turnoff UEFI. before i did, i getting message from apt-get install nvidia-driver — Missing files /usr/……  it was anoying and missunderstand with problem of nouveau

Michael Tocol
Guest
Thursday, November 25, 2021 7:36 am

excellent guide for newbie. thank you.

Alex
Guest
Monday, November 29, 2021 2:57 am

Very good guide. But before installation I was obliged to uninstall previous drivers:
sudo apt –purge remove nvidia.*

adplus-dvertising
19
0
Would love your thoughts, please comment.x
()
x