On 11/23/21 17:25, Elias Mobery wrote:
Hi everyone!
I've built a Debian Live ISO with packages qemu and libvirt to run a VM
in the live environment.
The guest images are placed in /var/lib/libvirt/images and 2GB each.
Everything works great, except for one issue.
When starting a VM, libvirt automatically issues a chown command to the
images, changing ownership.
This results in a copy of the images being created in
/run/live/overlay/rw/var/lib/libvirt/images
I don't want these copies to be made but can't stop it.
I've tried editing qemu.conf user/group, dynamic ownership etc. without
any luck.
Is there a way to STOP libvirt from changing the ownership of these images?
Setting dynamic_ownership=0 in qemu.conf is the way to go (don't forget
to restart the daemon after you made the change).
Alternatively, you can set <seclabel/> either for whole domain or
individual disks, e.g. like this:
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/vm1.qcow2'>
<seclabel relabel='no'/>
</source>
</disk>
or for whole domain:
...
</devices>
<seclabel type='none'/>
</domain>
I'm not sure what your setup is, but if chown() is a problem then what
if guest tries to write onto its disk? Wouldn't that create a copy in
overlay?
Michal