QEMU and KVM in Arch Linux

KVM (Kernel-based Virtual Machine) is the native Virtualization System from RedHat; is a hypervisor built directly into the Linux kernel. The same system is also found in RedHat-derived distributions: CentOS, Scientific Linux, Oracle Linux or Fedora. KVM offers the ability to create and manage a lot of virtual machines on a single web host server that has one of the above mentioned distributions installed. Virtualization setups like this provide efficient environmental isolation. For a deeper breakdown of isolation types, you can read our comparison on LXC versus KVM to understand how kernel-level hypervisors stack up against container virtualization. Currently, KVM is the most common form of virtualization for web hosting companies.

Key Points

  • KVM is a native, kernel-level hypervisor offering high-performance virtualization.
  • QEMU acts as the emulator utilizing KVM extensions to achieve near-native execution speeds.
  • Hardware virtualization (VT-x or AMD-V) must be enabled in the BIOS/UEFI before installation.
  • Configuring the libvirtd daemon allows non-root users to manage virtual environments safely.

QEMU is a virtual machine emulator that uses the KVM hypervisor and uses process extensions (HVM) to run virtual machines, achieving performances that can be compared with the ones of the real system, and that’s because a big part of the code runs directly on the web host machine’s processor.

This short guide is for those who have installed the Arch Linux distribution and want to use KVM instead of Virtualbox. Managing these cutting-edge virtualization configurations requires familiarity with standard system definitions; if you are new to this ecosystem, it might be helpful to review our guide on Arch Linux terminology to get up to speed with core OS components.

How to Perform Checking the KVM Support?

KVM requires the web host system’s processor to support virtualization (VT-x for Intel processors and AMD-V for AMD processors). To verify that our process supports virtualization, run the command:

lscpu | grep Virtualization

or

egrep --color=auto 'vmx|svm|0xc0f' /proc/cpuinfo

The answer to the two commands should look like below:

Virtualization: VT-x

or

flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflus h dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_g ood nopl cpuid aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm xsave lahf_lm tpr_shadow vnmi flexpriority dtherm

If nothing is displayed, it means that your processor is not capable of running KVM (or you do not have the virtualization support enabled in BIOS).

You can check if the required modules are available in the kernel with the following command:

zgrep CONFIG_KVM /proc/config.gz

The answer should be (modules are available if they are marked with y or m):

CONFIG_KVM_GUEST=y
# CONFIG_KVM_DEBUG_FS is not set
CONFIG_KVM_MMIO=y
CONFIG_KVM_ASYNC_PF=y
CONFIG_KVM_VFIO=y
CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT=y
CONFIG_KVM_COMPAT=y
CONFIG_KVM=m
CONFIG_KVM_INTEL=m
CONFIG_KVM_AMD=m
CONFIG_KVM_MMU_AUDIT=y

Verify that the modules are automatically loaded from the kernel:

$ lsmod | grep kvm
kvm_intel 221184 0
kvm 626688 1 kvm_intel
irqbypass 16384 1 kvm

Otherwise, they must be loaded manually using the modprobe command:

modprobe kvm_intel

How to Complete Installing QEMU in Arch Linux?

With KVM support available, we need QEMU to create and manage virtual machines. The qemu package is installed using the standard pacman package manager.

sudo pacman -Syu qemu

Unlike VirtualBox or VMware, QEMU does not provide graphical interface by default, so we need to install the following package:

sudo pacman -Syu virt-manager

We start the libvirtd service and let it boot:

sudo systemctl enable --now libvirtd

We check its status (it must be active):

sudo systemctl status libvirtd

If we try to start the Virtual Machine Manager menu, we are asked for the root password.

How to Configure Using Virtual Machine Manager (virt-manager) as a Non-Root User?

1. We will check if the libvirt group exists:

$ getent group | grep libvirt
libvirt:x:613:mvps

If it does not already exist in the system, we will create this group with the following command (where 7777 is the group ID):

# groupadd -g 7777 libvirt

2. Add our user to the libvirt group:

# usermod -aG libvirt username

Check if our user has been added to this group:

$ sudo id mvps | grep libvirt

3. Edit the libvirtd.conf configuration file:

sudo vi /etc/libvirt/libvirtd.conf

and add the following two lines at the end:

unix_sock_group = "libvirt"
unix_sock_rw_perms = "0770"

4. Restart the service:

sudo systemctl restart libvirtd

Logout and then Login to system

We launch Virtual Machine Manager either from the menu or from the command line:

$ virt-manager

Now we have qemu kvm arch linux environments configured and operational.

You can also install additional packages to ensure the network connectivity (required for non-rpm distributions such as Arch Linux):

  • ebtables and dnsmasq for the default NAT/DHCP network
  • bridge-utils can create bridge networks
  • openbsd-netcat for remote SSH management.

Frequently Asked Questions about KVM and QEMU on Arch Linux

What is the difference between QEMU and KVM on Arch Linux?
KVM is a kernel-based module that turns Linux into a bare-metal hypervisor, while QEMU is the user-space software emulator that mimics hardware components. Together, they allow near-native performance for virtual machines.
Why does virt-manager prompt for root access?
By default, the libvirtd daemon requires administrative privileges. To manage VMs as a non-root user, you must create a libvirt user group, add your active user account to it, and update the socket permissions in your libvirtd.conf configuration file.
What network packages are recommended for KVM on non-RPM distributions?
For robust virtual networking on Arch Linux, it is highly recommended to install ebtables and dnsmasq for default NAT/DHCP network routing, bridge-utils for creating bridged network interfaces, and openbsd-netcat for secure remote SSH infrastructure management.

About the author

Ilias spiros
By Ilias spiros

Categories