Description of problem: doing: sudo virt-filesystems -a /path/to/a/virtual_hd.vmdk shows errors, instead of partition names. Version-Release number of selected component (if applicable): virt-filesystems 1.28.6 VirtualBox 5.0.8 r103449 Ubuntu 15.04 3.19.0-32-generic #37-Ubuntu x86_64 VM's VHD .qcow How reproducible: I don't know, if it's caused by qcow, or doesn't matter, so, in my case: create a virtualmachine on virtualbox, using qcow VHD, and lauch it. Just in case, I have Ubuntu 15.10 amd64 installed on the VM. Actual results: when VirtualBoxe's VM is launched, I get: libguestfs: error: appliance closed the connection unexpectedly. This usually means the libguestfs appliance crashed. Do: export LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1 and run the command again. For further information, read: http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs You can also run 'libguestfs-test-tool' and post the *complete* output into a bug report or message to the libguestfs mailing list. libguestfs: error: /usr/bin/qemu-system-x86_64 exited with error status 1. To see full error messages you may need to enable debugging. Do: export LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1 and run the command again. For further information, read: http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs You can also run 'libguestfs-test-tool' and post the *complete* output into a bug report or message to the libguestfs mailing list. libguestfs: error: guestfs_launch failed. This usually means the libguestfs appliance failed to start or crashed. Do: export LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1 and run the command again. For further information, read: http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs You can also run 'libguestfs-test-tool' and post the *complete* output into a bug report or message to the libguestfs mailing list. Expected results: /dev/sda1 /dev/sda2 /dev/sda3 /dev/sda6 Additional info: if I do export LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1, it gives me exactly the same message, I even diffed both messages to make sure. --- Closing VirtualBox VM fixes the problem.
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.