VirtualBox iGPU透传疑问:Fedora下KVM PCI透传配置后挂载问题
Alright, let's work through your iGPU passthrough issue with VirtualBox on Fedora, building on the steps you've already knocked out successfully:
- You enabled IOMMU and virtualization in your motherboard BIOS/UEFI (critical first step!)
- You blocked the target device from being claimed by host kernel modules on boot
- You verified IOMMU is active with
dmesg | grep -i iommu– awesome that even VirtualBox's modules picked up on it! - You noticed via
lspci -nnkthat your iGPU isn't bound tovfio-pcibut is occupied by another module (that's expected right now, but we need to fix that for passthrough)
Now let's dive into getting that iGPU passed to your VirtualBox VM. Here are the key steps and fixes to try:
1. Make Sure VirtualBox Has PCI Passthrough Support Turned On
VirtualBox doesn't do PCI passthrough out of the box – you need a couple of prerequisites:
- Install the VirtualBox Extension Pack that matches your exact VirtualBox version. This is non-negotiable for PCI passthrough functionality.
- Add your user to the
vboxusersgroup with:
Log out and back in after running this so the group change takes effect.sudo usermod -aG vboxusers $USER
2. Force Unbind the iGPU from the Host Kernel Module
Since lspci -nnk shows your iGPU is held by another module (probably Intel's i915 or AMD's amdgpu), we need to unbind it and hand it over to vfio-pci:
- First, get the exact details of your iGPU:
Note down:lspci -nnk | grep -A 3 "VGA compatible controller"- The PCI address (looks like
0000:XX:XX.X) - The vendor:device ID (looks like
XXXX:XXXX) - The kernel driver currently in use (e.g.,
i915)
- The PCI address (looks like
- Temporarily unbind the driver for testing:
# Replace i915 with your driver, and the PCI address with yours sudo modprobe -r i915 sudo echo "0000:XX:XX.X" > /sys/bus/pci/drivers/i915/unbind - Now bind the iGPU to
vfio-pci:sudo modprobe vfio-pci # Replace XXXX:XXXX with your vendor:device ID sudo echo "XXXX:XXXX" > /sys/bus/pci/drivers/vfio-pci/new_id - To make this permanent, create a systemd service that runs these commands on boot (so you don't have to do it manually every time).
3. Configure Your VirtualBox VM for iGPU Passthrough
- Open your VM's settings, head to the PCI tab (this won't show up if you skipped the Extension Pack or group setup).
- Click the "+" button to add a PCI device, then select your iGPU from the list.
- Check the "Enable PCI passthrough" box for the device.
- Switch the VM to EFI boot mode (iGPU passthrough almost always fails with legacy BIOS boot – go to System > Motherboard and set "Boot Order" to EFI).
- Disable the VM's default virtual display adapter (since you'll use the iGPU's physical output): go to Display > Screen and set "Graphics Controller" to "None".
4. Fix Common iGPU Passthrough Headaches
- Host is still using the iGPU: If your desktop environment is running on the iGPU, passthrough will fail. Switch to a text-only console before starting the VM:
Switch back to the desktop later withsudo systemctl isolate multi-user.targetsudo systemctl isolate graphical.targetafter shutting down the VM. - IOMMU Group conflicts: Ensure your iGPU is in its own IOMMU group (or a group with no other devices you need on the host). Check with:
If it's grouped with other devices, try enabling ACS override in your BIOS (if available) or moving the GPU to a different PCI slot.dmesg | grep -i "iommu group" - Outdated VirtualBox: Make sure you're on the latest stable version – older builds have known bugs with iGPU passthrough.
If you're still hitting errors, share the exact message you get when starting the VM, plus the full output of lspci -nnk | grep -A 5 "VGA compatible controller" – that'll help zero in on the problem faster.
内容的提问来源于stack exchange,提问作者arielnmz

