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.
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.
Are you pulling my chain because i follow your direction and it still not working correctly nvidia-drivers are broken. I’m going to attempt second try but this time not upgrading from 11.7. Like you said from the video going full dvd verison of debain 12. Works fine in debian 11.7 on open source drivers if you dont have a second screen to install the mesa open source driver and able to play games but not as powerful of my 1660ti but manager to get both screens going.
specs Omen 15
AMD Ryzen™ 7 4800H included amd inter-graded gpu
32g ram ddr4
1660ti mobile
two sticks 1TB dual booted OS
Works great with windows factory settings prefer arch or debian
Simply perfect. Thank you very much.
Thank you so much!
Thanks for this amazing, easy to follow guide, I use Debian 12.2.0 with KDE Plasma.
Every time I change to sudo envycontrol -s nvidia –force-comp or just sudo envycontrol -s nvidia, I reboot and type envycontrol –query it always says Hybrid. Is that fine? I mean I really hope it will switch to nvidia while gaming and such.
Thank you, work perfectly
thank you very much! Your solution is clear, simple and functional (save my night!!)
On my laptop it fails:
Building for 6.1.0-18-amd64
Building initial module for 6.1.0-18-amd64
Error! Bad return status for module build on kernel: 6.1.0-18-amd64 (x86_64)
Consult /var/lib/dkms/nvidia-current/525.147.05/build/make.log for more informat
ion.
dpkg: error processing package nvidia-kernel-dkms (–configure):
installed nvidia-kernel-dkms package post-installation script subprocess return
ed error exit status 10
And when I “consult” the log, it says:
ERROR: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol ‘__rcu_read_lock’