libvirt – KVM Qemu

Libvirt (license LGPL, is one of the best and most flexible virtual machine environments. A graphic frontend for libvirt is the tool Virt-Manager. It can manage your virtual machines e.g. on a KVM/qemu server.

Interestingly there is a 3D driver in development called VirGL, it will use the host GPU and is not a complete GPU pass-trough.


Based on you need to do the following base setup to get libvirt up and running on a host machine.

$ sudo pacman -Sy libvirt qemu dnsmasq ebtables bridge-utils openbsd-netcat qemu-block-gluster

As defined in /etc/libvirt/qemu.conf and /etc/libvirt/libvirtd.conf defaults to nobody, libvirt and kvm, replace USERNAME with your user.

$ sudo gpasswd -a USERNAME libvirt
$ sudo gpasswd -a nobody kvm

Then uncomment or comment the following lines in libvirtd.conf like in the example below.

$ sudo nano /etc/libvirt/libvirtd.conf
 unix_sock_group = "libvirt"
 unix_sock_ro_perms = "0770"
 unix_sock_rw_perms = "0770"
 auth_unix_ro = "none"
 auth_unix_rw = "none"
 #listen_tls = 0
 #listen_tcp = 1
$ sudo nano /etc/conf.d/libvirtd
$ systemctl enable libvirtd.service
$ systemctl start libvirtd.service

Then reboot or logout and login again.

Host and VM direct network

Read Bridge Network – Connect Host with VM

Libvirt on Btrfs

Before creating a new virtual machine, make sure to disable the copy on write feature on a Btrfs file system so that it behaves like a traditional file system and directly modifies files without creating a copy first:

sudo chattr +C -R /var/lib/libvirt/images

If files are created in that directory already, move them to first to another directory and then copy them again into this folder so that they get the +C added as well. you can see the actual attributes with this command:

sudo lsattr /var/lib/libvirt/images


Virt-Manager (license GPLv3+, is a good tool to manage local and remote virtual machines on a Qemu/KVM on libvirt.

sudo pacman -Sy virt-manager

If you have issues on KDE with ksshaskpass remembering passwords, run:

sudo ln -s /usr/bin/ksshaskpass /usr/lib/ssh/ssh-askpass

Virt-Manager runs directly on Wayland.

Sadly Qt-Virt-Manager (, GPLv2) development seems to be stalled, so there is no usable Qt version available. If you want, you can install it from AUR for testing. It runs natively on Wayland:

yay qt-virt-manager

It works, but the qt5-remote–viewer doesn’t show any content, see bug

Virt-Manager Unknown Disk Format

If you create in Virt-Manager a pool and it doesn’t work as of unknown format, then do it via the console. Example:

sudo virsh pool-define-as sdf disk - - /dev/sdf - /dev

Check, edit and compare to other pools, e.g. make sure the format type is gpt.

sudo virsh pool-edit sdf

Then you can start the partition in Virt-Manager and you can enable auto start if you want.

Serial Console


Additionally to Virt-Manager you can use Cockpit to manage virtual machines, read Cockpit – Server Monitoring & Management.

Qemu 4.1

Qemu 2.12 deprecated GTK2 and SDL1 in favor of GTK3 and SDL2.

To use UEFI boot you must define it before creating the new virtual machine. Click on “Edit configuration before installation” and then select in the field firmware “”.


OVMF is the Tianocore open source UEFI firmware for qemu. It allows you to replace the grub with systemd-boot. At the boot you should see then the white Tianocore logo indicating UEFI support. As always, booting with UEFI is slower, the Tianocore needs 3 seconds for initialization, Linux needs less time to boot to a console.

$ sudo pacman -Sy ovmf
$ sudo nano /etc/libvirt/qemu.conf 
nvram = [ "/usr/share/ovmf/x64/OVMF_CODE.fd:/usr/share/ovmf/x64/OVMF_VARS.fd" ]

Skip Bootloader

Cloned VM

If you have cloned a virtual machine (or copied the image), the following steps are recommended to get a unique system:

  • Change hostname in /etc/hostname
  • Check /etc/fstab for not existing or changed devices
  • Check /etc/crypttab
  • Check with ip a if your new machine uses IPv6, if yes make sure that the locally assigned IP address is unique on your local network. I got some /128 noprefixroute duplicate addresses, this can be fixed by assigning a new machine id:
rm -f /etc/machine-id
dbus-uuidgen --ensure=/etc/machine-id
rm /var/lib/dbus/machine-id
dbus-uuidgen --ensure

For more details read:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.