How to Install NVIDIA Drivers on Linux Debian: A Complete Guide
Installing NVIDIA drivers on Linux Debian can be challenging, especially for new users unfamiliar with Linux’s package management system. Unlike Windows, where drivers are installed automatically, Debian requires manual installation and configuration to ensure your NVIDIA GPU runs smoothly.
In this guide, we’ll cover step-by-step instructions to install, configure, and troubleshoot NVIDIA drivers on Debian Linux.
Check Your NVIDIA GPU Model
Before installing the drivers, you need to determine which NVIDIA graphics card you have.
Command to Check GPU Model
Open a terminal (Ctrl + Alt + T
) and run:
lspci | grep -i nvidia
This command will output details about your NVIDIA graphics card.
If you don’t see NVIDIA in the output, use:
sudo lshw -C display
or
nvidia-smi # If you already have NVIDIA drivers installed.
Update Your System
Ensure your Debian system is fully updated before proceeding.
sudo apt update && sudo apt upgrade -y
A fully updated system ensures compatibility with the latest NVIDIA drivers.
Enable Non-Free Repositories
Debian, by default, does not include proprietary drivers in its repositories. You must enable the non-free and contrib repositories.
Step 1: Open the Sources List
sudo nano /etc/apt/sources.list
Step 2: Add the Following Lines (If Not Already Present)
deb http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
deb-src http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
deb http://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware
Replace bookworm
with your Debian version (buster
, bullseye
, etc.).
Step 3: Save and Exit
Press CTRL + X
, then Y
, and press Enter
.
Step 4: Update the Package List
sudo apt update
Install NVIDIA Drivers Using apt (Recommended)
Debian provides official NVIDIA drivers through the package manager. This is the easiest way to install and update drivers.
Step 1: Install the NVIDIA Driver Package
Run the following command:
sudo apt install nvidia-driver firmware-misc-nonfree -y
This will install: ✔ NVIDIA kernel modules
✔ Graphics driver
✔ Required firmware files
Step 2: Reboot Your System
sudo reboot
Step 3: Verify the Installation
Once rebooted, check if the driver is correctly installed:
nvidia-smi
If NVIDIA drivers are installed correctly, this command will display GPU details.
Alternative: Install NVIDIA Drivers Manually from NVIDIA’s Website
If the Debian repository does not have the latest driver for your GPU, you can install it manually.
Step 1: Download the Latest Driver
- Visit NVIDIA's Official Driver Page.
- Select your GPU model.
- Download the
.run
file.
Step 2: Switch to TTY Mode
Before installing, disable the graphical interface.
sudo systemctl set-default multi-user.target
sudo systemctl reboot
Step 3: Install Build Essentials
You need compiler tools to install the driver.
sudo apt install build-essential dkms linux-headers-$(uname -r) -y
Step 4: Run the Installer
Navigate to the directory where the file is downloaded:
cd ~/Downloads
chmod +x NVIDIA-Linux-*.run
sudo ./NVIDIA-Linux-*.run
Follow the on-screen instructions.
Step 5: Restart the System
sudo reboot
Check the installation with:
nvidia-smi
Set Up NVIDIA Drivers for Prime or Optimus Laptops (Hybrid GPU)
If you’re using a laptop with an NVIDIA GPU and Intel integrated graphics, you need NVIDIA Prime for switching GPUs.
Step 1: Install Required Packages
sudo apt install nvidia-prime -y
Step 2: Check GPU Modes
- To switch to NVIDIA GPU:
sudo prime-select nvidia
- To switch to Intel GPU (Power Saving Mode):
sudo prime-select intel
Restart your system after switching GPUs.
Troubleshooting NVIDIA Driver Issues
If you run into problems after installation, here are some common fixes:
A. Check If NVIDIA Drivers Are Loaded
lsmod | grep nvidia
If the output is empty, your drivers aren’t loaded.
B. Reinstall NVIDIA Drivers
sudo apt remove --purge '^nvidia-.*'
sudo apt install nvidia-driver firmware-misc-nonfree -y
sudo reboot
C. Black Screen After Installation
If you get a black screen after reboot:
- Boot into recovery mode.
- Open a terminal and run:
sudo nano /etc/default/grub
- Find the line:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"
- Save the file (
CTRL + X
, thenY
andEnter
). - Update GRUB:
sudo update-grub sudo reboot
D. NVIDIA X Server Settings Not Opening
If nvidia-settings
doesn’t open:
sudo apt install --reinstall nvidia-settings
Summary
Step | Command / Action |
---|---|
Check GPU Model | `lspci |
Update Debian | sudo apt update && sudo apt upgrade -y |
Enable Non-Free Repo | Add to /etc/apt/sources.list , then sudo apt update
|
Install NVIDIA Driver | sudo apt install nvidia-driver firmware-misc-nonfree -y |
Verify Installation | nvidia-smi |
Manually Install from NVIDIA | sudo ./NVIDIA-Linux-*.run |
For Hybrid Laptops (Prime) | sudo apt install nvidia-prime -y |
Switch GPUs (Hybrid Systems) |
sudo prime-select nvidia or sudo prime-select intel
|
Conclusion
Installing NVIDIA drivers on Debian Linux requires enabling non-free repositories, using the Debian package manager, or manually installing from NVIDIA’s website. By following the steps in this guide, you can ensure your NVIDIA GPU runs optimally for gaming, development, and AI workloads.
With this setup, your Debian system will fully utilize the power of your NVIDIA GPU, delivering smooth performance and stability.