Page 1 of 1

Virtualization with KVM: virt-manager

PostPosted: Oct 9th, '17, 08:33
by inktvis75
The virt-manager tool to manage KVM virtual machines is maybe not winning a price for his graphical design, it's a very useful and powerful piece of software.

To install it:

Code: Select all
sudo dnf install virt-manager

It will automatically pull all dependencies such as qemu-kvm

After that you have to enable the libvirt daemon at boot time:

Code: Select all
sudo systemctl enable libvirtd

Start this daemon with:

Code: Select all
sudo systemctl start libvirtd

As a normal user you don't have the right permissions to do anything, and it's difficult to get them.
First add yourself to the kvm group:

Code: Select all
usermod -aG kvm <user name>

and create a file /etc/polkit-1/rules.d/50-libvirt.rules with the following content:

Code: Select all
/* Allow users in kvm group to manage the libvirt
daemon without authentication */
polkit.addRule(function(action, subject) {
    if ( == "org.libvirt.unix.manage" &&
        subject.isInGroup("kvm")) {
            return polkit.Result.YES;

Logout, and you are ready to create virtual machines

Re: Virtualization with KVM: virt-manager

PostPosted: Oct 10th, '17, 09:09
by doktor5000
Hi there, at first thanks for sharing.

Just a few hints - please do not assume that people have sudo installed and preconfigured.
Also dnf was only introduced in Mageia 6 and this would not work on Mageia 5, whereas urpmi works for both.
And you should also mention at least that virt-manager is just a graphical frontend to libvirt and to qemu, it can't do anything on its own.

Re: Virtualization with KVM: virt-manager

PostPosted: Oct 10th, '17, 11:01
by inktvis75
Thank you for your reply,
i am new in Mageia, and of course new to the Wiki as well.

I updated the article in the wiki, replaced sudo with su and for the systemctl commands: let polkit take care of it :)

Re: Virtualization with KVM: virt-manager

PostPosted: Oct 10th, '17, 14:09
by Bequimao

I started with openSUSE and have a different setup in Mageia 6. My user is part of a group libvirt.
I never started any systemd unit manually, and also did not modify any policykit or Shorewall rule.
The Virtual Machines and isos are owned by root.

Code: Select all
[root@localhost ~]# cat /etc/group | egrep 'libvirt|qemu|kvm'
[root@localhost ~]#
[root@localhost ~]# systemctl list-units | egrep 'libvirt'
libvirt-guests.service                                                                          loaded active exited    Suspend/Resume Running libvirt Guests
libvirtd.service                                                                                loaded active running   Virtualization daemon
[root@localhost ~]#

Best regards,

Re: Virtualization with KVM: virt-manager

PostPosted: Oct 10th, '17, 14:31
by inktvis75
There are more ways to configure it.
My fresh Mageia installation, after installing libvirtd doesn't contain a libvirt group,
that's why I used the existing kvm group and created a policy.

Re: Virtualization with KVM: virt-manager

PostPosted: Jul 23rd, '19, 11:45
by Bequimao
Retested now in Mageia 7

Create a system group libvirt.
Code: Select all
# groupadd --system libvirt

Assign your user to it
Code: Select all
# usermod -aG libvirt <user-name>

This also could be implemented in MCC. System groups have group IDs lower than 1000.

The Virtual Machines are owned by root. The isos and paths should be readable by group qemu.
If you want to run a Qemu/KVM user session, uncomment these lines in /etc/libvirt/libvirtd.conf

Code: Select all
unix_sock_group = "libvirt"
unix_sock_rw_perms = "0770"

Reference ... tation-30/

Best regards,