Skip to content

Instantly share code, notes, and snippets.

@richardkiss
Last active September 3, 2024 18:29
Show Gist options
  • Save richardkiss/2825c2d4bcde04e01377c2cb1621497b to your computer and use it in GitHub Desktop.
Save richardkiss/2825c2d4bcde04e01377c2cb1621497b to your computer and use it in GitHub Desktop.
Minimal install of nvidia kernel drivers on proxmox host

Add the non-free debian repository

echo 'deb http://ftp.us.debian.org/debian bullseye non-free' > /etc/apt/sources.list.d/non-free.list

Refresh

apt update

Add proxmox-specific headers required for DKMS https://en.wikipedia.org/wiki/Dynamic_Kernel_Module_Support

apt install pve-headers-$(uname -r)

Install driver as DKMS

apt install nvidia-smi nvidia-tesla-470-kernel-dkms --no-install-recommends

Create rules to create new devices automatically.

cat <<HERE > /etc/udev/rules.d/70-nvidia.rules
# /etc/udev/rules.d/70-nvidia.rules
# Create /nvidia0, /dev/nvidia1 … and /nvidiactl when nvidia module is loaded
KERNEL=="nvidia", RUN+="/bin/bash -c '/usr/bin/nvidia-smi -L && /bin/chmod 666 /dev/nvidia*'"
# Create the CUDA node when nvidia_uvm CUDA module is loaded
KERNEL=="nvidia_uvm", RUN+="/bin/bash -c '/usr/bin/nvidia-modprobe -c0 -u && /bin/chmod 0666 /dev/nvidia-uvm*'"
HERE

Now add all the new drivers to the list of kernel drivers loaded

ls /lib/modules/5.15.83-1-pve/updates/dkms | sed 's/.ko//' > /etc/modules-load.d/nvidia.conf

References:

On the guest OS, use apt install nvidia-headless-470 --no-install-recommends or another variant, being sure the 470 version matches the kernel version.

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