guestmount failing to mount a qcow image
I've been able to mount this image with qemu-nbd on Fedora 15 with: mkdir pb.test cd pb.test wget http://www.pixelbeat.org/guestfs/annoying.qcow2.gz wget http://www.pixelbeat.org/guestfs/77de68daecd823babbb58edb1c8e14d7106e83bb_sm... gzip -d *.gz mkdir -p /var/lib/nova/instances/_base/ mv 77* /var/lib/nova/instances/_base/ modprobe nbd qemu-nbd -c /dev/nbd1 annoying.qcow2 mkdir t mount /dev/nbd1 t ls t umount t qemu-nbd -d /dev/nbd1 However guestmount on RHEL6.2 and Fedora 15 does this: # guestmount --rw -a /tmp/disk -i /tmp/tmplFlBCc libguestfs: error: mount_options: mount_options_stub: /dev/root: No such file or directory guestmount: some filesystems could not be mounted (ignored) # echo $? 0 # ls -lrt /tmp ls: cannot access /tmp/tmplFlBCc: Input/output error d?????????? ? ? ? ? ? tmplFlBCc I've attached the debug output from the above run on RHEL6.2 cheers, Pádraig.
On Thu, Dec 08, 2011 at 04:49:08PM +0000, Pádraig Brady wrote:
# guestmount --rw -a /tmp/disk -i /tmp/tmplFlBCc libguestfs: error: mount_options: mount_options_stub: /dev/root: No such file or directory
This image works OK with libguestfs 1.14/1.15. I suspect the commit you need to make it work is: commit 917f947590c92318fee2545ba88245d0de012e31 Author: Richard W.M. Jones <rjones@redhat.com> Date: Fri Sep 16 15:26:20 2011 +0100 inspection: Handle /dev/root in /etc/fstab. This means "the device that holds /etc/fstab", so map it correctly. This fixes support for ttylinux and also some other guests that use /dev/root instead of a real device name. The bigger issue here for OpenStack is how to recover gracefully when inspection fails. Even though guestmount -i doesn't work on the older libguestfs, you could still have used explicit -m option(s). You would have to know somehow which filesystem(s) are available and which you want to modify. That is information you can get from the API (g.list_filesystems) or using virt-filesystems. It's reasonable, if there is only one filesystem in the image, to just mount that one. What's less clear is what should happen if there are multiple filesystems: that information would have to be passed down from the user through OpenStack. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/
On 12/08/2011 05:43 PM, Richard W.M. Jones wrote:
On Thu, Dec 08, 2011 at 04:49:08PM +0000, Pádraig Brady wrote:
# guestmount --rw -a /tmp/disk -i /tmp/tmplFlBCc libguestfs: error: mount_options: mount_options_stub: /dev/root: No such file or directory
This image works OK with libguestfs 1.14/1.15. I suspect the commit you need to make it work is:
commit 917f947590c92318fee2545ba88245d0de012e31 Author: Richard W.M. Jones <rjones@redhat.com> Date: Fri Sep 16 15:26:20 2011 +0100
inspection: Handle /dev/root in /etc/fstab.
This means "the device that holds /etc/fstab", so map it correctly.
This fixes support for ttylinux and also some other guests that use /dev/root instead of a real device name.
The bigger issue here for OpenStack is how to recover gracefully when inspection fails. Even though guestmount -i doesn't work on the older libguestfs, you could still have used explicit -m option(s).
Yep that works: `guestmount -a annoying.qcow2 -m /dev/sda mount_dir/` The awkward thing about the failure mode is that it warns, but returns EXIT_SUCCESS, leaving the dir "half mounted" (and then fusermount -u gives an EBUSY error (hmm I might use -z)) I'm tempted to assume an error if there is any output to stderr.
You would have to know somehow which filesystem(s) are available and which you want to modify. That is information you can get from the API (g.list_filesystems) or using virt-filesystems. It's reasonable, if there is only one filesystem in the image, to just mount that one. What's less clear is what should happen if there are multiple filesystems: that information would have to be passed down from the user through OpenStack.
There is a 'partition' variable passed through the api, I guess it could be 0 = /dev/sda, 1..N = /dev/sdaN, -1 => -i I'll sort something out. cheers, Pádraig.
On Fri, Dec 09, 2011 at 12:08:06AM +0000, Pádraig Brady wrote:
On 12/08/2011 05:43 PM, Richard W.M. Jones wrote:
On Thu, Dec 08, 2011 at 04:49:08PM +0000, Pádraig Brady wrote:
# guestmount --rw -a /tmp/disk -i /tmp/tmplFlBCc libguestfs: error: mount_options: mount_options_stub: /dev/root: No such file or directory
This image works OK with libguestfs 1.14/1.15. I suspect the commit you need to make it work is:
commit 917f947590c92318fee2545ba88245d0de012e31 Author: Richard W.M. Jones <rjones@redhat.com> Date: Fri Sep 16 15:26:20 2011 +0100
inspection: Handle /dev/root in /etc/fstab.
This means "the device that holds /etc/fstab", so map it correctly.
This fixes support for ttylinux and also some other guests that use /dev/root instead of a real device name.
The bigger issue here for OpenStack is how to recover gracefully when inspection fails. Even though guestmount -i doesn't work on the older libguestfs, you could still have used explicit -m option(s).
Yep that works: `guestmount -a annoying.qcow2 -m /dev/sda mount_dir/`
The awkward thing about the failure mode is that it warns, but returns EXIT_SUCCESS, leaving the dir "half mounted" (and then fusermount -u gives an EBUSY error (hmm I might use -z)) I'm tempted to assume an error if there is any output to stderr.
Please file a bug about this: http://libguestfs.org/ -> Bug reports -> Enter a new bug report
You would have to know somehow which filesystem(s) are available and which you want to modify. That is information you can get from the API (g.list_filesystems) or using virt-filesystems. It's reasonable, if there is only one filesystem in the image, to just mount that one. What's less clear is what should happen if there are multiple filesystems: that information would have to be passed down from the user through OpenStack.
There is a 'partition' variable passed through the api, I guess it could be 0 = /dev/sda, 1..N = /dev/sdaN, -1 => -i
I'll sort something out.
Yes, I saw that, but I don't think it is enough. For one thing most *nix-like OSes have multiple filesystems, and guestmount lets you specify multiple -m options. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
Never mind about filing the bug; I have pushed this commit: http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=54e91da925323642e67b... Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/
participants (2)
-
Pádraig Brady -
Richard W.M. Jones