Bug 1728703
Summary: | libvirtd chowns my kernel image to root:root | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Andrew Price <anprice> |
Component: | libvirt | Assignee: | Libvirt Maintainers <libvirt-maint> |
Status: | CLOSED DEFERRED | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 30 | CC: | agedosier, berrange, clalancette, crobinso, itamar, jforbes, laine, libvirt-maint, richard.poettler, veillard, virt-maint, yaneti |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2019-07-11 17:50:53 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Andrew Price
2019-07-10 13:47:32 UTC
Thanks for the report. This is long known suboptimal behavior. You are using the libvirt URI qemu:///system which talks to the system libvirtd instance running as root. But libvirt wants to run VMs as the unprivileged qemu user. So libvirtd will chown all the VM media to qemu:qemu when starting the VM. The problem is, it doesn't have any way[1] to know what the starting owner of the image was, so when the VM shuts down, it chown's the image to root:root There's a lot of ways to work around it by manipulating the file in some way, for exmaple write a wrapper script to copy the kernel you care about to some other location first and have the VM boot from that, so it doesn't mess with the permissions of your built kernel. Or sidestep the issue entirely by using qemu:///session which launches libvirtd and VMs as your UID so it doesn't perform any chowning. More info on that distinction: https://blog.wikichoon.com/2016/01/qemusystem-vs-qemusession.html Because this behavior has been the same for a decade at this point, I'm closing this; a Fedora bug isn't going to effect change here. But feel free to ask follow up questions if necessary [1] libvirt does have some support in the next release for 'remembering' the starting state here, but it's only for r/w media, so it doesn't change anything for kernel/initrd which are readonly. It's possible this behavior will get 'smarter' at some point in the future but Thanks for taking the time to provide a thorough explanation, Cole. That's very useful. I'll give qemu:///session a try. With the bridge helper I think it should work for my use case. |