<div dir="ltr"><div>Thanks for your response Rich. Please see the output of --trace --verbose below. Regarding your suggestion to convert the vmdk to some other format, I do not want to do it. A security consultant said by modifying certain files in our VM and restarting the VM, one can gain access to encrypted data in our VM. I want to reproduce it. I am able to mount the VM but not able to modify files since it can be mounted with --ro option only.</div><div><br></div><div>:~$ guestmount --trace --verbose --rw -a agent-disk1.vmdk -i /mnt/vmdk</div><div>libguestfs: trace: set_verbose true</div><div>libguestfs: trace: set_verbose = 0</div><div>libguestfs: trace: set_recovery_proc true</div><div>libguestfs: trace: set_recovery_proc = 0</div><div>libguestfs: trace: add_drive "agent-disk1.vmdk"</div><div>libguestfs: trace: add_drive = 0</div><div>libguestfs: trace: launch</div><div>libguestfs: trace: get_tmpdir</div><div>libguestfs: trace: get_tmpdir = "/tmp"</div><div>libguestfs: trace: version</div><div>libguestfs: trace: version = <struct guestfs_version *></div><div>libguestfs: trace: get_backend</div><div>libguestfs: trace: get_backend = "direct"</div><div>libguestfs: launch: program=guestmount</div><div>libguestfs: launch: version=1.24.5</div><div>libguestfs: launch: backend registered: unix</div><div>libguestfs: launch: backend registered: uml</div><div>libguestfs: launch: backend registered: libvirt</div><div>libguestfs: launch: backend registered: direct</div><div>libguestfs: launch: backend=direct</div><div>libguestfs: launch: tmpdir=/tmp/libguestfsanpm0b</div><div>libguestfs: launch: umask=0002</div><div>libguestfs: launch: euid=1000</div><div>libguestfs: command: run: /usr/bin/supermin-helper</div><div>libguestfs: command: run: \ --verbose</div><div>libguestfs: command: run: \ -f checksum</div><div>libguestfs: command: run: \ --host-cpu x86_64</div><div>libguestfs: command: run: \ /usr/lib/guestfs/supermin.d</div><div>supermin helper [00000ms] whitelist = (not specified)</div><div>supermin helper [00000ms] host_cpu = x86_64</div><div>supermin helper [00000ms] dtb_wildcard = (not specified)</div><div>supermin helper [00000ms] inputs:</div><div>supermin helper [00000ms] inputs[0] = /usr/lib/guestfs/supermin.d</div><div>supermin helper [00000ms] outputs:</div><div>supermin helper [00000ms] kernel = (none)</div><div>supermin helper [00000ms] dtb = (none)</div><div>supermin helper [00000ms] initrd = (none)</div><div>supermin helper [00000ms] appliance = (none)</div><div>checking modpath /lib/modules/3.13.0-74-generic is a directory</div><div>picked kernel vmlinuz-3.13.0-74-generic</div><div>supermin helper [00000ms] finished creating kernel</div><div>supermin helper [00000ms] visiting /usr/lib/guestfs/supermin.d</div><div>supermin helper [00001ms] visiting /usr/lib/guestfs/supermin.d/base.img</div><div>supermin helper [00003ms] visiting /usr/lib/guestfs/supermin.d/daemon.img.gz</div><div>supermin helper [00003ms] visiting /usr/lib/guestfs/supermin.d/hostfiles</div><div>supermin helper [00199ms] visiting /usr/lib/guestfs/supermin.d/init.img</div><div>supermin helper [00200ms] visiting /usr/lib/guestfs/supermin.d/udev-rules.img</div><div>supermin helper [00201ms] adding kernel modules</div><div>supermin helper [00667ms] finished creating appliance</div><div>libguestfs: checksum of existing appliance: c15e020bda105b5ca562616e2edac3c65917bbbd9fb9954efe3d92e697a583a1</div><div>libguestfs: trace: get_cachedir</div><div>libguestfs: trace: get_cachedir = "/var/tmp"</div><div>libguestfs: trace: get_cachedir</div><div>libguestfs: trace: get_cachedir = "/var/tmp"</div><div>libguestfs: [00675ms] begin building supermin appliance</div><div>libguestfs: [00675ms] run supermin-helper</div><div>libguestfs: command: run: /usr/bin/supermin-helper</div><div>libguestfs: command: run: \ --verbose</div><div>libguestfs: command: run: \ --copy-kernel</div><div>libguestfs: command: run: \ -f ext2</div><div>libguestfs: command: run: \ --host-cpu x86_64</div><div>libguestfs: command: run: \ /usr/lib/guestfs/supermin.d</div><div>libguestfs: command: run: \ --output-kernel /var/tmp/guestfs.l3Pqvn/kernel</div><div>libguestfs: command: run: \ --output-initrd /var/tmp/guestfs.l3Pqvn/initrd</div><div>libguestfs: command: run: \ --output-appliance /var/tmp/guestfs.l3Pqvn/root</div><div>supermin helper [00000ms] whitelist = (not specified)</div><div>supermin helper [00000ms] host_cpu = x86_64</div><div>supermin helper [00000ms] dtb_wildcard = (not specified)</div><div>supermin helper [00000ms] inputs:</div><div>supermin helper [00000ms] inputs[0] = /usr/lib/guestfs/supermin.d</div><div>supermin helper [00000ms] outputs:</div><div>supermin helper [00000ms] kernel = /var/tmp/guestfs.l3Pqvn/kernel</div><div>supermin helper [00000ms] dtb = (none)</div><div>supermin helper [00000ms] initrd = /var/tmp/guestfs.l3Pqvn/initrd</div><div>supermin helper [00000ms] appliance = /var/tmp/guestfs.l3Pqvn/root</div><div>checking modpath /lib/modules/3.13.0-74-generic is a directory</div><div>picked kernel vmlinuz-3.13.0-74-generic</div><div>supermin helper [00048ms] finished creating kernel</div><div>supermin helper [00842ms] finished mke2fs</div><div>supermin helper [00842ms] visiting /usr/lib/guestfs/supermin.d</div><div>supermin helper [00842ms] visiting /usr/lib/guestfs/supermin.d/base.img</div><div>supermin helper [00878ms] visiting /usr/lib/guestfs/supermin.d/daemon.img.gz</div><div>supermin helper [00915ms] visiting /usr/lib/guestfs/supermin.d/hostfiles</div><div>supermin helper [03725ms] visiting /usr/lib/guestfs/supermin.d/init.img</div><div>supermin helper [03725ms] visiting /usr/lib/guestfs/supermin.d/udev-rules.img</div><div>supermin helper [03725ms] adding kernel modules</div><div>supermin helper [07480ms] closing ext2 filesystem</div><div>supermin helper [07481ms] finished creating appliance</div><div>libguestfs: [08157ms] finished building supermin appliance</div><div>libguestfs: command: run: rm</div><div>libguestfs: command: run: \ -rf /var/tmp/guestfs.l3Pqvn</div><div>libguestfs: [08158ms] begin testing qemu features</div><div>libguestfs: command: run: /usr/bin/qemu-system-x86_64</div><div>libguestfs: command: run: \ -nographic</div><div>libguestfs: command: run: \ -help</div><div>libguestfs: command: run: /usr/bin/qemu-system-x86_64</div><div>libguestfs: command: run: \ -nographic</div><div>libguestfs: command: run: \ -version</div><div>libguestfs: qemu version 2.0</div><div>libguestfs: command: run: /usr/bin/qemu-system-x86_64</div><div>libguestfs: command: run: \ -nographic</div><div>libguestfs: command: run: \ -machine accel=kvm:tcg</div><div>libguestfs: command: run: \ -device ?</div><div>libguestfs: [08244ms] finished testing qemu features</div><div>libguestfs: is_openable: /dev/kvm: No such file or directory</div><div>libguestfs: command: run: dmesg | grep -Eoh 'lpj=[[:digit:]]+'</div><div>libguestfs: read_lpj_from_dmesg: calculated lpj=9976136</div><div>[08257ms] /usr/bin/qemu-system-x86_64 \</div><div>    -global virtio-blk-pci.scsi=off \</div><div>    -nodefconfig \</div><div>    -enable-fips \</div><div>    -nodefaults \</div><div>    -nographic \</div><div>    -machine accel=kvm:tcg \</div><div>    -m 500 \</div><div>    -no-reboot \</div><div>    -rtc driftfix=slew \</div><div>    -no-hpet \</div><div>    -no-kvm-pit-reinjection \</div><div>    -kernel /var/tmp/.guestfs-1000/kernel.1723 \</div><div>    -initrd /var/tmp/.guestfs-1000/initrd.1723 \</div><div>    -device virtio-scsi-pci,id=scsi \</div><div>    -drive file=agent-disk1.vmdk,cache=writeback,id=hd0,if=none \</div><div>    -device scsi-hd,drive=hd0 \</div><div>    -drive file=/var/tmp/.guestfs-1000/root.1723,snapshot=on,id=appliance,cache=unsafe,if=none \</div><div>    -device scsi-hd,drive=appliance \</div><div>    -device virtio-serial-pci \</div><div>    -serial stdio \</div><div>    -device sga \</div><div>    -chardev socket,path=/tmp/libguestfsanpm0b/guestfsd.sock,id=channel0 \</div><div>    -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \</div><div>    -append 'panic=1 console=ttyS0 udevtimeout=600 no_timer_check lpj=9976136 acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdb selinux=0 guestfs_verbose=1 TERM=xterm-256color'</div><div>Warning: option deprecated, use lost_tick_policy property of kvm-pit instead.</div><div>Could not access KVM kernel module: No such file or directory</div><div>failed to initialize KVM: No such file or directory</div><div>Back to tcg accelerator.</div><div>qemu-system-x86_64: -drive file=agent-disk1.vmdk,cache=writeback,id=hd0,if=none: could not open disk image agent-disk1.vmdk: VMDK version 3 must be read only</div><div>libguestfs: error: appliance closed the connection unexpectedly, see earlier error messages</div><div>libguestfs: child_cleanup: 0x1e051e0: child process died</div><div>libguestfs: sending SIGTERM to process 1749</div><div>libguestfs: error: /usr/bin/qemu-system-x86_64 exited with error status 1, see debug messages above</div><div>libguestfs: error: guestfs_launch failed, see earlier error messages</div><div>libguestfs: trace: launch = -1 (error)</div><div>libguestfs: trace: close</div><div>libguestfs: closing guestfs handle 0x1e051e0 (state 0)</div><div>libguestfs: command: run: rm</div><div>libguestfs: command: run: \ -rf /tmp/libguestfsanpm0b</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Feb 27, 2016 at 6:36 AM, Richard W.M. Jones <span dir="ltr"><<a href="mailto:rjones@redhat.com" target="_blank">rjones@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">On Fri, Feb 26, 2016 at 06:56:07PM -0800, Vadaseri Vadaseri wrote:<br>
> lsb_release -a<br>
> No LSB modules are available.<br>
> Distributor ID: Ubuntu<br>
> Description: Ubuntu 14.04.3 LTS<br>
> Release: 14.04<br>
> Codename: trusty<br>
><br>
> guestmount --ro -a agent-disk1.vmdk -i /mnt/vmdk   --> Works fine<br>
><br>
> guestmount --rw -a agent-disk1.vmdk -i /mnt/vmdk<br>
> libguestfs: error: appliance closed the connection unexpectedly.<br>
> This usually means the libguestfs appliance crashed.<br>
> See <a href="http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs" rel="noreferrer" target="_blank">http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs</a><br>
> for information about how to debug libguestfs and report bugs.<br>
> libguestfs: error: guestfs_launch failed.<br>
> This usually means the libguestfs appliance failed to start or crashed.<br>
> See <a href="http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs" rel="noreferrer" target="_blank">http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs</a><br>
> or run 'libguestfs-test-tool' and post the *complete* output into a<br>
> bug report or message to the libguestfs mailing list.<br>
<br>
</span>In this case the libguestfs-test-tool output wasn't helpful.  You<br>
should be able to find out exactly what is happening by running:<br>
<br>
  guestmount --trace --verbose --rw -a agent-disk1.vmdk -i /mnt/vmdk<br>
<br>
However I'm going to hazard a guess that it's because of the format<br>
(VMDK).  qemu probably doesn't support writing to VMDK, and even if it<br>
does it's likely going to be very buggy and not something I would want<br>
to trust with my precious data.  Best to convert it to raw or qcow2<br>
first.<br>
<br>
If you want to access a VMware ESX server, then you can use sshfs:<br>
<br>
  <a href="https://rwmj.wordpress.com/2011/05/10/tip-use-libguestfs-on-vmware-esx-guests/" rel="noreferrer" target="_blank">https://rwmj.wordpress.com/2011/05/10/tip-use-libguestfs-on-vmware-esx-guests/</a><br>
<br>
This should work for writes provided that the guest is shut down, and<br>
because it uses VMware's own VMDK drivers it'll be a lot safer.<br>
<br>
Another way is to expose NBD from the VMware server or VMDK file<br>
[using the proprietary VDDK library] and mount using<br>
`-a nbd://<a href="http://example.com" rel="noreferrer" target="_blank">example.com</a>' (see guestfish manual for the -a option, which<br>
guestmount also supports).<br>
<br>
Rich.<br>
<span class=""><font color="#888888"><br>
--<br>
Richard Jones, Virtualization Group, Red Hat <a href="http://people.redhat.com/~rjones" rel="noreferrer" target="_blank">http://people.redhat.com/~rjones</a><br>
Read my programming and virtualization blog: <a href="http://rwmj.wordpress.com" rel="noreferrer" target="_blank">http://rwmj.wordpress.com</a><br>
virt-df lists disk usage of guests without needing to install any<br>
software inside the virtual machine.  Supports Linux and Windows.<br>
<a href="http://people.redhat.com/~rjones/virt-df/" rel="noreferrer" target="_blank">http://people.redhat.com/~rjones/virt-df/</a><br>
</font></span></blockquote></div><br></div></div>