Bug 1277744
| Summary: | When VirtualBox is running, libguestfs fails with ioctl(KVM_CREATE_VM) failed: 16 Device or resource busy | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Community] Virtualization Tools | Reporter: | igoryonya | ||||||
| Component: | libguestfs | Assignee: | Richard W.M. Jones <rjones> | ||||||
| Status: | NEW --- | QA Contact: | |||||||
| Severity: | medium | Docs Contact: | |||||||
| Priority: | unspecified | ||||||||
| Version: | unspecified | CC: | igoryonya, ptoscano | ||||||
| Target Milestone: | --- | Keywords: | Reopened | ||||||
| Target Release: | --- | ||||||||
| Hardware: | x86_64 | ||||||||
| OS: | Linux | ||||||||
| Whiteboard: | |||||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||||
| Doc Text: | Story Points: | --- | |||||||
| Clone Of: | Environment: | ||||||||
| Last Closed: | 2025-10-17 00:10:24 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: | |||||||||
| Attachments: |
|
||||||||
|
Description
igoryonya
2015-11-04 00:12:20 UTC
Please run: sudo virt-filesystems -v -x -a /path/to/a/virtual_hd.vmdk 2>&1 | tee virt-filesystems.log and attach to this bug the resulting virt-filesystems.log you get. Enabling debug and verbosity will not cause virt-filesystems to work while it didn't without, but at least we can see what's the actual issue in this case. Created attachment 1241525 [details]
When no VirtualBox VMs with vmdk disk is running
virt-filesystems works wnen no VirtualBoxe's VM is running with qcow/qcow2 or vmdk VHD.
Created attachment 1241526 [details]
When VirtualBox VMs with vmdk disk is running
virt-filesystems doesn't work, wnen VirtualBoxe's VM is running with qcow/qcow2 or vmdk VHD.
I've added 2 attachments of logs from running those commands: /tmp/virt-filesystems.log - is when no VB's VM is running with vmdk/qcow/qcow2 disk in it. /tmp/virt-filesystems-vb.log - is when VB's VM is running with vmdk/qcow/qcow2 disk in it. P.S. VBoxe's VM can have any OS, installed in it. As long as I attach a vmdk/qcow/qcow2 disk to it, the virt-filesystems reveals it's problem. I am running Ubuntu 16.04 now with kernel: 4.4.0-57-generic x86_64 virt-filesystems 1.32.2 VirtualBox V5.0.20 r106931 The error is: ioctl(KVM_CREATE_VM) failed: 16 Device or resource busy failed to initialize KVM: Device or resource busy Back to tcg accelerator. qemu-system-x86_64: CPU model 'host' requires KVM This is unfortunate, but it's a real (and very long-standing) bug in qemu. The workaround is to set: export LIBGUESTFS_BACKEND_SETTINGS=force_tcg which forces libguestfs to use software emulation. You only need to use this when using VirtualBox (and also note that it'll make libguestfs run a lot slower). The actual reason why this is happening is best explained by pointing to the comment in the libguestfs code: https://github.com/libguestfs/libguestfs/blob/dd519e8a8ea2be89862f3cec99aff9e19c458afa/src/appliance-cpu.c#L64-L66 I filed a qemu RFE about this: https://bugs.launchpad.net/qemu/+bug/1657010 So, meanwhile, I can probably put it in a rough script, like that, I guess: var_vbproc=$(pgrep -f '/virtualbox/VirtualBox.*--startvm\>'|wc -l) if [ "$var_vbproc" -gt 0 ]; then export LIBGUESTFS_BACKEND_SETTINGS=force_tcg fi virt-filesystems $1 $2 $3 $4 $5 $6 $7 $8 $9 if [ "$var_vbproc" -gt 0 ]; then export LIBGUESTFS_BACKEND_SETTINGS='' fi It worked and I am not very good at bash. Shortly after testing this script, I realized, that exported variable lives only during script's execution, so, I've simplified it a bit (unfortunately, I cannot edit the previous comment):
if [ "$(pgrep -f '/virtualbox/VirtualBox.*--startvm\>'|wc -l)" -gt 0 ]; then
export LIBGUESTFS_BACKEND_SETTINGS='force_tcg'
fi
virt-filesystems $1 $2 $3 $4 $5 $6 $7 $8 $9
I suspect that the fix for bug 1605071 which went upstream in around Sept 2018 has also fixed this. This product has been discontinued or is no longer tracked in Red Hat Bugzilla. Reopening because Virtualization Tools has not been discontinued. |