Skip to content

Instantly share code, notes, and snippets.

@ngoc-minh-do
Last active January 24, 2026 11:23
Show Gist options
  • Select an option

  • Save ngoc-minh-do/fcf0a01564ece8be3990d774386b5d0c to your computer and use it in GitHub Desktop.

Select an option

Save ngoc-minh-do/fcf0a01564ece8be3990d774386b5d0c to your computer and use it in GitHub Desktop.
Install Nvidia driver on Proxmox

Install NVIDIA Driver on Proxmox with Secure Boot

This guide walks you through installing the NVIDIA driver on Proxmox with Secure Boot enabled, including automatic signing of DKMS modules and troubleshooting tips.


1. Check Secure Boot Status

mokutil --sb-state

If Secure Boot is enabled, all kernel modules (including DKMS-built NVIDIA modules) must be signed.


2. Blacklist Nouveau Driver

Check if nouveau is loaded:

lsmod | grep nouveau

Blacklist it:

cat <<EOF | sudo tee /etc/modprobe.d/blacklist-nouveau.conf
blacklist nouveau
options nouveau modeset=0
EOF

update-initramfs -u -k all
reboot

3. Remove Existing NVIDIA / CUDA Drivers

If installed via .run

sudo /usr/bin/nvidia-uninstall

If installed via APT or DKMS

dkms remove -m nvidia -v 580.95.05 --all || true
apt purge -y --auto-remove '^nvidia.*'

Confirm cleanup:

dpkg -l | grep -E 'nvidia|cuda'
apt list --installed | grep -E 'nvidia|cuda'
dkms status

4. Install Required Packages

apt update
apt install -y build-essential dkms software-properties-common
apt install -y proxmox-default-headers
apt install -y proxmox-headers-$(uname -r)
Package Purpose
build-essential Includes gcc, needed for building modules
dkms Dynamically rebuilds kernel modules
software-properties-common Enables add-apt-repository
proxmox-default-headers Auto-track kernel headers
proxmox-headers-$(uname -r) Kernel headers for current kernel

5. Generate and Enroll a Machine Owner Key (MOK)

Create a dedicated directory under /root:

mkdir -p /root/module-signing
chmod 700 /root/module-signing

Generate key + certificate:

openssl req -new -x509 \
  -newkey rsa:2048 \
  -keyout /root/module-signing/module-signing.key \
  -outform DER \
  -out /root/module-signing/module-signing.der \
  -nodes -days 36500 \
  -subj "/CN=Nvidia Driver Kmod Signing MOK"

Enroll the key:

mokutil --import /root/module-signing/module-signing.der
# You'll be prompted to create a password. Enter it twice.

Reboot and follow on-screen MOK Manager prompts to enroll the key.

  • "Enroll MOK"
  • "Continue".
  • "Yes".
  • Enter the password you set up just now.
  • Select "OK" and the computer will reboot again.

After reboot, verify:

cat /proc/keys | grep asymmetri
mokutil --list-enrolled

6. Configure DKMS Automatic Module Signing

Create DKMS config:

cat > /etc/dkms/framework.conf.d/nvidia-signing.conf <<EOF
mok_signing_key=/root/module-signing/module-signing.key
mok_certificate=/root/module-signing/module-signing.der
EOF

Any enrolled MOK can sign kernel modules. DKMS will automatically sign modules during build.


7. Download and Install NVIDIA Driver

Download from Download The Official NVIDIA Drivers | NVIDIA

curl -O https://us.download.nvidia.com/XFree86/Linux-x86_64/580.95.05/NVIDIA-Linux-x86_64-580.95.05.run
chmod +x NVIDIA-Linux-x86_64-580.95.05.run

Install:

./NVIDIA-Linux-x86_64-580.95.05.run --dkms

Installer choices (important)

  • Kernel module type: MIT/GPL
  • Sign kernel module: Yes
  • Use existing key: Yes
  • Ignore X libraries: Yes (headless host)
  • Register DKMS module: Yes
  • Run nvidia-xconfig: No

Reboot:

reboot

8. Verification

nvidia-smi
uname -r
dkms status

Verify signing:

modinfo nvidia | grep -i signer

To view loaded NVIDIA Modules

lsmod | grep nvidia

Reference:


9. Troubleshooting DKMS or Secure Boot Failures

Check kernel version

uname -r
dkms status

Check DKMS log

less /var/log/apt/term.log

Search with /dkms

Check Secure Boot rejections

dmesg | grep -Ei 'nvidia|dkms|key|sign|secureboot'

Force rebuild

sudo dkms remove nvidia/580.95.05 -k $(uname -r)
sudo dkms install nvidia/580.95.05 -k $(uname -r)

Then reload the module:

modprobe nvidia

Verify

nvidia-smi

Remove unused kernel headers

uname -r
apt list --installed | grep header
sudo apt purge proxmox-headers-<old-kernel-version>

Remove DKMS module for the old kernel

dkms status
sudo dkms remove nvidia/580.95.05 -k <old-kernel-version> --force

10. Upgrade NVIDIA Driver

Remove the old driver and install the new driver


11. Optional: NVIDIA Persistence Mode

Create /etc/systemd/system/nvidia-persistenced.service:

[Unit]
Description=NVIDIA Persistence Daemon

[Service]
Type=forking
ExecStart=/usr/bin/nvidia-persistenced --verbose
ExecStartPost=/usr/bin/nvidia-smi
ExecStopPost=/bin/rm -rf /var/run/nvidia-persistenced

[Install]
WantedBy=multi-user.target

Enable

systemctl enable --now nvidia-persistenced

Verify

systemctl status nvidia-persistenced
ls -lah /dev/nvidia*
nvidia-smi --query-gpu=persistence_mode --format=csv
nvidia-smi -q | grep -i "Persistence Mode"

13. Optional: Enable DRM Kernel Mode Setting

Useful if you plan to run a GUI in LXC container.

Method 1: modprobe config

echo 'options nvidia-drm modeset=1' > /etc/modprobe.d/nvidia-drm.conf
update-initramfs -u -k all
reboot

Method 2: GRUB config

Edit /etc/default/grub, append bellow value to GRUB_CMDLINE_LINUX_DEFAULT variable:

nvidia-drm.modeset=1

Then:

update-grub
reboot

Confirm DRM is active:

cat /sys/module/nvidia_drm/parameters/modeset
# Should return: Y

Reference:

@szombi
Copy link

szombi commented Sep 17, 2025

Thanks, it's worked!

@Makpish
Copy link

Makpish commented Sep 19, 2025

thanks dude, finally something that worked.

@Floressence
Copy link

@ngoc-minh-do how do these steps compare to those suggested in the official Proxmox doc? I'm setting up Nvidia drivers on a fresh Ubuntu 24.04 host and am not sure if I should be following your doc on Proxmox 9 or theirs.

@ngoc-minh-do
Copy link
Author

@ngoc-minh-do how do these steps compare to those suggested in the official Proxmox doc? I'm setting up Nvidia drivers on a fresh Ubuntu 24.04 host and am not sure if I should be following your doc on Proxmox 9 or theirs.

What is the official Proxmox doc thay you are mentioning?

I’m not 100% sure, but i think the step will be similar on Ubuntu, except the kernel header package will be ‘linux-headers-’ instead of ‘proxmox-headers-

@Floressence
Copy link

@ngoc-minh-do how do these steps compare to those suggested in the official Proxmox doc? I'm setting up Nvidia drivers on a fresh Ubuntu 24.04 host and am not sure if I should be following your doc on Proxmox 9 or theirs.

What is the official Proxmox doc thay you are mentioning?

I’m not 100% sure, but i think the step will be similar on Ubuntu, except the kernel header package will be ‘linux-headers-’ instead of ‘proxmox-headers-

I'm referring to this document: https://pve.proxmox.com/wiki/NVIDIA_vGPU_on_Proxmox_VE#Host_Driver_Installation

I have SecureBoot enabled and likely need do the whole MOK key enrollment in UEFI but since this was the first time I am using Proxmox as the host OS I wanted to vet the solutions I'm seeing online. Your steps seem more comprehensive but I just wanted to be certain.

@ngoc-minh-do
Copy link
Author

ngoc-minh-do commented Nov 3, 2025

@ngoc-minh-do how do these steps compare to those suggested in the official Proxmox doc? I'm setting up Nvidia drivers on a fresh Ubuntu 24.04 host and am not sure if I should be following your doc on Proxmox 9 or theirs.

What is the official Proxmox doc thay you are mentioning?
I’m not 100% sure, but i think the step will be similar on Ubuntu, except the kernel header package will be ‘linux-headers-’ instead of ‘proxmox-headers-

I'm referring to this document: https://pve.proxmox.com/wiki/NVIDIA_vGPU_on_Proxmox_VE#Host_Driver_Installation

I have SecureBoot enabled and likely need do the whole MOK key enrollment in UEFI but since this was the first time I am using Proxmox as the host OS I wanted to vet the solutions I'm seeing online. Your steps seem more comprehensive but I just wanted to be certain.

I think that doc is for support vGPU (split gpu for multiple VMs).
I don’t use vGPU, just sharing gpu between multiple LXCs

@x25dev
Copy link

x25dev commented Nov 9, 2025

@ngoc-minh-do how do these steps compare to those suggested in the official Proxmox doc? I'm setting up Nvidia drivers on a fresh Ubuntu 24.04 host and am not sure if I should be following your doc on Proxmox 9 or theirs.

What is the official Proxmox doc thay you are mentioning?

I’m not 100% sure, but i think the step will be similar on Ubuntu, except the kernel header package will be ‘linux-headers-’ instead of ‘proxmox-headers-

Some of the DKMS functions used are only working with DKMS 3.1+ and Ubuntu 24.04 LTS is still on version 3.0.11 (latest) breaking.
Best to use the open drivers in case your GPU supports it.

@Floressence
Copy link

@ngoc-minh-do how do these steps compare to those suggested in the official Proxmox doc? I'm setting up Nvidia drivers on a fresh Ubuntu 24.04 host and am not sure if I should be following your doc on Proxmox 9 or theirs.

What is the official Proxmox doc thay you are mentioning?
I’m not 100% sure, but i think the step will be similar on Ubuntu, except the kernel header package will be ‘linux-headers-’ instead of ‘proxmox-headers-

Some of the DKMS functions used are only working with DKMS 3.1+ and Ubuntu 24.04 LTS is still on version 3.0.11 (latest) breaking. Best to use the open drivers in case your GPU supports it.

Damn, is that so? So following this guide would likely result in a broken config at the present moment then.

@Floressence
Copy link

I managed to get drivers installed following this guide and everything seems to be working now. Only thing I noticed here was that Debian 13 Trixie is not publishing package: software-properties-common due to some ongoing bug. It wasn't a hard requirement for me on PVE9.1 though. Thanks for the support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment