Nvidia GPU PCIe passthrough successful but driver fails to register device — it’s a stupid error because everything looks fine in Proxmox. The VM boots, lspci sees the card, but nvidia-smi says no devices found. Here’s the fix.

Check the obvious first
Make sure the VM actually has the GPU. Inside the guest, run lspci | grep -i nvidia. If you see the card, the passthrough worked. The problem is the driver not binding to it.
Then check dmesg for clues. dmesg | grep -i nvidia will often show something like NVRM: failed to register with the ACPI subsystem or NVRM: GPU at PCI:0000:01:00:0 has fallen off the bus. That tells you it’s not just a driver install issue.
Fix 1: x-vga and primary GPU
If you’re passing the GPU as the only display adapter, add x-vga=on to the hostpci line in the VM config. This tells Proxmox to treat it as the primary VGA device. Without it, the driver can fail to register because the card isn’t initialized properly.
qm set 100 -hostpci0 01:00.0,x-vga=on
If you also have a virtual display adapter (like the default VGA), remove it or set the GPU as primary. Having both can confuse the driver.

Fix 2: PCI reallocation
Some motherboards don’t assign enough resources to the GPU when it’s passed through. This shows up as BAR allocation errors in dmesg. The fix is to enable PCI reallocation in the kernel parameters.
Edit /etc/default/grub and add pci=realloc to GRUB_CMDLINE_LINUX_DEFAULT. Then run update-grub and reboot the host.
GRUB_CMDLINE_LINUX_DEFAULT="quiet pci=realloc"
This is a common fix for older boards or when the GPU has a large BAR (like RTX 30 series).
Fix 3: driver blacklist
If the host is loading the Nvidia driver (or nouveau) before the VM grabs the card, it can cause issues. Blacklist the drivers on the host so they don’t touch the GPU.
Create a file /etc/modprobe.d/blacklist-nvidia.conf with:
blacklist nouveau
blacklist nvidia
blacklist nvidia_drm
blacklist nvidia_modeset
Then run update-initramfs -u and reboot. This ensures the host never binds to the GPU, leaving it clean for passthrough.
What worked for me
The x-vga flag fixed it for my setup. The card was showing up in lspci but nvidia-smi kept saying no devices. Adding x-vga=on and removing the virtual display adapter did the trick. If that doesn’t work, try the PCI realloc — it’s a close second.
Don’t overthink it. Start with x-vga, then realloc, then blacklist. One of them will get the driver to register.
Related: Fix Proxmox GPU Passthrough Black Screen on VM Start