QEMU-KVM Installation for Arch Linux This article provides a step-by-step guide for installing and configuring QEMU-KVM virtualization on Arch Linux. It details the installation of necessary packages, enabling systemd services, and validating the setup with `virt-host-validate`. The guide also covers enabling nested virtualization, configuring IOMMU and AMD SEV support, and optimizing performance using the TuneD service with the `virtual-host` profile. lscpu | grep -i Virtualization VT-x for IntelAMD-Vi for AMD zgrep CONFIG KVM /proc/config.gz y = Yes always installed m = Loadable module sudo pacman -S qemu-full qemu-img libvirt virt-install virt-manager virt-viewer \ edk2-ovmf dnsmasq swtpm guestfs-tools libosinfo tuned qemu-full - user-space KVM emulator, manages communication between hosts and VMsqemu-img - provides create, convert, modify, and snapshot, offline disk imageslibvirt - an open-source API, daemon, and tool for managing platform virtualizationvirt-install - CLI tool to create guest VMsvirt-manager - GUI tool to create and manage guest VMsvirt-viewer - GUI console to connect to running VMsedk2-ovmf - enables UEFI support for VMsdnsmasq - lightweight DNS forwarder and DHCP serverswtpm - TPM Trusted Platform Module emulator for VMsguestfs-tools - provides a set of extended CLI tools for managing VMslibosinfo - a library for managing OS information for virtualization.tuned - system tuning service for linux allows us to optimise the hypervisor for speed. Go to the Fedora People repository and download virtio-win.iso . Save it anywhere on disk, and attach it to a CD-ROM it when creating Windows VM. The default location on Debian/RedHat based is /usr/share/virtio-win/ - Here is the documentation detailing the difference between monolithic and modular daemons. - Choose between option 1 and 2 and then do a reboot . for drv in qemu interface network nodedev nwfilter secret storage; do sudo systemctl enable virt${drv}d.service; sudo systemctl enable virt${drv}d{,-ro,-admin}.socket; done - loop through virtualization systemd services necessary for the libvirt modular daemon. sudo systemctl enable libvirtd.service sudo virt-host-validate qemu If you receive warnings, proceed to their respective sections. Re-run the above command to check your changes. Intel: sudo modprobe -r kvm intel sudo modprobe kvm intel nested=1 AMD: sudo modprobe -r kvm amd sudo modprobe kvm amd nested=1 Intel: echo "options kvm intel nested=1" | sudo tee /etc/modprobe.d/kvm-intel.conf AMD: echo "options kvm amd nested=1" | sudo tee /etc/modprobe.d/kvm-amd.conf WARN IOMMU appears to be disabled in the kernel. Add intel iommu=on to kernel cmdline arguments - Open your GRUB config sudo vim /etc/default/grub - Add the following kernel module entries /etc/default/grub GRUB CMDLINE LINUX="... intel iommu=on iommu=pt" - Regenerate your grub.cfg file sudo grub-mkconfig -o /boot/grub/grub.cfg sudo reboot For AMU CPUs with SEV feature, you might receive this warning: WARN AMD Secure Encrypted Virtualization appears to be disabled in kernel. Add kvm amd.sev=1 to the kernel cmdline arguments If you are in Intel you may ignore the warning below, as this only affects AMD CPUs. WARN Unknown if this platform has Secure Guest support . You may refer to this bug report: Or this libvirt documentation: echo "options kvm amd sev=1" | sudo tee /etc/modprobe.d/amd-sev.conf sudo reboot - Open your GRUB config sudo vim /etc/default/grub - Add the following kernel module entries /etc/default/grub GRUB CMDLINE LINUX="... mem encrypt=on kvm amd.sev=1" - Regenerate your grub.cfg file sudo grub-mkconfig -o /boot/grub/grub.cfg sudo reboot - Enable TuneD daemon sudo systemctl enable --now tuned.service - Check active TuneD profile tuned-adm active Current active profile: balanced balanced - generic profile not specialised for KVM, we will change this. - List all TuneD profiles tuned-adm list - Set profile to virtual-host sudo tuned-adm profile virtual-host - Verify that TuneD profile tuned-adm active Current active profile: virtual-host sudo tuned-adm verify Verification succeeded, current system settings match the preset profile. See TuneD log file '/var/log/tuned/tuned/log' for details. - By default all virtual machines will connect to the built-in default NAT network. - To make VMs accessible via the LAN you must create a network bridge. - Keep in mind that network bridges won't work with hosts running on Wireless NICs. - All configuration steps below is done using NetworkManager . If you use a different program to manage networking use that instead. Default NAT network XML dump: