How do I move my VM's from root to a user

Pavel Hrdina phrdina at redhat.com
Tue Jul 7 08:37:06 UTC 2020


On Mon, Jul 06, 2020 at 04:04:06PM -0700, ToddAndMargo wrote:
> Hi All,
> 
> Fedora 32, x64
> qemu-kvm-4.2.0-7.fc32.x86_64
> 
> Since I have figure out how to run virt-manager as a
> user without having to hassle with the pol kit prompt,
> I would like to move my virtual machines out of
> root (or wherever the are) and into a particular user.
> 
> I can start virt-manager as a user, but all my VM
> are missing.
> 
> How to do migrate all my vm's from root to a user?

Hi,

It's not that simple. virt-manager uses libvirt to manage virtual
and for QEMU/KVM there are two ways of running VMs using different
connections.

Usually the main one is qemu:///system connection which connects to
a libvirt daemon running under root user. For this connection you need
to configure which other users on the system except for root can use it.
By default it polkit will ask you to provide password, but you can
create a polkit rule file which will allow you to use the system
connection without password. Libvirt already provides some default
polkit rule which allows all users that are in 'libvirt' group to access
the system connection.

The other connection qemu:///session works a bit differently, the
libvirt daemon is started as the same user that used this connection
which implicates some limitations with networking, attaching host
devices into the VM and other tasks that would require root permissions.

So for your use-case I would not move the VMs into the qemu:///session
connection for your user but I would add your user to 'libvirt' group.
In addition you need to make sure that in virt-manager you have
configured 'QEMU/KVM' connection which should use qemu:///system as
Libvirt URI instead of the 'QEMU/KVM User session' which uses
qemu:///session as Libvirt URI.

Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20200707/22e61544/attachment.sig>


More information about the virt-tools-list mailing list