Arch Linux KVM

Install and Configure KVM in ArchLinux

KVM stands for Kernel-based Virtual Machine. This software allows users to run multiple virtual machines with different operating systems, thus bypassing the need to follow more conventional means of using Virtualbox. KVM is free, open-source, and has been refined and improved over the last ten years.

This article shows you how to install and configure KVM on your ArchLinux system.

Part 1: Installing KVM

The installation procedure for KVM is a bit complicated, as you must first check the system for the necessary prerequisites.

Step 1: Check for Virtualization Support

To check whether virtualization is enabled on your PC, issue the following command:

$ LC_ALL=C lscpu | grep Virtualization

The hardware specs to run KVM is VT-x for Intel processors and AMD-V for AMD processors. As such, if your system has the hardware to create virtual machines, you will see the following within the text you are displayed:

Virtualization: VT-x
Virtualization: AMD-V

If neither of these is displayed, it means that either your system cannot support virtualization, or it is disabled on the machine by the developers. If that is the case, you can enable virtualization upon restarting your system and entering the BIOS.

Step 2: Search for Kernel Module

To see whether your system has the kernel module to run KVM, enter the following command:

$ zgrep CONFIG_KVM /proc/config.gz

If you are using an AMD processor, you should see CONFIG_KVM_AMD (or CONFIG_KVM_INTEL if you are using intel) followed by =y or =m, then you are good to go.

Step 3: Install KVM for ArchLinux

Fire up the terminal and run the following code for a direct install of KVM:

$ sudo pacman -S virt-manager qemu vde2 ebtables dnsmasq bridge-utils openbsd-netcat

This should install KVM on your system.

Step 4: Activate and Launch KVM

Issue the following command to activate KVM:

$ sudo systemctl enable libvirtd.service

Next, enter the following:

$ sudo systemctl start libvirtd.service

Then, go to /applications and launch the VM manager.

Part 2: Configuring KVM

To continue using KVM with your standard Linux account, you can do so by modifying the libvirtd.conf file. Access the file by entering the following:

$ sudo pacman -S vim
$ sudo vim /etc/libvirt/libvirtd.conf

Between line 80-90, there should be the term “lineabout unix_sock_group.” You will change this to libvirt.

# unix_sock_group = "libvirt"

Jump to the lines between 100-110 and change the unix_sock_rw_perms to = 0770

# unix_sock_rw_perms = "0770"

Then, issue the following code to include your standard Linux account with libvirt.

$ sudo usermod -a -G libvirt $(whoami)

$ newgrp libvirt

Reboot the libvirt service to apply changes. To do so, issue the following code:

$ sudo systemctl restart libvirtd.service

You can now use your Linux account to use KVM.

To create virtual machines within a virtual machine, enable Nested Virtualization by entering the following:

$ sudo modprobe -r kvm_intel
$ sudo modprobe kvm_intel nested=1

To apply these changes, enter:

$ echo "options kvm-intel nested=1" | sudo tee /etc/modprobe.d/kvm-intel.conf


This tutorial covered the installation and configuration of KVM on ArchLinux systems. If you have followed the instructions properly, you should have KVM set up on your system and ready to run Virtual Machines.

About the author

Younis Said

Younis Said

I am a freelancing software project developer, a software engineering graduate and a content writer. I love working with Linux and open-source software.