Installing Nvidia Graphics Drivers on Debian 12

If you are using Debian 12 and have an Nvidia graphics card, installing the correct drivers is essential for getting the best performance out of your system.

Nvidia drivers allow your computer to use the full power of your graphics card, which is important for tasks like gaming, video editing, and 3D rendering.

In this guide, we will walk you through the steps to install Nvidia graphics drivers on Debian 12.

Step 1: Update Your System

Before installing any new software, it’s a good idea to make sure your system is up to date.

sudo apt update
sudo apt upgrade

This will update the list of available packages and upgrade any outdated software on your system.

Update Debian System
Update Debian System

Step 2: Identify Your Nvidia Graphics Card

To install the correct driver, you need to know which Nvidia graphics card you have, you can find this information by running the following command in the terminal:

lspci | grep -i nvidia

This command will list all the hardware connected to your system and filter out only the Nvidia-related entries. Look for the line that describes your graphics card, which will look something like this:

01:00.0 VGA compatible controller: NVIDIA Corporation GP106 [GeForce GTX 1060 6GB] (rev a1)

In this example, the graphics card is a “GeForce GTX 1060 6GB“.

Step 3: Add the Non-Free Repository

Debian’s default repositories do not include proprietary software like Nvidia, you need to enable the non-free repository to install the Nvidia drivers.

Open the sources list file in a text editor:

sudo nano /etc/apt/sources.list

Look for lines that start with deb and end with main. Add non-free at the end of these lines.

For example:

deb http://deb.debian.org/debian bookworm main non-free
deb-src http://deb.debian.org/debian bookworm main non-free

Save the file and update the package list again:

sudo apt update

Step 4: Install the Nvidia Driver in Debian

Now that the non-free repository is enabled, you can install the Nvidia driver. The easiest way to do this is to use the nvidia-detect tool, which will recommend the best driver for your graphics card.

sudo apt install nvidia-detect
nvidia-detect

The output will look something like this:

Detected NVIDIA GPUs:
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP106 [GeForce GTX 1060 6GB] [10de:1c03] (rev a1)

It is recommended to install the
nvidia-driver
package.

In this example, the recommended package is nvidia-driver, so install it:

sudo apt install nvidia-driver

If nvidia-detect recommends a different package, replace nvidia-driver with the recommended package name. During the installation, you may be asked to confirm that you want to install the driver. Press Y and Enter to continue.

After the installation is complete, you need to reboot your system to load the new drivers:

sudo reboot

Once your system has restarted, you can verify that the Nvidia drivers are installed and working correctly.

nvidia-smi

This command will display information about your Nvidia graphics card, including the driver version and GPU usage. If you see this information, the drivers are installed correctly.

Troubleshooting

If you encounter any issues after installing the drivers, here are a few things you can try:

  • Black Screen After Reboot: If your screen goes black after rebooting, you may need to switch to a different terminal (e.g., CTRL + ALT + F2) and reinstall the drivers. You can also try using the nomodeset kernel parameter during boot.
  • Driver Not Loading: If the driver is not loading, make sure that the nvidia-kernel-dkms package is installed, which ensures that the Nvidia kernel module is built correctly for your system.
  • Incorrect Driver: If you installed the wrong driver, you can remove it using sudo apt remove nvidia-* and then install the correct driver.
Conclusion

Installing Nvidia graphics drivers on Debian 12 is a straightforward process once you know the steps. By following this guide, you should be able to get your Nvidia graphics card up and running with the correct drivers.

This will allow you to take full advantage of your hardware, whether you’re gaming, editing videos, or working with 3D graphics. If you run into any problems, the Debian community and Nvidia’s support resources are great places to seek help.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

2 Comments

Leave a Reply
  1. Ravi,

    I followed your recent blog about installing Nvidia drivers on Debian 12. However, I am encountering an error, possibly due to a different GPU than yours.

    System Info:
    OS: Linux vultr 6.1.0-30-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.124-1 (2025-01-12) x86_64
    GPU: NVIDIA Corporation GA102GL [A40] (rev a1)

    All commands execute correctly except nvidia-smi, which returns:

    NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. 
    Make sure that the latest NVIDIA driver is installed and running.
    

    Findings:
    It seems the installed NVIDIA driver is unsupported.
    The 535.216.01 driver doesn’t support Debian 12. (NVIDIA Docs)
    The latest available Debian package (nvidia-kernel-dkms) is outdated.
    550.54.14 does support Debian 12, but only a .run file is available

    Additional Issue with .run File:

    ERROR: Unable to load the kernel module 'nvidia.ko'. This happens most 
    frequently when this kernel module was built against the wrong or 
    improperly configured kernel sources, with a version of gcc that 
    differs from the one used to build the target kernel, or if another 
    driver, such as nouveau, is present and prevents the NVIDIA kernel 
    module from obtaining ownership of the NVIDIA device(s), or no NVIDIA 
    device installed in this system is supported by this NVIDIA Linux 
    graphics driver release.
    

    Would appreciate any suggestions on resolving this. Thanks!

    Reply
    • @Deepak,

      Thanks for following my guide! Based on your system and error message, it looks like the issue is related to driver compatibility and potential kernel module conflicts.

      Here are some steps to troubleshoot:

      1. Run the following to check if the installed driver matches your GPU:

      nvidia-smi
      modinfo nvidia | grep version
      

      If it doesn’t match 550.54.14, you’ll need to install the correct version.

      2. Before installing a new driver, clean up old installations.

      sudo apt remove --purge '^nvidia-.*'
      sudo apt autoremove
      sudo reboot
      

      Since the .run installer is failing, Nouveau might be interfering, check if it’s loaded:

      lsmod | grep nouveau
      

      If Nouveau is active, disable it:

      echo "blacklist nouveau" | sudo tee /etc/modprobe.d/blacklist-nvidia-nouveau.conf
      echo "options nouveau modeset=0" | sudo tee -a /etc/modprobe.d/blacklist-nvidia-nouveau.conf
      sudo update-initramfs -u
      sudo reboot
      

      4. Since the official Debian package doesn’t support 550.54.14, you’ll need to use the .run file:

      wget https://us.download.nvidia.com/XFree86/Linux-x86_64/550.54.14/NVIDIA-Linux-x86_64-550.54.14.run
      chmod +x NVIDIA-Linux-x86_64-550.54.14.run
      sudo ./NVIDIA-Linux-x86_64-550.54.14.run
      

      5. Rebuild Kernel modules & reboot.

      sudo dkms autoinstall
      sudo modprobe nvidia
      sudo reboot
      

      6. After reboot, check if nvidia-smi works.

      nvidia-smi
      

      If you still face issues, let me know what error you get! Hope this helps.

      Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.