Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Install NVIDIA Drivers on Debian Linux

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Installing NVIDIA drivers on Debian gives you hardware-accelerated graphics for gaming, 3D rendering, CUDA compute, and smoother desktop compositing. This guide covers the two reliable methods: using the official Debian repository (easiest and most stable) and using NVIDIA's own .run installer (for the latest driver or special needs). Before starting, make sure you have a working internet connection, sudo privileges, and know your GPU model (run lspci | grep -i nvidia to check).

What You'll Need

  • A Debian system (10, 11, or 12) with an NVIDIA GPU
  • Internet access (to download packages or the driver)
  • Root or sudo access
  • Basic comfort with the terminal

Step-by-Step

Method 1: Install from Debian's Official Repository (Recommended)

  1. Update your package list: Open a terminal and run sudo apt update to refresh the package index.
  2. Install the recommended driver: Run sudo apt install nvidia-driver. This installs the latest stable NVIDIA driver packaged for your Debian version. On Debian 12, this is usually the 525 or 535 series.
  3. Install kernel headers (if prompted): During installation, you may be asked to install the matching kernel headers. Accept that; they are needed to build the kernel module. If not prompted, run sudo apt install linux-headers-$(uname -r) manually.
  4. Reboot your system: After installation completes, reboot with sudo reboot. The driver loads at boot.
  5. Verify the installation: After reboot, run nvidia-smi in the terminal. You should see your GPU model and driver version. Also check with glxinfo | grep "OpenGL renderer" (install mesa-utils if needed) to confirm OpenGL is using NVIDIA.

Method 2: Install from NVIDIA's Official .run Installer (Advanced)

  1. Download the driver: Go to NVIDIA's driver download page, select your GPU model and Linux 64-bit, and download the .run file (e.g., NVIDIA-Linux-x86_64-545.29.06.run). Save it to your home directory.
  2. Install build tools and headers: Run sudo apt install build-essential linux-headers-$(uname -r) to ensure the compiler and kernel headers are present.
  3. Stop the graphical interface: The installer requires that no X server is running. You must exit to a text console. Press Ctrl+Alt+F3 to switch to a TTY, log in, then run sudo systemctl stop lightdm (or gdm3 or sddm, depending on your display manager). If you use a display manager, stop it; otherwise, run sudo init 3 to drop to runlevel 3.
  4. Make the installer executable: In the TTY, navigate to the directory containing the .run file (e.g., cd ~/Downloads) and run chmod +x NVIDIA-Linux-*.run.
  5. Run the installer: Execute sudo ./NVIDIA-Linux-*.run. Follow the prompts. It will compile the kernel module and install the driver. If it asks about installing 32-bit compatibility libraries, choose yes if you need 32-bit OpenGL.
  6. Reboot: After installation, reboot with sudo reboot. The NVIDIA driver should load.
  7. Verify: Run nvidia-smi to confirm.

Common Mistakes

  • Installing the wrong driver version: Using a driver too new for your kernel or too old for your GPU can cause failures. The Debian repo driver is generally safe; if using NVIDIA's installer, pick the version that matches your GPU's support.
  • Not installing kernel headers: The NVIDIA kernel module needs headers to compile. Without them, the install fails or the module won't load.
  • Forgetting to stop the X server before the .run installer: The NVIDIA installer refuses to run if X is active. Always switch to a TTY and stop your display manager.
  • Using the wrong driver for the GPU: For example, using a legacy driver on a newer card or vice versa. Check NVIDIA's support page for your GPU's recommended driver.
  • Not removing open-source nouveau driver first: The .run installer usually handles this, but if you install from the repo, the package manager will remove nouveau automatically. If you manually blacklist nouveau incorrectly, you may end up with no graphics.

Tips

  • For most users, the Debian repository driver is the best choice: it's tested, integrates with system updates, and is easy to remove.
  • If you need CUDA for machine learning or compute, install nvidia-cuda-toolkit from the repo after the driver is working.
  • To switch between the NVIDIA driver and the open-source nouveau driver, you can use sudo apt install nvidia-driver and then sudo apt purge nvidia-driver to revert.
  • Keep your system updated: sudo apt update && sudo apt upgrade will update the driver along with other packages.
  • If you have a laptop with Optimus (hybrid graphics), consider installing nvidia-prime or nvidia-optimus to manage GPU switching.

Troubleshooting

  • Black screen after reboot: This often happens if the driver didn't load or nouveau is still active. Boot into recovery mode (hold Shift during boot), then run sudo apt purge nvidia-driver and try reinstalling. Alternatively, check logs with dmesg | grep nvidia and journalctl -b -1.
  • nvidia-smi not found: The driver isn't installed or the module isn't loaded. Run sudo modprobe nvidia to load it manually. If that fails, reinstall the driver.
  • Compilation errors during .run install: Ensure you have the exact kernel headers for your running kernel: sudo apt install linux-headers-$(uname -r). Also make sure gcc and make are installed.
  • X server fails to start: Check /var/log/Xorg.0.log. If it mentions "NVIDIA" errors, your driver may be incompatible with your X version. Try the Debian repo driver instead.
  • Screen tearing: Enable "Force Full Composition Pipeline" in the NVIDIA X Server Settings (nvidia-settings) under X Server Display Configuration.
  • Driver not loading after kernel update: The kernel module is rebuilt automatically via DKMS if you installed from the repo. If you used the .run installer, you may need to re-run it after a kernel update.

Frequently Asked Questions

Q: How do I check my NVIDIA GPU model?

Run lspci | grep -i nvidia in the terminal. It will show the GPU name and model number.

Q: Which driver should I use, the Debian repo or NVIDIA's .run?

For stability and ease, use the Debian repo driver. Use NVIDIA's .run only if you need a specific newer version or features not in the repo.

Q: Can I install both the open-source nouveau and NVIDIA drivers?

No, they conflict. Installing the NVIDIA driver will remove or blacklist nouveau. You must choose one.

Q: How do I remove the NVIDIA driver?

If installed from the repo, run sudo apt purge nvidia-driver. If installed via .run, run sudo nvidia-uninstall (the installer includes this). Then reboot.

Q: Why does my system use the Intel GPU instead of NVIDIA?

On hybrid laptops, you may need to use nvidia-settings or prime-select to switch to the NVIDIA GPU. Also ensure the NVIDIA module is loaded.

Q: Do I need to disable Secure Boot?

If Secure Boot is enabled, the NVIDIA kernel module may not load unless it is signed. You can either disable Secure Boot in BIOS or sign the module. The Debian repo driver includes a signed module if you use the Debian kernel.