Nvidia driver loads instead of vfio-pci

I am using debian 12, virt-manager kvm/qemu and i was using an nvidia gpu inside a VM with passthrough for LLMs.
To load the vfio-pci i had edited the grub file

GRUB_CMDLINE_LINUX_DEFAULT=“intel_iommu=on vfio-pci.ids=10de:24b0,10de:228b”

and created /etc/modprobe.d/vfio.conf:
options vfio-pci ids=10de:24b0,10de:228b
softdep nvidia pre:vfio-pci

A couple of years ago, i had the nvidia driver installed and with those changes i could get passthrough working. When i installed debian 12 on a new drive i didn’t install the nvidia-driver, i did those changes again and the passthrough worked.

Today i thought of trying to bind/unbind the drivers to try to use the gpu in the host machine too. So i installed the nvidia-driver and to my surprise i couldn’t make the vfio-pci to load anymore. I removed completely the nvidia-driver and run update-initramfs -u(even though they were updated after the purge) and instead of the vfio-pci, nouveau loaded.

Any idea what’s going on?

1 Like

I think you just need to blacklist nouveau from loading, add to /etc/modprobe.d/vfio.conf : blacklist nouveau.

I also use Nvidia GPU passthrough and just use vfio-pci.ids as a kernel option along with blacklist nouveau, no Nvidia drivers installed. You could also blacklist nvidia if you wanted the drivers installed for some reason.

1 Like