Disclaimer:
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.
Summary
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.
Configuring Proxmox
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:
http://us.download.nvidia.com/XFree86/Linux-x86_64/440.100/NVIDIA-Linux-x86_64-440.100.run
Once you have the URL and you're logging into your Arch Linux container, run the following commands:
You should be able to use the default answers. Once complete, we'll now have the Nvidia-related devices and tools available in the Arch Linux container.
Testing the Video Card
Assuming everything was configured correctly, we should be able to get the same results as Proxmox when running the nvidia-smi
command. From Arch Linux:
nvidia-smi
Mon Jul 13 23:57:54 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.100 Driver Version: 440.100 CUDA Version: 10.2 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 660 Off | 00000000:01:00.0 N/A | N/A |
| 30% 32C P8 N/A / N/A | 1MiB / 1996MiB | N/A Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 Not Supported |
+-----------------------------------------------------------------------------+
Success! Hope this helps.