iso file ownership not restored after usage
Software environment
- Operating system: Linux Ubuntu
- Architecture: x86_64
- kernel version: 6.3.0-7-generic
- libvirt version: 9.6.0
- Hypervisor and version: QEMU emulator version 8.0.2
Issue description
When using libvirt to start guests directly or through virt-manager that .iso files do not change back permissions.
This might be related to (but we do not want to change the default as it makes many many use cases worse doing that):
/etc/libvirt/
# Whether libvirt should dynamically change file ownership
# to match the configured user/group above. Defaults to 1.
# Set to 0 to disable file ownership changes.
#dynamic_
You see the qcow is back from libvirt-qemu:kvm to root:root. But the .iso file is neither on the user, nor on root, instead it seems not changed back at all.
Steps to reproduce
- download ISO
- move the iso to the common path of /var/lib/libvirt/images (retain permissions which will most likely be yourname:users)
- create a guest using that ISO (e.g. in virt-manager)
- libvirt will modify file ownership so that it is actually usable by the guest (as it runs under a restricted user) = Good
- After shutting down the guest libvirt would be expected to turn back the user permissions and it does so for image files, but it seems not for .iso files
Additional information
Example after doing the steps to reproduce:
ls -la /var/lib/libvirt/images
total 4816276
drwx--x--x 2 root root 4096 Jul 30 13:12 .
drwxr-xr-x 7 root root 4096 Jul 30 02:15 ..
-rw-rw-r-- 1 libvirt-qemu kvm 4927586304 Jul 29 19:31 ubuntu-22.04.2-desktop-amd64.iso
-rw------- 1 root root 26847870976 Jul 30 13:12 ubuntu22.04.qcow2