Skip to content

How to install Virt-Manager Complete Edition

Since its introduction virtualization has come a long way. Nowadays hypervisors are used for almost everything from running enterprise-level servers to testing different operating systems on a local user computer. There are many paid and free hypervisor solutions available in the world.

But in this guide, we are looking at installing one of these best free toolsets used for virtualization and it consists of Virt-Manager, KVM, and QEMU. This guide will show you how to install these tools correctly and with less hassle. Before starting let’s get to know this software a bit better.

What is Virt-Manager?

Virt-Manager is a graphical user front end for the library which provides virtual machine management services. The Virt-manager interface makes it easy for the user to create, delete and manipulate virtual machines without going through the terminal.

Virt-manager mainly supports KVM but it can also work with other hypervisors such as Xen and LXC.

Virt-Manager GUI

When virt-manager is installed it comes with the below-listed toolset.

  • virt-install: Command-line utility to provision OS
  • virt-viewer: The UI interface with graphical features
  • virt-clone: Command-line tool to clone existing inactive hosts
  • virt-xml: Command-line tool for easily editing libvirt domain XML using virt-install’s command-line options.
  • virt-bootstrap: Command tool providing an easy way to set up the root file system for libvirt-based containers.

KVM

The letters KVM stands for Kernel-based Virtual Machines. KVM is a Linux full virtualization solution for x86 architecture processors which has the virtualization extension (Intel VT and AMD-V).

KVM is a free (as free beer) and open-source software. The support for KVM is included in all the new Linux kernels by design.

QEMU

QEMU is the shortened version of Quick EMUlator which is a free open-source emulator that can perform hardware virtualization. It emulates the host machine processor through dynamic binary translation. This provides different sets of hardware and device models for the host machine, which enables it to run a variety of guest systems.

KVM can be used with QEMU which allows virtual machines to be run nearly to native speeds. Not just hardware emulation, QEMU is capable of emulating user-level processors which enable applications compiled for one architecture to run on another.

Installing virt-manager

1. Installing all the packages to run virt-manager.

Basic install:

sudo pacman -S virt-manager libvirt qemu

Full-featured install:

sudo pacman -S --needed virt-manager qemu libvirt edk2-ovmf dnsmasq vde2 bridge-utils openbsd-netcat iptables-nft dmidecode
edk2-ovmf:  ovmf  is an EDK II based project to enable UEFI support for Virtual Machines.
iptables-nft: Linux kernel packet control tool (using nft interface).
bridge-utils:  Ethernet bridge utilities.

2. After installation completes you need to enable libvirtd service.

sudo systemctl enable --now libvirtd.service

3. Check for the status to make sure the service is running.

systemctl status libvirtd.service

The output should look something like below.

○ libvirtd. service - Virtualization daemon
     Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: disabled)
     Active: inactive (dead) since Tue 2021-08-31 20:33:58 +0530; 1h 14min ago
TriggeredBy: ● libvirtd-admin.socket
             ● libvirtd-ro.socket
             ● libvirtd.socket
       Docs: man:libvirtd(8)
             https://libvirt.org
    Process: 21412 ExecStart=/usr/bin/libvirtd $LIBVIRTD_ARGS (code=exited, status=0/SUCCESS)
   Main PID: 21412 (code=exited, status=0/SUCCESS)
      Tasks: 2 (limit: 32768)
     Memory: 18.5M
        CPU: 423ms
     CGroup: /system.slice/libvirtd.service
             ├─982 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
             └─983 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
  1. To use our normal user without entering the root password we need to configure KVM to enable it. This will also enable the libvirt networking components as well without doing this it won’t work.
    • You need to open the libvirt configuration file located at /etc/libvirt/libvirtd.conf. To open you can use your favorite text editor (vi, vim, or nano).
      sudo nano /etc/libvirt/libvirtd.conf
    • Now we need to set UNIX domain socket ownership to libvirt. Scroll down till you see the below line and uncomment it.
      unix_sock_group = 'libvirt'
    • Let’s set the UNIX socket permission to R/W. Scroll down till you see the below line and uncomment it.
      unix_sock_rw_perms = '0770'
    • Add your user account to the libvirt group.
      sudo usermod -a -G libvirt $(whoami) or sudo usermod -a -G libvirt (your user name)
      – `whoami` is a function that put the current user name in the placeholder
    • Now we need to add our user to `qemu.conf`. Otherwise, QEMU will give a `permission denied` error when trying to access local drives. You can use your favourite text editor to edit the file.
      sudo nano /etc/libvirt/qemu.conf
    • Scroll down or search for `user = “root”` or `group = “root”`. Then uncomment both entries and change the root to your user name or ID and then save and exit. Once edited it should look something like below.
  1. You could restart your service, but it’s best to reboot the entire system.
    sudo shutdown -r now

Additional Functionality

Package for extra functionality:

Network:

If Network is disabled after rebooting the host machine and you do not find a way to enable it, you can have it enabled per default from the command line. This will work after rebooting the host:

sudo virsh net-autostart default

libguestfs

If you wish to edit the created virtual machine disk images you can install libguestfs. These are set of tools that allow the user to view and edit files inside guest systems, change VM script changes, monitor disk space, create new guests, P2V, V2V, perform backups, clone VMs, and much more.

To install.

yay -S libguestfs

qemu-arch-extra

Adds additional architecture support to QEMU.

To install.

yay -S qemu-arch-extra

qemu-block-gluster

Glusterfs is a scalable network filesystem. This adds Glusterfs block support to QEMU.

To install.

yay -S qemu-block-gluster

qemu-block-iscsi

iSCI enables storage access via a network. qemu-block-iscsi enables QEMU to block this.

To install.

yay -S qemu-block-iscsi

qemu-block-rbd

It adds the ability to create block device images.

To install.

yay -S qemu-block-rbd

samba

This would add support to SMB/CIFS support to QEMU.

To install.

yay -S samba

Enabling virtio graphics with 3D acceleration

There are several graphical accelerations modes supported by virt-manager.

  • QXL – QXL paravirtual graphic card. It is VGA compatible (including VESA 2.0 VBE support). Works best with QXL guest drivers installed though. Recommended choice when using the spice-protocol.
  • Bochs – The Bochs VGA BIOS supports, to an extent, the VBE specification.
  • Ramfb – A simple frame buffer that lives in guest RAM and is configured via fw_cfg.
  • VGA – Standard VGA card
  • Virtio – Virtio-gpu is a paravirtualized 3d accelerated graphics driver.

When using virtio with 3D acceleration sometimes virt-manager doesn’t work and it throws an error. It’s actually is not virt-manager it’s qemu that’s crashing.

QEMU error when 3D acceleration is on

To use virtio with 3D acceleration, you need to configure virt-manager as shown below.

NOTE: At the time of writing there is an issue when using virtio with 3D acceleration with XFCE DE which leads to guests being a black screen. It is caused by the default xfwm4+compositing compositor. The known workaround is to use ‘QXL’ or virtio without 3D acceleration.

  1. Go to Display Spice and check the Open GL check box and select Auto from the drop-down.
Before configuring
After configuring

2. Now go to Video and select virtio then check the 3D Acceleration checkbox.

After configuring the video options

After configuring like this you can enjoy a fully 3D accelerated guest VM. Also, remember to click on Apply.

Installing virtio guest drivers for Windows

RedHat supplies a set of guest drivers for virtio which covers the graphic drivers for the guest system. You can download the latest drivers from their GitHub page here.

Conclusion

Virt-manager About

Throughout this article, we have covered most of the aspects of how to install and configure virt-manager and KVM. Hope this article helped you to get your own virtual environment up and running. If there are any questions feel free to reach us at the forums or any other contact channel listed below.

Connect with us:

How to install Virt-Manager Complete Edition

  • by
%d bloggers like this: