Skip to content

Installing NVIDIA Drivers on Debian 12

This guide walks through the recommended procedure for installing proprietary NVIDIA drivers on Debian 12 (Bookworm).

Prerequisites

  • Debian 12 (Bookworm) installed
  • Administrative (sudo) access
  • NVIDIA graphics card

Installation Steps

1. Enable Required Repositories

NVIDIA drivers are proprietary and require the contrib, non-free, and non-free-firmware repositories.

Edit your APT sources file:

sudo nano /etc/apt/sources.list

Ensure your repository lines include contrib non-free non-free-firmware. Your configuration should look similar to this:

/etc/apt/sources.list
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

Mirror Variations

URLs may differ based on your configured mirror. The important part is adding contrib non-free non-free-firmware to each line.

2. Update Package Lists

Refresh your package list to include packages from the newly enabled repositories:

sudo apt update

3. Install Kernel Headers

The NVIDIA driver builds a kernel module specific to your running kernel and requires the corresponding headers:

sudo apt install linux-headers-$(uname -r)

4. Install NVIDIA Driver and Firmware

Install the main driver package and related firmware:

sudo apt install nvidia-driver firmware-misc-nonfree

Debian's packaging system will automatically select the appropriate driver version for your hardware.

5. Reboot

A reboot is required to load the new NVIDIA kernel module and ensure the nouveau driver is fully unloaded:

sudo reboot

6. Verify Installation

After rebooting, verify the NVIDIA driver is loaded:

lsmod | grep nvidia

You should see output listing several nvidia kernel modules.

For detailed driver information, use:

nvidia-smi

This displays GPU information, driver version, and CUDA version.

Troubleshooting

Black Screen After Reboot

If you encounter a black screen after rebooting, you may need to boot into recovery mode and remove the NVIDIA drivers:

sudo apt remove --purge nvidia-*
sudo reboot

Multiple GPU Setup

For systems with both integrated and NVIDIA graphics, you may want to configure GPU switching. See the Debian NVIDIA Optimus documentation for details.