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:
- https://gist.github.com/egg82/90164a31db6b71d36fa4f4056bbee2eb (how to set up guests)
- https://theorangeone.net/posts/lxc-nvidia-gpu-passthrough/
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.