Virt-manager

From ArchWiki

This article or section needs expansion.

Reason: This article is missing detail, 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 mainly supports KVM but it can work with other hypervisors, such as Xen and LXC.

Installation

First follow the page for either Libvirt or Linux Containers and ensure you can create virtual machines then Install the virt-manager package.

To use an LXC connection enable/start the libvirtd.service unit.

To use a QEMU connection enable/start the libvirtd.socket unit.

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

Configuration

Basic configuration

Add yourself to the libvirt user group.

It is also a good idea to ensure that any files/folders outside of Virt-managers default pool are owned by the libvirt-qemu group, otherwise you might encounter permission errors when accessing files outside of the default pool.

# chown $USER:libvirt-qemu /path/to/vm/folder
Tip: There are other ways to solve this issue, if you forget then Virt-manager will ask for permission to change these settings for you.

Non root KVM without Socket

Note: Enabling the systemd socket overrides this, only do this if you don't want to enable the socket

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 by changing the following:

/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"

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 > Add Connection.

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

Networking

Note:
  • The virt-manager article focuses on using virt-manager and libvirt in user session, which has limited networking capabilities (see libvirt FAQ for details). There are more networking possibilities when using the system variant (root).
  • Also look at libvirt in case of networking issues.

To use a network bridge in user session it has to be setup in libvirt system administration first.

For this the libvirt daemon must be running.

When it is started successfully, the system variant (root) of the QEMU connection can be opened in virt-manager. Setup the bridge with the desired settings in the networking tab there.

To be able to use the bridge in a user session virtual machine, setup the qemu-bridge-helper according to your bridge setup .

After that the bridge can be used at a virtual network that runs in virt-manager user session.

See also