How to Install NVIDIA Driver in Debian 12 Stable [Step by Step]

This is a step by step beginner’s guide shows how to install the NVIDIA graphics driver in Debian 12 stable ‘Bookworm’!

Step 1: Enable non-free Repository

Debian includes NVIDIA driver packages in its official repository. However, it’s available in the non-free repository that’s NOT enabled by default.

1. Firstly, search for and launch ‘Synaptic Package Manager‘. Then, use the tool to search & install the software-properties-gtk package (or software-properties-qt for KDE, LXQt).

  • First, click search icon and search software-properties-gtk package.
  • Then, right-click on the package in result and select ‘Mark for Installation
  • Finally, click ‘Apply‘ button to start installing the package.
Install ‘Software Properties’ via Synaptic package manager

Or, open terminal and install the tool by running command in terminal:

sudo apt install software-properties-gtk

2. Launch ‘Software & Updates‘ either from start/applications menu or ‘Activities’ overview depends on your desktop environment.

Or run sudo software-properties-gtk (or sudo software-properties-qt) in terminal to start it from command line.

3. Once it opens, make sure the first 4 repositories (main, contrib, non-free-firmware, non-free) are enabled!

Here, the ‘Non-DFSG-compatible Software (non-free)’ repository provides the NVIDIA driver package, but other 3 are required for dependencies.

Step 2: Install NVIDIA Driver packages

After enabled non-free repository, open terminal and run 2 commands one by one:

sudo apt update && sudo apt install nvidia-detect
nvidia-detect

The commands will first install the nvidia-detect package, and then run the command to identify your GPU and output recommended driver package to install.

The recommended driver package is usually ‘nvidia-driver‘.

To install the driver package, either run command:

sudo apt install nvidia-driver

Or, use Synaptic Package Manager to search that package, right-click on it and select ‘Mark for Installation’ and finally click ‘Apply’.

Click 'Reload' to refresh package cache if it don't show you nvidia-driver package.

When done installing nvidia-driver package, restart your computer.

Step 3: Switch Between Intel/AMD and NVIDIA GPUs.

Unlike Ubuntu, Debian don’t have nvidia-prime package for switching between integrated and NVIDIA GPUs in laptop/notebook. There’s however a free open-source tool ‘envycontrol‘ to make the thing easy.

1. Firstly, download the software package from its releases page (its ‘python3-envycontrol_xxx_all.deb‘):

2. Once you downloaded the package, open terminal and run command to install it (assume you saved it in ‘Downloads’ folder):

sudo apt install ~/Downloads/python3-envycontrol*.deb

3. When done installing envycontrol, you can run one of the commands to tell which GPU to use:

  • Switch to integrated GPU (Intel or AMD):
    sudo envycontrol -s integrated
  • Set hybrid mode and enable fine-grained power control:
    sudo envycontrol -s hybrid --rtd3
  • Switch to NVIDIA and enable ForceCompositionPipeline in case of screen tearing:
    sudo envycontrol -s nvidia --force-comp

When done switching GPU, remember to restart computer to apply change.

4. For GNOME desktop, user may also install the ‘GPU profile selector’ extension, by using ON/OFF switch in the link below page:

If you don’t see the ON/OFF switch, install browser extension via link in that page, then refresh the page.

When done, you should be able to switch GPU via the top-right corner system menu (aka Quick Settings).

Step 4: Verify

To verify which graphics card in active, either run command:

glxinfo |grep -E "OpenGL vendor|OpenGL renderer"

Or use:

envycontrol --query

For GNOME, the ‘about’ page in Settings can also tell you which GPU in use.

Exit mobile version