GPU Passthrough on Arch Linux: Step-by-Step Guide
In this article
GPU passthrough lets a virtual machine use a physical graphics card directly, giving it near-native performance for gaming, rendering, or compute workloads. On Arch Linux, this is done with VFIO (Virtual Function I/O) and a hypervisor like QEMU/KVM. This guide walks you through the entire process, from checking hardware support to booting a Windows VM with your GPU.
What You'll Need
- A CPU and motherboard that support Intel VT-d or AMD-Vi (IOMMU).
- A second GPU for the host (integrated graphics or a cheap card) — the GPU you pass through will be unavailable to the host.
- At least 8 GB of RAM (more is better for the VM).
- Arch Linux installed and updated (
sudo pacman -Syu). - Root access via sudo.
- A Windows or Linux ISO for the VM.
Step-by-Step
- Enable IOMMU in the kernel. Edit
/etc/default/gruband addintel_iommu=on(Intel) oramd_iommu=on(AMD) to theGRUB_CMDLINE_LINUX_DEFAULTline. Also addiommu=ptfor better performance. Then regenerate the GRUB config:sudo grub-mkconfig -o /boot/grub/grub.cfg. - Reboot and verify IOMMU is active. Run
dmesg | grep -i iommuand check for lines likeIOMMU enabled. Also checklspci -v | grep -i 'IOMMU group'to see groups. - Identify your GPU's PCI IDs. Run
lspci -nn | grep -i vgaand note the vendor and device IDs (e.g.,10de:1b81for a GTX 1080). You need the GPU you want to pass through. - Bind the GPU to VFIO. Create
/etc/modprobe.d/vfio.confwith the line:options vfio-pci ids=10de:1b81,10de:10f0(replace with your GPU's IDs, including the audio function if present). Then addvfio-pcito theMODULESarray in/etc/mkinitcpio.conf. - Regenerate initramfs. Run
sudo mkinitcpio -Pand reboot. - Verify VFIO is binding. After reboot, run
lspci -nnk | grep -A 3 'VGA'and check that the kernel driver isvfio-pcifor your target GPU. - Install QEMU and virt-manager. Run
sudo pacman -S qemu libvirt virt-manager. Enable and start libvirt:sudo systemctl enable --now libvirtd. - Create the VM. Open virt-manager, create a new VM, and select your ISO. Choose a custom storage path (e.g.,
/var/lib/libvirt/images/win10.qcow2) and allocate CPU and RAM. - Add the GPU to the VM. In the VM's hardware details, click 'Add Hardware' → 'PCI Host Device' and select your GPU. Do the same for the GPU's audio function if you want sound through it.
- Configure the VM for passthrough. In the VM's XML (via
virsh editor virt-manager's XML tab), add the following under<features>:<hyperv><relaxed state='on'/><vapic state='on'/><spinlocks state='on' retries='8191'/></hyperv>and under<clock>setclock offset='localtime'. Also add<vendor_id state='on' value='whatever'/>to hide the hypervisor. - Isolate the GPU from the host. To prevent the host from using the GPU, add
vfio-pcito theMODULESin/etc/mkinitcpio.conf(already done) and optionally blacklist the nvidia or amdgpu driver by creating/etc/modprobe.d/blacklist.confwithblacklist nvidiaorblacklist amdgpu. - Install the guest OS. Boot the VM, install Windows (or Linux) normally. Install the GPU drivers from the vendor's website.
- Test and adjust. Once installed, reboot the VM and check that the GPU is recognized and working. You may need to set the GPU as the primary display in the VM's BIOS settings.
Common Mistakes
- Not enabling IOMMU in the kernel — the most common issue.
- Using the wrong PCI IDs — always copy the exact IDs from
lspci -nn. - Forgetting to add the GPU's audio function to VFIO, causing sound issues.
- Not blacklisting host drivers, so the host grabs the GPU before VFIO can.
- Using a VM with UEFI when the GPU's firmware requires legacy BIOS, or vice versa.
Tips
- Use a separate IOMMU group for the GPU and its audio function if possible; if they're in the same group, you must pass both together.
- For better performance, use a dedicated physical disk or an NVMe drive passed through to the VM.
- Set the VM's CPU model to 'host-passthrough' to get the best CPU features.
- Use the
virtiodrivers for disk and network in the VM for faster I/O. - If you have two GPUs, you can use the secondary for the host and the primary for the VM.
Troubleshooting
- No IOMMU groups: Check if your BIOS has an 'IOMMU' or 'VT-d' option and enable it. Also ensure the kernel parameters are set correctly.
- GPU not binding to vfio-pci: Run
lspci -nnkto see what driver is bound. If it's still the host driver, you may need to blacklist it or use thedriver_overridemethod:echo 'vfio-pci' > /sys/bus/pci/devices/0000:01:00.0/driver_override(replace with your device address). - VM fails to start with 'Error: internal error: process exited while connecting to monitor': Check the libvirt logs at
/var/log/libvirt/qemu/for detailed errors. Often it's a permissions issue — make sure your user is in thelibvirtgroup. - Black screen in the VM: Try using the VGA display instead of the GPU for the VM's primary display, or set the GPU as the primary in the VM's firmware settings.
- GPU works but no output: Ensure the monitor is connected to the GPU you passed through, and that the GPU's firmware is compatible — sometimes you need to set the VM to use UEFI instead of SeaBIOS.
- Host crashes on VM start: This often happens when the host tries to use the GPU. Make sure the GPU is properly bound to vfio-pci and blacklisted from host drivers.
Frequently Asked Questions
Can I use my only GPU for passthrough?
Yes, but the host will have no display output. You can use a virtual console or SSH, but it's not recommended for a desktop host.
Do I need a second GPU?
Not strictly, but it's highly recommended. Without a second GPU, you'll need to use the host's integrated graphics or a headless setup.
Will my GPU work with passthrough?
Most modern GPUs work, but some older or low-end cards may lack proper UEFI support. Check the Arch Wiki's GPU passthrough page for known issues.
Can I pass through an NVIDIA GPU?
Yes, but you may need to hide the hypervisor from the NVIDIA driver (as shown in step 10) to avoid error 43 in Windows.
Does passthrough affect host performance?
Minimal, as long as the host uses its own GPU. The CPU and RAM are shared, so allocate accordingly.
Can I use the GPU on both host and VM?
Not simultaneously. The GPU is exclusively assigned to the VM once passthrough is active.