How to Install NVIDIA Drivers on Debian/Linux 

install nvidia drivers on debian

If you’re a Debian user with an NVIDIA graphics card, you may want to install the latest NVIDIA drivers for optimal performance and compatibility with your hardware.

 Installing NVIDIA drivers is perhaps the easiest way of getting better performance in graphics-intensive tasks with features like CUDA and OptiX. In addition, updating the drivers enhances maximum system stability. 

Fortunately, the process of installing NVIDIA drivers on Debian can be straightforward, especially when you follow the right process. 

In this tutorial, we will present two simple ways you can try to install NVIDIA drivers on Debian.

How to Install NVIDIA Drivers

You can install NVIDIA drivers on Debian/Linux through the following two main methods: 

  • Via the Debian Repository
  • Via the Official Nvidia.com Package

The Prerequisites

Before diving into the installation process, ensure you have the following:

  • A Debian-based system
  • Root user access
  • An active internet connection to download the necessary packages 

Method #1: Install Drivers Via Debian Repository

To install NVIDIA drivers using Debian repositories, follow these steps.

Step #1: Enable Non-free Repositories

By default, Debian does not allow proprietary software in its repositories. So, you’ll need to enable the non-free repositories to access and install NVIDIA drivers.

Make sure you are logged in as a root user and open the /etc/apt/sources.list file in your preferred text editor.

You need to make sure each repository line includes non-free components. If that’s not the case, add non-free in each line.

Enable Non-free Repositories

Save the changes and close the file.

Step #2: Install NVIDIA Detect

Before installing NVIDIA drivers, it’s better to install the nvidia-detect package. This utility identifies the appropriate drivers for your NVIDIA GPU.

First, update the local package list by running the following command:

# sudo apt update

Install the NVIDIA Detect utility:

# sudo apt install nvidia-detect

Step #3: Detect and Install Drivers

Run the nvidia-detect command to detect your NVIDIA GPU and recommended driver packages.

# sudo nvidia-detect

Next, install the suggested packages using apt.

# sudo apt install <recommended-driver-package>

For instance,

To install the nvidia-driver package, run:

# sudo apt install nvidia-driver

sudo apt install nvidia-driver

sudo apt install nvidia-driver 2

Once the driver is installed, remember to reboot the system so that the changes take effect.

Method #2: Install Drivers Via Official nvidia.com Package

Alternatively, you can install NVIDIA drivers from the official nvidia.com package by following these steps. Note that you need to log in as the root user before you go through these steps:

Step #1: Enable Non-Free Repositories 

Open the /etc/apt/sources.list file in your preferred text editor.

Ensure each repository line includes a non-free component.

Save the changes and close the file.

Step #2: Install NVIDIA Detect

Before installing NVIDIA drivers, we recommend installing the nvidia-detect package. This utility identifies the appropriate drivers for your NVIDIA GPU.

First, update the package list on your machine with this command:

# sudo apt update

Next, install the NVIDIA Detect utility:

# sudo apt install nvidia-detect

Step #3: Detect the NVIDIA Card

Run nvidia-detect to identify your NVIDIA GPU:

# sudo nvidia-detect

This command will present the driver that you need to install for your GPU.

sudo nvidia-detect

Step #4: Download Suggested Drivers

Visit the NVIDIA website. 

Download the suggested driver version for your GPU. Here, we are specifically searching for the driver series, version 390.

unix driver archive

Click the series number and download the driver to your home directory.

Step #5: Install Driver Prerequisites

Before installing the NVIDIA drivers, ensure you have the necessary prerequisites installed on the system. For this, run the following command:

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

Step #6: Disable the Default Drivers

Disable any default or Nouveau GPU drivers that may conflict with the NVIDIA drivers.

Begin by creating and opening a new configuration file using any text editor:

Here, we create a file named blacklist nouveau using Nano:

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

Insert the following lines into the file:

blacklist nouveau
options nouveau modeset=0

Save s and exit the editor. 

Next, rebuild the kernel initramfs with this command:

# update-initramfs -u

update-initramfs -u

This command generates a new initial RAM file system (initramfs) based on the current kernel’s modules and configuration.

Step #7: Reboot to Multi-User Login

With the default GPU drivers disabled, transitioning to a text-based login facilitates the installation of NVIDIA drivers because the system does not have to access the GPU to display the GUI. 

Run this command to enable the text-based, multi-user login prompt:

# systemctl set-default multi-user.target

systemctl set-default multi-user.target

Reboot your system and ensure it boots to multi-user mode. 

# systemctl reboot

Step #8: Install NVIDIA Drivers

Install the NVIDIA drivers from the package you downloaded earlier. Run the following command syntax to initiate the process:

# bash [driver file name]

For instance, in our demonstration, we will install version 390 with this command:

# bash NVIDIA-Linux-x86_64-390.144.run

During the installation process, if prompted, choose:

  • Ignore the CC version if it fails.
  • Choose Yes to install NVIDIA’s 32-bit compatibility libraries.
  • Opt Install and overwrite existing filesort installation to install a full copy of libglvnd to overwrite any existing libraries.
  • Select Yes to run the nvidia-xconfig utility to automatically update your X configuration file, ensuring that the NVIDIA X driver is utilized upon X restart.

Step #9: Re-enable the GUI

After installation, you need to restart your system to enable the GUI and activate the NVIDIA drivers.

Run this command to revert to the GUI login to utilize graphical interfaces such as GNOME and initiate the newly installed NVIDIA drivers:

# systemctl set-default graphical.target

Conclusion

Installing NVIDIA drivers on Debian can significantly improve the performance and compatibility of your NVIDIA GPU. Whether you choose to install drivers via the Debian repository or directly from NVIDIA‘s website, following the steps outlined in this guide will help you successfully install it.

We covered the two processes that cover the installation of these drivers from the official NVIDIA website and the Debian repositories. You can apply one of these processes to upgrade system GPU drivers and benefit from improved performance boost and system stability.

FAQs

Q. Can I install NVIDIA drivers on Debian without administrative privileges?

No, administrative privileges are required to install NVIDIA drivers and make system changes.

Q. Will installing NVIDIA drivers void my warranty?

Installing NVIDIA drivers would not void your warranty, but it’s always best to consult the manufacturer’s terms and conditions for clarification.

Q. What should I do if I encounter errors during the installation process?

If you encounter an error, refer to Debian’s documentation, NVIDIA’s support resources or seek assistance from online communities and forums for troubleshooting help.

Q. Can I revert to the default drivers if I encounter issues with NVIDIA drivers?

Yes, you can revert to the default drivers or Nouveau drivers if you experience issues with NVIDIA drivers. Simply uninstall the NVIDIA drivers and reinstall the default ones.

Q. Are NVIDIA drivers necessary for basic system functionality?

While NVIDIA drivers are not essential for basic system functionality, they are required for optimal performance and compatibility with NVIDIA GPUs.

 

Rachelle

Rachelle Joseph is a senior server administrator at RedSwitches, specializing in provisioning and managing highly optimized streaming servers. She has extensive experience in system administration involving technical design, planning, implementation, performance tuning, and recovery procedures for mission-critical enterprise solutions. Travel and music keep her busy during leisure; nothing can inspire her more. Reach her at [email protected]

Related articles

Latest articles