Install VFIO Kernel on Arch Linux

Arch Linux logo

VFIO kernel is used to easily apply kernel patches to workaround certain hardware limitations relating to virtualization and hardware passthrough suc as when setting up GPU Passthrough with QEMU. Among others VFIO kernel applies i915 VGA arbiter and ACS override patches. The patches al need to be enabled by adding parameters to the boot loader. The custom kernel comes in stable or LTS varieties.

 

Install VFIO Kernel with Packer

Install Packer if needed or use another package wrapper like Yaourt.

 

Install the patched kernel from AUR with packer.

packer -S linux-vfio

This will take considerable time to complete and will tax the system resources moderately. Long term support kernel is also available as linux-vfio-lts package.

 

You may encounter PGP signature could not be verified! error in which case you will need to add the PGP key for the user that will be used for the installation. Keys are obtained from PKGBUILD script of the package.

 

Add GPG keys.

gpg --keyserver pgp.mit.edu --recv-keys ABAF11C65A2970B130ABE3C479BE3E4300411886
gpg --keyserver pgp.mit.edu --recv-keys 647F28654894E3BD457199BE38DBBDC86092693E

 

Install VFIO Kernel Manually

If the installation did not succeed due to AUR helper the kernel can also be installed manually. To start download vfio-linux or vfio-linux-lts snapshot from the AUR page.

 

Change current directory to the that of the the downloaded archive.

cd ~/Downloads

 

Extract the downloaded archive.

tar -xvf linux-vfio.tar.gz

 

Change current directory to the newly extracted directory.

cd linux-vfio

 

Compile and build the package.

makepkg --skippgpcheck

IF the PGP signature could not be verified! error is causing the build to fail, --skippgpcheck option can be used to forego the check.

 

Install the vfio kernel package with pacman.

sudo pacman -U linux-vfio-4.9.8-1-x86_64.pkg.tar.xz

 

Install the vfio headers with pacman.

sudo pacman -U linux-vfio-headers-4.9.8-1-x86_64.pkg.tar.xz

 

Optionally install the vfio kernel documentation with pacman.

sudo pacman -U linux-vfio-docs-4.9.8-1-x86_64.pkg.tar.xz

 

Apply VFIO Kernel

Open the boot loader configuration file.

sudo nano /boot/loader/entries/arch.conf

Different flavours of Arch Linux may have an alternatively named configuration file. For example in Antergos Linux the path should be substituted with  /boot/loader/entries/antergos.conf.

 

Replace references to the current kernel with the name of the new kernel.

linux   /vmlinuz-linux-vfio
initrd  /initramfs-linux-vfio.img

To change from stable or LTS kernel to VFIO kernel the term linux should be changed to linux-vfio.

 

Reboot for the changes to take effect.

reboot

 

Check the current kernel version to verify the new kernel is in use.

uname -r