Replies: 2 comments 2 replies
-
|
AppArmor/sVirt 对路径隔离*导致的问题,而不一定是 Cockpit 克隆逻辑
|
Beta Was this translation helpful? Give feedback.
-
|
Status Update: On Ubuntu 24.04, the standard AppArmor override method (editing The Root Cause: The Confirmed Solutions:
Better solutions still need to be sought |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
1. Summary
When cloning a running/stopped KVM virtual machine via the Cockpit web interface (or
virsh), the new cloned VM fails to start. The error indicates aPermission deniedwhen QEMU attempts to access the disk image located in a non-default directory (/opt/mirrors/...), despite correct file ownership and directory permissions. This suggests an AppArmor profile restriction that is not correctly applied or inherited during the cloning process.2. Environment
Linux ubuntu 6.8.0-90-generic10.0.08.2.2314-1/opt/mirrors/isos/ubuntu/(Not the default/var/lib/libvirt/images)3. Steps to Reproduce
k8s-A-node1_Ubuntu2404) using a cloud image stored in/opt/mirrors/isos/ubuntu/noble-server-cloudimg-amd64_2404.img.-rw-rw-r-- 1 libvirt-qemu kvm ...drwxr-xr-x(all parent dirs including/opt).test) and proceed with cloning.testvia Cockpit or CLI (virsh start test).4. Expected Behavior
The cloned VM should start successfully, accessing the disk image at
/opt/mirrors/...just like the original VM.5. Actual Behavior
The VM fails to start immediately with the following error:
6. Diagnostics & Troubleshooting Performed
We have verified the following, ruling out standard Linux permission issues:
libvirt-qemu:kvm./opt,/opt/mirrors, etc.) haveo+x(execute) permissions./usr.sbin.libvirtdallowing access to/opt/mirrors/**./usr.bin.qemu-system-x86_64allowing access to/opt/mirrors/**.systemctl reload apparmor).7. Hypothesis
It appears that when Libvirt/Cockpit clones a VM, the generated AppArmor profile for the new domain (usually located in
/etc/apparmor.d/libvirt/or dynamically generated) does not correctly include the custom path allowances defined in/etc/apparmor.d/local/, or the cloning process resets the security label context in a way that blocks non-standard paths.8. Request
/optwithout manually moving files?9. Attachments (Logs)
virsh dumpxml test)XML configuration of the failed cloned VM
Beta Was this translation helpful? Give feedback.
All reactions