How to install Nvidia driver on Debian 12 Bookworm Linux

In this article, you will learn how to install the Nvidia driver on Debian 12 “Bookworm” from the standard Debian repository. If, for some reason, the installation of the Nvidia driver from the standard Debian repository fails, or if you wish to have a more up-to-date Nvidia driver, this tutorial will also guide you on how to install the official Nvidia driver directly from the Nvidia.com website.

To install Nvidia driver on other Linux distributions, follow our Nvidia Linux Driver guide.

In this tutorial you will learn:

  • How to detect your nvidia card model number
  • How to install Nvidia driver from a standard Debian repository
  • How to install Nvidia driver from the official Nvidia package
  • How to disable nouveau driver
  • How to install Nvidia driver prerequisites

Nvidia driver on Debian 12 Bookworm

Nvidia driver on Debian 12 Bookworm

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Debian 12 Bookworm GNU/Linux
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to install NVIDIA driver using Debian repository step by step instructions

  1. Enable the non-free and contrib repository.As an administrative user open the /etc/apt/sources.list and add the non-free repository. For example change the repository definition:
    FROM:
    deb http://ftp.au.debian.org/debian/ buster main
    TO:
    deb-src http://ftp.au.debian.org/debian/ buster main non-free contrib
    

    Once ready update the repository index files using the below command:

    # apt update
    
  2. Install nvidia-detect utility by execution of the below command:
    # apt -y install nvidia-detect
    
  3. Detect your Nvidia card model and suggested Nvidia driver. To do so execute the above installed nvidia-detect command. For example:
    $ nvidia-detect 
    Detected NVIDIA GPUs:
    01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA102 [GeForce RTX 3080] [10de:2206] (rev a1)
    
    Checking card:  NVIDIA Corporation GA102 [GeForce RTX 3080] (rev a1)
    Your card is supported by all driver versions.
    Your card is also supported by the Tesla drivers series.
    Your card is also supported by the Tesla 470 drivers series.
    It is recommended to install the
        nvidia-driver
    package.
    
    



  4. As suggested install the recommended driver by the previous step:
    # apt install nvidia-driver
    
  5. All done. Reboot your Debian 12 Bookworm Linux box:
    # systemctl reboot
    

How to install NVIDIA driver by using the official nvidia.com package step by step instructions

  1. Download the recommended Nvidia source package from the official Nvidia.com website. Search for a package name to match the driver number as recommended by the previous step.

    Save the downloaded file into your home directory eg.:

    $ ls NVIDIA-Linux-x86_64-535.104.05.run
    NVIDIA-Linux-x86_64-535.104.05.run
    
  2. Install Nvidia driver compilation prerequisites:
    # apt -y install linux-headers-$(uname -r) build-essential libglvnd-dev pkg-config
    
  3. Next, disable the default nouveau driver:
    # echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf
    # update-initramfs -u
    
  4. Reboot to multi-user runlevel. This will disable the GUI user after reboot:
    # systemctl set-default multi-user.target
    # systemctl reboot
    


  5. Login as root user via terminal or TTY and install the Nvidia driver by executing the bellow command:
    NOTE
    Depending on the driver version you have downloaded the bellow command may be different. Amend the below command to fit the driver file name downloaded previously.
    # bash NVIDIA-Linux-x86_64-535.104.05.run

    During the installation you may be asked the following set of questions:

    The CC version check failed:
    
    The kernel was built with gcc version 8.2.0 (Debian 8.2.0-14), but the current compiler version is cc (Debian 8.3.0-2) 8.3.0.
    
    This may lead to subtle problems; if you are not certain whether the mismatched compiler will be compatible with your kernel, you may wish to abort installation, set the CC environment variable to the name of the compiler used to compile your kernel, and restart installation.
    
                                                         Ignore CC version check                                         Abort installation     
    
    
    Install NVIDIA's 32-bit compatibility libraries?
      
                                                                   Yes                                                           No   
      
    
    
    An incomplete installation of libglvnd was found. Do you want to install a full copy of libglvnd? This will overwrite any existing libglvnd libraries.
    
                                      Don't install libglvnd files         Install and overwrite existing filesort installation.  Abort installation.
    
    
     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   
    
  6. Enable the system to boot into GUI:
    # systemctl set-default graphical.target
    
  7. All done. Reboot your Debian 12 Bookworm Linux box:
    # systemctl reboot
    
    
    

Conclusion

In this article, we walked through the comprehensive steps to successfully install the Nvidia graphics driver on Debian 12 “Bookworm.” Whether you chose to go with the standard Debian repository or opted for the manual route using the official driver from the Nvidia website, you should now have a functioning Nvidia graphics driver on your system. By ensuring that your graphics driver is up-to-date, you’re enhancing both the performance and stability of your Debian system. Always remember to periodically check for driver updates to maintain an optimal computing experience.



Comments and Discussions
Linux Forum