QEMU-KVM on Arch Linux
Sources:
- Arch wiki KVM https://wiki.archlinux.org/title/KVM
- Arch wiki QEMU https://wiki.archlinux.org/title/QEMU
Checking CPU support for KVM
LC_ALL=C.UTF-8 lscpu | grep Virtualization
or
grep -E --color=auto 'vmx|svm|0xc0f' /proc/cpuinfo
If nothing is displayed, your CPU does not support hardware virtualization, so KVM will not work.
Checking Kernel support
zgrep CONFIG_KVM= /proc/config.gz
The KVM module is available only if it is set to y or m.
lsmod | grep kvm
If no output is shown, the module may need to be loaded manually. See https://wiki.archlinux.org/title/Kernel_module#Manual_module_handling.
Installation
sudo pacman -S qemu-full libvirt virt-manager virt-viewer dnsmasq virt-install edk2-ovmf swtpm guestfs-tools libosinfo libosinfo-db bridge-utils openbsd-netcat
Packages explanation:
- qemu-full – QEMU emulator for full system virtualization and user-mode emulation
- libvirt – Daemon and tools to manage virtualization platforms (KVM/QEMU)
- virt-manager – GUI for managing virtual machines
- virt-viewer – Lightweight GUI viewer for virtual machines
- dnsmasq – Provides DNS, DHCP, and TFTP services (used by libvirt networking)
- virt-install – CLI tool to create virtual machines
- edk2-ovmf – UEFI firmware for virtual machines
- swtpm – Software TPM (Trusted Platform Module) emulator
- guestfs-tools – Tools for accessing and modifying VM disk images
- libosinfo – Provides OS metadata for automatic configuration
- libosinfo-db – Database of operating systems for libosinfo
- bridge-utils – Tools to configure network bridges (optional if using bridged networking)
- openbsd-netcat – Networking utility used in some VM network setups
If you encounter installation errors, it may be due to outdated mirrors. Update the package database with
sudo pacman -Syyand try again.
Starting and enabling libvirt
sudo systemctl enable --now libvirtd.service
Check status:
systemctl status libvirtd
Enabling default network autostart in libvirt
To enable autostart for the default network:
sudo virsh net-autostart default
After a reboot, you may encounter an error like:
Error starting domain: Requested operation is not valid: network 'default' is not active Traceback (most recent call last): File "/usr/share/virt-manager/virtManager/asyncjob.py", line 67, in cb_wrapper callback(asyncjob, *args, **kwargs) ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/share/virt-manager/virtManager/asyncjob.py", line 101, in tmpcb callback(*args, **kwargs) ~~~~~~~~^^^^^^^^^^^^^^^^^ File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 57, in newfn ret = fn(self, *args, **kwargs) File "/usr/share/virt-manager/virtManager/object/domain.py", line 1446, in startup self._backend.create() ~~~~~~~~~~~~~~~~~~~~^^ File "/usr/lib/python3.13/site-packages/libvirt.py", line 1390, in create raise libvirtError('virDomainCreate() failed') libvirt.libvirtError: Requested operation is not valid: network 'default' is not active
If the network is not running, start it:
sudo virsh net-start default
Note: If Docker is installed, there may be NAT conflicts. Removing Docker often resolves internet connectivity issues for VMs.
Adding your user to the libvirt group
sudo usermod -aG libvirt $USER
After adding the user, log out and log back in, or restart your session.
Check groups:
groups