Skip to content

Instantly share code, notes, and snippets.

@sovajri7
Last active July 9, 2025 13:51
Show Gist options
  • Save sovajri7/fb594c49fa97f00216786f190933b39a to your computer and use it in GitHub Desktop.
Save sovajri7/fb594c49fa97f00216786f190933b39a to your computer and use it in GitHub Desktop.
Install vGPU & Bypass NVIDIA License on Proxmox using FastAPI-DLS and Patched Drivers

Install vGPU & Bypass NVIDIA License on Proxmox using FastAPI-DLS and Patched Drivers

This guide explains how to run NVIDIA vGPU on Proxmox using FastAPI-DLS and patched drivers, without relying on the official NVIDIA License Server.

It is intended for users with supported or partially supported GPUs (such as RTX A4000 / A5000 / A6000) who want to unlock vGPU functionality in their virtual machines (Ubuntu or Windows) for AI (Ollama, vLLM), compute, or media workloads.

You need to check if your GPU is supported : https://docs.nvidia.com/vgpu/gpus-supported-by-vgpu.html

If not, you can still use vGPU by following this tutorial and mine to enable vGPU on consumer GPUs : https://gitlab.com/polloloco/vgpu-proxmox

If your card is RTX A4000 / A5000 / A6000 or any other card with display functions and mdev_supported is missing, this gist is for you.

Here is my configuration : vGPU 18.3 on Proxmox 8.4.1 (NVIDIA-Linux-x86_64-570.158.02-vgpu-kvm.run), VMs like Ubuntu Server 24.04.2 (NVIDIA-Linux-x86_64-570.158.01-grid.run) and Windows 11 (573.39_grid_win10_win11_server2022_dch_64bit_international.exe)

#-- PREPARATION --#

  1. Confirm that the following features are enabled in your BIOS/UEFI :
  • VT-d for Intel, or AMD-v for AMD (sometimes named IOMMU)
  • SR-IOV (this may not be necessary for older pre-Ampere GPU generations)
  • Above 4G decoding
  • Alternative Routing ID Interpretation (ARI) (not necessary for pre-Ampere GPUs)
  1. On Proxmox -> Node -> Shell, execute the command below, it will set up some basics, like blacklisting the nouveau driver, installing header packages, DKMS, ect. :

pve-nvidia-vgpu-helper setup

  1. Then reboot.

#-- INSTALLATION --#

#- Host Driver -#

This website is dumping all the drivers from NVIDIA repository so you can download/install without registering : https://alist.homelabproject.cc/foxipan/vGPU

In this exemple, I'll install the NVIDIA-Linux-x86_64-570.158.02-vgpu-kvm.run Host driver on Proxmox.

  1. Download the file :

wget https://alist.homelabproject.cc/d/foxipan/vGPU/18.3/NVIDIA-GRID-Linux-KVM-570.158.02-570.158.01-573.39/Host_Drivers/NVIDIA-Linux-x86_64-570.158.02-vgpu-kvm.run

  1. Make it executable and install (if you don't have all the tools to install, just run apt install build-essential before) :
chmod +x NVIDIA-Linux-x86_64-570.158.02-vgpu-kvm.run
./NVIDIA-Linux-x86_64-570.158.02-vgpu-kvm.run
  1. Then reboot.

  2. Check if vGPU drivers are installed running : nvidia-smi and nvidia-smi vgpu

  3. Create the mapped device on Proxmox : Datacenter -> Resource Mappings -> Add New PCI Device (enable 'Use with mediated devices') and select all the devices.

  4. You can now associate a vGPU profile when creating VM.

!!! INFORMATION !!!

  1. In my case I'm using a RTX A5000 with display functions so my card need to be flashed to another firmware using NVIDIA_Display_Mode_Selector_Tool :

wget https://alist.homelabproject.cc/d/foxipan/vGPU/tools/NVIDIA_Display_Mode_Selector_Tool-March-2022.zip

  1. Unzip the archive (install unzip if you don't have it : apt install unzip) :

unzip NVIDIA_Display_Mode_Selector_Tool-March-2022.zip

  1. Go to the folder extracted :

cd Mar\ 2022/

  1. Execute the tool :

./displaymodeselector --gpumode

Now on the Q&A :

Click "y" then select the "<1> physical_display_disabled"

  1. Then reboot and install the Host driver again : ./NVIDIA-Linux-x86_64-570.158.02-vgpu-kvm.run (and reboot again)

  2. Enable SR-IOV (it as been enabled already with the script but to be sure) :

systemctl enable --now [email protected]

  1. Now you can check if all mdev are listed :

lspci -d 10de:

You should get something like this :

root@proxmox:~/Mar 2022# lspci -d 10de:
04:00.0 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:00.4 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:00.5 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:00.6 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:00.7 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:01.0 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:01.1 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:01.2 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:01.3 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:01.4 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:01.5 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:01.6 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:01.7 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:02.0 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:02.1 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:02.2 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:02.3 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:02.4 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:02.5 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:02.6 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:02.7 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:03.0 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:03.1 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:03.2 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)
04:03.3 3D controller: NVIDIA Corporation GA102GL [RTX A5000] (rev a1)

#-- Guest Driver --#

#- Ubuntu Guest Driver Install -#

  1. First we need to install FastAPI-DLS, I will install it on a Guest machine (this one), but you can install it on another machine.
export WORKING_DIR=/opt/docker/fastapi-dls/cert
sudo mkdir -p "$WORKING_DIR" && cd "$WORKING_DIR"
sudo openssl genrsa -out instance.private.pem 2048
sudo openssl rsa -in instance.private.pem -pubout -out instance.public.pem
sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 \
     -keyout webserver.key -out webserver.crt
  1. Now create the container :
sudo docker volume create dls-db
sudo docker run -d --name fastapi-dls --restart=always \
     -e TZ="Europe/Paris" \           #VERY IMPORTANT : CHANGE THIS TO YOURS
     -e DLS_URL="192.168.0.218" \     #IP OF THE FASTAPI_DLS (here this machine)
     -e DLS_PORT=443 \
     -e LEASE_EXPIRE_DAYS=90 \        #DURATION OF THE LEASE (90 days by default)
     -p 443:443 \
     -v /opt/docker/fastapi-dls/cert:/app/cert \ 
     -v dls-db:/app/database \
     collinwebdesigns/fastapi-dls:latest
  1. Download the Guest Driver :

sudo wget https://alist.homelabproject.cc/d/foxipan/vGPU/18.3/NVIDIA-GRID-Linux-KVM-570.158.02-570.158.01-573.39/Guest_Drivers/NVIDIA-Linux-x86_64-570.158.01-grid.run

  1. Make it executable and install it (if you don't have all the tools : sudo apt install build-essential) :

sudo chmod +x NVIDIA-Linux-x86_64-570.158.01-grid.run sudo ./NVIDIA-Linux-x86_64-570.158.01-grid.run

  1. Download the gridd-unlock-patcher

sudo wget https://git.collinwebdesigns.de/api/v4/projects/129/packages/generic/gridd-unlock-patcher/1.1/gridd-unlock-patcher

  1. Make it executable :

chmod +x gridd-unlock-patcher

  1. Get the latest root-certificate from the FastAPI-DLS machine (here : 192.168.0.218) and name it correctly :

sudo wget https://192.168.0.218/-/config/root-certificate --no-check-certificate sudo mv root-certificate root-certificate.pem

  1. Start the tool :

sudo gridd-unlock-patcher -g $(which nvidia-gridd) -c root-certificate.pem

  1. Reboot the nvidia-gridd service and check if all is running :
sudo systemctl restart nvidia-gridd
sudo systemctl status nvidia-gridd

If nvidia-gridd not running go to Troubleshooting 1

#- Windows Guest Driver Install -#

  1. Download the .exe here :

https://alist.homelabproject.cc/foxipan/vGPU/18.3/NVIDIA-GRID-Linux-KVM-570.158.02-570.158.01-573.39/Guest_Drivers/573.39_grid_win10_win11_server2022_dch_64bit_international.exe

  1. Open PowerShell admin privilege and download client_configuration_token.tok from FastAPI-DLS server :

curl.exe -k -L "https://192.168.0.218/-/client-token" -o "C:\Program Files\NVIDIA Corporation\vGPU Licensing\ClientConfigToken\client_configuration_token.tok"

  1. Restart the nvidia service :

Restart-Service NVDisplay.ContainerLocalSystem

Then open the NVIDIA Control Panel app (check on the minimize apps section down right on your desktop).

You can check if the license is active, if not go to Troubleshooting 2.

#-- TROUBLESHOOTING 1 --#

The token is signed with a precise date/time. If there is a clock discrepancy between your Windows and the Ubuntu server, the token is silently rejected.

  1. On Windows : Open PowerShell admin privilege :

Get-Date

  1. On Ubuntu :

date

  1. If not synced :

  2. On Ubuntu (set to your TZ) :

sudo timedatectl set-timezone Europe/Paris
sudo timedatectl set-ntp true
  1. Restart fastapi-dls container :

sudo docker restart fastapi-dls

  1. On Windows :
Remove-Item "C:\Program Files\NVIDIA Corporation\vGPU Licensing\ClientConfigToken\client_configuration_token.tok"
curl.exe -k -L "https://192.168.0.218/-/client-token" -o "C:\Program Files\NVIDIA Corporation\vGPU Licensing\ClientConfigToken\client_configuration_token.tok"
Restart-Service NVDisplay.ContainerLocalSystem

If still not licensed, then continue.

We will generate the certs with Common Name and Subject Alternative Name :

  1. On Ubuntu
sudo mkdir -p /opt/docker/fastapi-dls/cert
cd /opt/docker/fastapi-dls/cert
sudo rm -f webserver.*
sudo nano /opt/docker/fastapi-dls/cert/openssl-san.cnf

Content :

[req]
default_bits       = 2048
distinguished_name = req_distinguished_name
x509_extensions    = v3_req
prompt             = no

[req_distinguished_name]
C  = FR
ST = France
L  = Paris
O  = Home
OU = IT
CN = 192.168.0.218 #IP OF FASTAPI-DLS HOST

[v3_req]
subjectAltName = @alt_names

[alt_names]
IP.1 = 192.168.0.218 #IP OF FASTAPI-DLS HOST
cd /opt/docker/fastapi-dls/cert
sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 \
  -keyout webserver.key -out webserver.crt \
  -config openssl-san.cnf

sudo docker restart fastapi-dls

  1. On Windows :

Download :

  1. Start CMD admin privilege :

powershell.exe -executionpolicy bypass -file "$HOME\Desktop\windows-replace-nvxdapix.ps1"

  1. Restart :

Restart-Service NVDisplay.ContainerLocalSystem

#-- TROUBLESHOOTING 2 --#

  1. Install the nvidia-gridd patched :

sudo wget https://alist.homelabproject.cc/d/foxipan/vGPU/18.3/Guest_Drivers_Patched/nvidia-gridd

  1. Make it executable :

sudo chmod +x nvidia-gridd

  1. Rename the origin nvidia-gridd :

sudo mv /usr/bin/nvidia-gridd /usr/bin/nvidia-gridd.bak

  1. Copy the patch :

sudo cp /temporary/nvidia-gridd /usr/bin/nvidia-gridd

  1. Restart and check :
sudo systemctl restart nvidia-gridd
sudo systemctl status nvidia-gridd

Sources :

https://pve.proxmox.com/wiki/NVIDIA_vGPU_on_Proxmox_VE#Software_Versions https://forums.developer.nvidia.com/t/issue-in-vgpu-setup-in-ubuntu-20-04-3/198570/13 https://alist.homelabproject.cc/foxipan/vGPU https://git.collinwebdesigns.de/oscar.krause/fastapi-dls https://git.collinwebdesigns.de/vgpu/gridd-unlock-patcher

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