Setting Up NVIDIA GRID Drivers for vGPU Passthrough on TrueNAS SCALE

I ended up writing a script to fix the UUID issue at every reboot. The script is the following:

pci_slot='0000:02:00.0'

uuid=$(midclt call app.gpu_choices | jq -r '."0000:02:00.0".vendor_specific_config.uuid')
data='{"values": {"resources": {"gpus": {"use_all_gpus": false, "nvidia_gpu_selection": {"'$pci_slot'": {"use_gpu": true, "uuid": "'$uuid'"}}}}}}'
eval midclt call -job app.update $1 \'$data\'

where pci_slot is your gpu’s pci slot id (not sure if it’s the right term) that you can find by running midclt call app.gpu_choices | jq. The script then runs midclt call -job app.update APP_NAME '{"values": {"resources": {"gpus": {"use_all_gpus": false, "nvidia_gpu_selection": {"PCI_SLOT": {"use_gpu": true, "uuid": "GPU_UUID"}}}}}}' replacing APP_NAME with whatever you pass to the script (e.g. if you run ./uuid_fix jellyfin the APP_NAME will be jellyfin.), PCI_SLOT with the pci_slot variable and GPU_UUID with the newly obtained uuid. At the moment I run it manually at every reboot but you could set up a init script to run the script automatically at every boot.

NOTE: I’m still on TrueNAS 24.10. If you’re on version 25.04 or later, change the -job in the last line of the command to -j, as specified in this post.