Virt-Manager

From ArchWiki

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: This article is fairly new and thus not complete further expansion is highly appreciated. (Discuss in Talk:Virt-Manager)

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

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

Installation

Install virt-manager qemu-desktop libvirt edk2-ovmf dnsmasq iptables-nft.

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: Virt-Manager also supports QEMU/KVM user sessions which do not require manually starting/enabling any units. (Discuss in Talk:Virt-Manager)

Enable/start the libvirtd.service.

You can check the unit status to make sure the service is running.

Configuration

To use as a normal user without root we need to configure KVM, this will also enable the libvirt networking components.

Set the UNIX domain socket ownership to libvirt and the UNIX socket permission to read and write.

/etc/libvirt/libvirtd.conf
...
unix_sock_group = 'libvirt'
...
unix_sock_rw_perms = '0770'
...

Add your user to the libvirt user group.

Add your user to /etc/libvirt/qemu.conf. Otherwise, QEMU will give a permission denied error when trying to access local drives.

Search for user = "libvirt-qemu" or group = "libvirt-qemu", uncomment both entries and change libvirt-qemu to your user name or ID. Once edited it should look something like below.

/etc/libvirt/qemu.conf
# Some examples of valid values are:
#
#       user = "qemu"   # A user named "qemu"
#       user = "+0"     # Super user (uid=0)
#       user = "100"    # A user named "100" or a user with uid=100
#
user = "username"

# The group for QEMU processes run by the system instance. It can be
# specified in a similar way to user.
group = "username"

Restart libvirtd.service.

Once the service has been restarted, upon opening Virt-Manager, it will default to the system variant (root) of the QEMU connection. This can be changed to the user connection by going to:File < Connection < Add New Connection

Now select QEMU/KVM User session as the Hypervison and click OK. This will now auto-connect to the user session. You can now disconnect and remove the system connection.