Skip to content

Instantly share code, notes, and snippets.

@vhsdream
Forked from richardkiss/nvidia-proxmox-kernel.md
Created August 26, 2024 16:55
Show Gist options
  • Save vhsdream/5ecf5351ae94dd1582951cbe50760432 to your computer and use it in GitHub Desktop.
Save vhsdream/5ecf5351ae94dd1582951cbe50760432 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