Interactive, APT-first installer for NVIDIA drivers and the optional CUDA Toolkit on Debian 12 (Bookworm) and Debian 13 (Trixie).
The recommended paths use Debian's own packages. The script does not add NVIDIA repositories, force an Xorg configuration, kill package-manager processes, or delete APT lock files.
- Debian 12 or 13
amd64orarm64- An NVIDIA PCI display device
- Root access
- APT sources with
main contrib non-free non-free-firmware
The advanced NVIDIA .run installer is available only on amd64 and is intentionally not recommended for normal Debian installations.
- Installs
nvidia-driverfrom Debian stable or an already configured backports suite - Installs the Debian
nvidia-cuda-toolkitpackage on request - Installs both the architecture header metapackage and exact running-kernel headers when available
- Understands classic
.listfiles and modern deb822.sourcesfiles - Detects Secure Boot when
mokutilis available and explains MOK enrollment - Can switch back to nouveau or remove installed
nvidia-*packages through APT - Fetches current
.runinstaller metadata from NVIDIA instead of using a stale hardcoded version - Logs output to
/var/log/nvidia-optimizer.log
git clone https://github.com/dennishilk/nvidia-driver.git
cd nvidia-driver
chmod +x install-nvidia-cuda.sh
sudo ./install-nvidia-cuda.shChoose one of the five menu actions:
- Install the Debian stable driver (recommended)
- Install the driver from an already enabled Debian backports suite
- Remove NVIDIA packages and enable nouveau
- Remove NVIDIA packages and clean unused dependencies
- Install NVIDIA's
.rundriver (advanced,amd64only)
After a driver change, reboot and verify:
nvidia-smi
nvcc --version # only when the CUDA Toolkit was installedThe script accepts both /etc/apt/sources.list entries and deb822 files such as /etc/apt/sources.list.d/debian.sources.
For example, a classic Debian 13 source line contains:
deb http://deb.debian.org/debian trixie main contrib non-free non-free-firmware
Replace trixie with bookworm on Debian 12. Backports option 2 additionally expects ${VERSION_CODENAME}-backports, such as trixie-backports.
With Secure Boot enabled, the NVIDIA DKMS module may not load until its Machine Owner Key is enrolled. If Debian created /var/lib/dkms/mok.pub, enroll it with:
sudo mokutil --import /var/lib/dkms/mok.pubThen reboot and complete enrollment in the firmware's MOK Manager. If mokutil is missing, install the Debian package of the same name first.
The Debian package is named nvidia-cuda-toolkit, not cuda. Confirm that non-free is enabled, then refresh APT:
sudo apt update
apt-cache policy nvidia-cuda-toolkitCheck whether headers exist for the running kernel:
uname -r
apt-cache policy "linux-headers-$(uname -r)"If only the newer architecture header metapackage was available, reboot into the newly installed Debian kernel and run the driver installation again.
From a recovery shell or TTY, inspect:
cat /var/log/nvidia-optimizer.log
dkms status
sudo mokutil --sb-stateSecure Boot, a failed DKMS build, or an old manually installed .run driver are the usual causes.
Run the script again and choose option 3 or 4. Cleanup is performed through APT; the script does not manually erase /var/lib/dkms or user-owned NVIDIA configuration files.
MIT License. See LICENSE.
The software is provided "as is", without warranty of any kind. Use it at your own risk; the author is not responsible for damage, data loss, or other issues caused by its use.