[Libguestfs] "guestmount --rw" fails but "guestmount --ro" succeeds on Ubuntu 14.04

Vadaseri Vadaseri vadaseri at gmail.com
Thu Mar 3 00:13:20 UTC 2016


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.

:~$ guestmount --trace --verbose --rw -a agent-disk1.vmdk -i /mnt/vmdk
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: trace: set_recovery_proc true
libguestfs: trace: set_recovery_proc = 0
libguestfs: trace: add_drive "agent-disk1.vmdk"
libguestfs: trace: add_drive = 0
libguestfs: trace: launch
libguestfs: trace: get_tmpdir
libguestfs: trace: get_tmpdir = "/tmp"
libguestfs: trace: version
libguestfs: trace: version = <struct guestfs_version *>
libguestfs: trace: get_backend
libguestfs: trace: get_backend = "direct"
libguestfs: launch: program=guestmount
libguestfs: launch: version=1.24.5
libguestfs: launch: backend registered: unix
libguestfs: launch: backend registered: uml
libguestfs: launch: backend registered: libvirt
libguestfs: launch: backend registered: direct
libguestfs: launch: backend=direct
libguestfs: launch: tmpdir=/tmp/libguestfsanpm0b
libguestfs: launch: umask=0002
libguestfs: launch: euid=1000
libguestfs: command: run: /usr/bin/supermin-helper
libguestfs: command: run: \ --verbose
libguestfs: command: run: \ -f checksum
libguestfs: command: run: \ --host-cpu x86_64
libguestfs: command: run: \ /usr/lib/guestfs/supermin.d
supermin helper [00000ms] whitelist = (not specified)
supermin helper [00000ms] host_cpu = x86_64
supermin helper [00000ms] dtb_wildcard = (not specified)
supermin helper [00000ms] inputs:
supermin helper [00000ms] inputs[0] = /usr/lib/guestfs/supermin.d
supermin helper [00000ms] outputs:
supermin helper [00000ms] kernel = (none)
supermin helper [00000ms] dtb = (none)
supermin helper [00000ms] initrd = (none)
supermin helper [00000ms] appliance = (none)
checking modpath /lib/modules/3.13.0-74-generic is a directory
picked kernel vmlinuz-3.13.0-74-generic
supermin helper [00000ms] finished creating kernel
supermin helper [00000ms] visiting /usr/lib/guestfs/supermin.d
supermin helper [00001ms] visiting /usr/lib/guestfs/supermin.d/base.img
supermin helper [00003ms] visiting /usr/lib/guestfs/supermin.d/daemon.img.gz
supermin helper [00003ms] visiting /usr/lib/guestfs/supermin.d/hostfiles
supermin helper [00199ms] visiting /usr/lib/guestfs/supermin.d/init.img
supermin helper [00200ms] visiting
/usr/lib/guestfs/supermin.d/udev-rules.img
supermin helper [00201ms] adding kernel modules
supermin helper [00667ms] finished creating appliance
libguestfs: checksum of existing appliance:
c15e020bda105b5ca562616e2edac3c65917bbbd9fb9954efe3d92e697a583a1
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
libguestfs: [00675ms] begin building supermin appliance
libguestfs: [00675ms] run supermin-helper
libguestfs: command: run: /usr/bin/supermin-helper
libguestfs: command: run: \ --verbose
libguestfs: command: run: \ --copy-kernel
libguestfs: command: run: \ -f ext2
libguestfs: command: run: \ --host-cpu x86_64
libguestfs: command: run: \ /usr/lib/guestfs/supermin.d
libguestfs: command: run: \ --output-kernel /var/tmp/guestfs.l3Pqvn/kernel
libguestfs: command: run: \ --output-initrd /var/tmp/guestfs.l3Pqvn/initrd
libguestfs: command: run: \ --output-appliance /var/tmp/guestfs.l3Pqvn/root
supermin helper [00000ms] whitelist = (not specified)
supermin helper [00000ms] host_cpu = x86_64
supermin helper [00000ms] dtb_wildcard = (not specified)
supermin helper [00000ms] inputs:
supermin helper [00000ms] inputs[0] = /usr/lib/guestfs/supermin.d
supermin helper [00000ms] outputs:
supermin helper [00000ms] kernel = /var/tmp/guestfs.l3Pqvn/kernel
supermin helper [00000ms] dtb = (none)
supermin helper [00000ms] initrd = /var/tmp/guestfs.l3Pqvn/initrd
supermin helper [00000ms] appliance = /var/tmp/guestfs.l3Pqvn/root
checking modpath /lib/modules/3.13.0-74-generic is a directory
picked kernel vmlinuz-3.13.0-74-generic
supermin helper [00048ms] finished creating kernel
supermin helper [00842ms] finished mke2fs
supermin helper [00842ms] visiting /usr/lib/guestfs/supermin.d
supermin helper [00842ms] visiting /usr/lib/guestfs/supermin.d/base.img
supermin helper [00878ms] visiting /usr/lib/guestfs/supermin.d/daemon.img.gz
supermin helper [00915ms] visiting /usr/lib/guestfs/supermin.d/hostfiles
supermin helper [03725ms] visiting /usr/lib/guestfs/supermin.d/init.img
supermin helper [03725ms] visiting
/usr/lib/guestfs/supermin.d/udev-rules.img
supermin helper [03725ms] adding kernel modules
supermin helper [07480ms] closing ext2 filesystem
supermin helper [07481ms] finished creating appliance
libguestfs: [08157ms] finished building supermin appliance
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /var/tmp/guestfs.l3Pqvn
libguestfs: [08158ms] begin testing qemu features
libguestfs: command: run: /usr/bin/qemu-system-x86_64
libguestfs: command: run: \ -nographic
libguestfs: command: run: \ -help
libguestfs: command: run: /usr/bin/qemu-system-x86_64
libguestfs: command: run: \ -nographic
libguestfs: command: run: \ -version
libguestfs: qemu version 2.0
libguestfs: command: run: /usr/bin/qemu-system-x86_64
libguestfs: command: run: \ -nographic
libguestfs: command: run: \ -machine accel=kvm:tcg
libguestfs: command: run: \ -device ?
libguestfs: [08244ms] finished testing qemu features
libguestfs: is_openable: /dev/kvm: No such file or directory
libguestfs: command: run: dmesg | grep -Eoh 'lpj=[[:digit:]]+'
libguestfs: read_lpj_from_dmesg: calculated lpj=9976136
[08257ms] /usr/bin/qemu-system-x86_64 \
    -global virtio-blk-pci.scsi=off \
    -nodefconfig \
    -enable-fips \
    -nodefaults \
    -nographic \
    -machine accel=kvm:tcg \
    -m 500 \
    -no-reboot \
    -rtc driftfix=slew \
    -no-hpet \
    -no-kvm-pit-reinjection \
    -kernel /var/tmp/.guestfs-1000/kernel.1723 \
    -initrd /var/tmp/.guestfs-1000/initrd.1723 \
    -device virtio-scsi-pci,id=scsi \
    -drive file=agent-disk1.vmdk,cache=writeback,id=hd0,if=none \
    -device scsi-hd,drive=hd0 \
    -drive
file=/var/tmp/.guestfs-1000/root.1723,snapshot=on,id=appliance,cache=unsafe,if=none
\
    -device scsi-hd,drive=appliance \
    -device virtio-serial-pci \
    -serial stdio \
    -device sga \
    -chardev socket,path=/tmp/libguestfsanpm0b/guestfsd.sock,id=channel0 \
    -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \
    -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'
Warning: option deprecated, use lost_tick_policy property of kvm-pit
instead.
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
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
libguestfs: error: appliance closed the connection unexpectedly, see
earlier error messages
libguestfs: child_cleanup: 0x1e051e0: child process died
libguestfs: sending SIGTERM to process 1749
libguestfs: error: /usr/bin/qemu-system-x86_64 exited with error status 1,
see debug messages above
libguestfs: error: guestfs_launch failed, see earlier error messages
libguestfs: trace: launch = -1 (error)
libguestfs: trace: close
libguestfs: closing guestfs handle 0x1e051e0 (state 0)
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfsanpm0b


On Sat, Feb 27, 2016 at 6:36 AM, Richard W.M. Jones <rjones at redhat.com>
wrote:

> On Fri, Feb 26, 2016 at 06:56:07PM -0800, Vadaseri Vadaseri wrote:
> > lsb_release -a
> > No LSB modules are available.
> > Distributor ID: Ubuntu
> > Description: Ubuntu 14.04.3 LTS
> > Release: 14.04
> > Codename: trusty
> >
> > guestmount --ro -a agent-disk1.vmdk -i /mnt/vmdk   --> Works fine
> >
> > guestmount --rw -a agent-disk1.vmdk -i /mnt/vmdk
> > libguestfs: error: appliance closed the connection unexpectedly.
> > This usually means the libguestfs appliance crashed.
> > See http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs
> > for information about how to debug libguestfs and report bugs.
> > libguestfs: error: guestfs_launch failed.
> > This usually means the libguestfs appliance failed to start or crashed.
> > See http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs
> > or run 'libguestfs-test-tool' and post the *complete* output into a
> > bug report or message to the libguestfs mailing list.
>
> In this case the libguestfs-test-tool output wasn't helpful.  You
> should be able to find out exactly what is happening by running:
>
>   guestmount --trace --verbose --rw -a agent-disk1.vmdk -i /mnt/vmdk
>
> However I'm going to hazard a guess that it's because of the format
> (VMDK).  qemu probably doesn't support writing to VMDK, and even if it
> does it's likely going to be very buggy and not something I would want
> to trust with my precious data.  Best to convert it to raw or qcow2
> first.
>
> If you want to access a VMware ESX server, then you can use sshfs:
>
>
> https://rwmj.wordpress.com/2011/05/10/tip-use-libguestfs-on-vmware-esx-guests/
>
> This should work for writes provided that the guest is shut down, and
> because it uses VMware's own VMDK drivers it'll be a lot safer.
>
> Another way is to expose NBD from the VMware server or VMDK file
> [using the proprietary VDDK library] and mount using
> `-a nbd://example.com' (see guestfish manual for the -a option, which
> guestmount also supports).
>
> Rich.
>
> --
> Richard Jones, Virtualization Group, Red Hat
> http://people.redhat.com/~rjones
> Read my programming and virtualization blog: http://rwmj.wordpress.com
> virt-df lists disk usage of guests without needing to install any
> software inside the virtual machine.  Supports Linux and Windows.
> http://people.redhat.com/~rjones/virt-df/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20160302/c781ca1b/attachment.htm>


More information about the Libguestfs mailing list