Here is the Complete guide on how to install KVM, QEMU and Virt Manager on Arch Linux and Manjaro. KVM is one of the most used Virtualization software in Linux World. In fact, most cloud providers use KVM as their Hypervisor of choice. Big projects including Openstack use KVM as default Virtualization tool.

In this tutorial, we’ll install KVM on Arch Linux and set Kernel modules required to automatically load at boot. We’ll also install a guest machine running CentOS 7.

Our previous tutorials on KVM include:

Step 1: Install KVM packages

First step is installing all packages needed to run KVM:

sudo pacman -Syy
sudo pacman -S archlinux-keyring
sudo pacman -S qemu virt-manager virt-viewer dnsmasq vde2 bridge-utils openbsd-netcat dmidecode

Also install ebtables  and iptables packages:

sudo pacman -S ebtables iptables

Step 2: Install libguestfs on Arch / Manjaro

libguestfs is a set of tools used to access and modify virtual machine (VM) disk images. You can use this for:

  • viewing and editing files inside guests
  • scripting changes to VMs
  • monitoring disk used/free statistics
  • creating guests
  • P2V
  • V2V
  • performing backup e.t.c
sudo pacman -S libguestfs

Step 3: Start KVM libvirt service

Once the installation is done, start and enable libvirtd service to start at boot:

sudo systemctl enable libvirtd.service
sudo systemctl start libvirtd.service

Status show it’s running:

systemctl status libvirtd.service

Step 4: Allow Libvirt for standard user accounts

Since we want to use our standard Linux user account to manage KVM, let’s configure KVM to allow this.

Open the file /etc/libvirt/libvirtd.conf for editing.

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

Set the UNIX domain socket group ownership to libvirt, (around line 85)

unix_sock_group = "libvirt"

Set the UNIX socket permissions for the R/W socket (around line 102)

unix_sock_rw_perms = "0770"

Add your user account to libvirt group.

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

Restart libvirt daemon.

sudo systemctl restart libvirtd.service

Step 5: Enable Nested Virtualization (Optional)

Nested Virtualization feature enables you to run Virtual Machines inside a VM. Enable Nested virtualization for kvm_intel / kvm_amd by enabling kernel module as shown.

### Intel Processor ###
sudo modprobe -r kvm_intel
sudo modprobe kvm_intel nested=1

### AMD Processor ###
sudo modprobe -r kvm_amd
sudo modprobe kvm_amd nested=1

To make this configuration persistent,run:

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

Confirm that Nested Virtualization is set to Yes:

### Intel Processor ###
$ systool -m kvm_intel -v | grep nested
    nested              = "Y"
    nested_early_check  = "N"
$ cat /sys/module/kvm_intel/parameters/nested 
Y

### AMD Processor ###
$ systool -m kvm_amd -v | grep nested
    nested              = "Y"
    nested_early_check  = "N"
$ cat /sys/module/kvm_amd/parameters/nested 
Y

Step 6: Using KVM on Arch Linux / Manjaro

You have successfully installed KVM, QEMU and Virt Manager on Arch Linux and Manjaro. You are now good to go. You can install a Linux or Windows OS Virtual Machine and build your study labs.

install kvm arch linux manjaro

Recommended Linux Books  to read:

Here are our few guides to get you started

Other interesting guides.

24 COMMENTS

  1. thanks for the guide — very helpful
    — i just wanted to note that it refers to using yaourt — which is no longer available
    I chose to use yay after a google search — but thought you might want to update the instructions to your current preference.

  2. libguestfs seems to have been moved from aur to the community repository, there is no need to access aur for this install as far as I can tell

  3. How do we install KVM and not use QEMU? i want the full kernel level performance and manage my VM’s via something other than QEMU due to the potential performance hit of the layer 2 HyperVisor that is QEMU

  4. This article is only for intel processors… if you use AMD then replace all instances of kvm_intel with kvm_amd… Please change the article to reflect both or use a known $variable to make this an easy work around for copy/paste users

  5. change
    sudo vim /etc/libvirt/libvirtd.conf
    to
    sudo “your favorite editor” /etc/libvirt/libvirtd.conf e.g. sudo nano /etc/libvirt/libvirtd.conf
    not everyone knows how to use vim/vi

  6. Finally a complete guide for Manjaro system.
    Thanks to this I’ve succesully installed it on my system.
    The only think that I’ve not installed is

    sudo pacman -S ebtables iptables
    I’ve leaved the ones installed by default from Manjaro.

    All works good.. bye bye virtualbox

  7. Hi, Josphat, thanks for the tutorial!
    BTW, is it possible to install a Windows OS (win 10 or win 11) in KVM on Linux? If yes, how to do that? THX!

  8. Great tutorial, but it wasn’t working as expected for me. After rebooting, virt-manager wouldn’t connect unless I restarted libvirtd.service. Then I noticed an error in journalctl about dmidecode being missing. After running pacman -S dmidecode, it’s working as expected. If you can, might want to update your guide to mention needing to install this package.

  9. These lines should not be passed as super user:

    sudo systemctl enable libvirtd.service
    sudo systemctl start libvirtd.service

    Also on Manjaro kvm is automatically configured for your processor, thus making these lines redundant:

    ### Intel Processor ###
    sudo modprobe -r kvm_intel
    sudo modprobe kvm_intel nested=1

    ### AMD Processor ###
    sudo modprobe -r kvm_amd
    sudo modprobe kvm_amd nested=1

    Other than that it all worked like a charm so thanks!

LEAVE A REPLY

Please enter your comment!
Please enter your name here