This guide makes a few assumptions: you have Proxmox 6.2 configured, you have an Nvidia card, and you've configured an Arch Linux container. There are a lot of guides that I grabbed bits and pieces from to get this working. I basically ended up working backwards through my bash history to put this together. In retrospect, I should have kept a running list to provide credit at the end.
The purpose of this guide is to (1) get the Nvidia card working with Proxmox and (2) give the Arch Linux container access to the video card. Why? Because containers are awesome and the Nvidia card can be shared among them.
Enabling the Nvidia Driver
The latest supported Nvidia driver is in Buster Backports. We'll first need to enable this before installing the driver. As root in Proxmox:
We'll now install the kernel headers. I typically install these regardless since you'll need for any other kernel modules, e.g. Wireguard.
Next we'll install the Nvidia drivers and SMI tool from Buster Backports:
Please note that you'll get a warning about rebooting if you've previously installed another version of the Nvidia driver. Also take note of the Nvidia build number: it's 440.100 as of writing this guide. You'll need the same version for your Arch Linux container to function correctly. There are a few more steps to configure before we reboot, mainly to ensure everything is loaded as expected.
At this point we'll reboot and check our devices:
After the reboot, you should have all of your Nvidia devices:
Pay attention to those numbers. You will need them in another step. Please note these will likely be different numbers on your Proxmox installation.
Testing the Nvidia Card on Proxmox
All we need is the nvidia-smi command that we'd previously installed.
Configuring the Arch Linux Container
Modifying the Container Details
You'll first want to power down the container running Arch Linux. We'll be making changes to its configuration file. Log back into Proxmox and search for the container configuration file, e.g. 103.conf. The file should look like this:
You'll want to add a few lines using those device numbers mentioned above. The lxc.cgroup.devices.allow values will match them. With the same file open, we'll add some additional configuration options:
At this point we can power the Arch Linux container back up. SSH into the Arch Linux container, and you should see the devices when doing an ls:
Installing the Nvidia Driver on Arch Linux
We'll now be installing the Nvidia drivers for Arch Linux, minus any kernel modules. We'll first need to download the driver from Nvidia's website. This part is extremely important: the Nvidia driver version on Arch Linux must match the version in Proxmox. According to the output from nvidia-smi in the previous step, we are running version 440.100 of the driver.
Go to the Nvidia Drivers Downloads site and search for the correct driver for your card. You'll likely want Linux 64-bit for the operating system. Select the version that matches the Proxmox version of the Nvidia driver, click on Downloads, and then right-click on the next Download button to copy the URL. You can also change the version numbers in the URL if needed. For example: