Bug 747287 - Misleading error message when permission denied opening a disk image
Summary: Misleading error message when permission denied opening a disk image
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libguestfs
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-10-19 11:19 UTC by Richard W.M. Jones
Modified: 2011-10-21 15:31 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-10-21 15:31:58 UTC
Embargoed:


Attachments (Terms of Use)

Description Richard W.M. Jones 2011-10-19 11:19:59 UTC
Description of problem:

When you try to add a disk image which is read-only, qemu
fails to start up and qemu correctly prints an error message.
However the error message is eaten by libguestfs, and instead
we see this error:

  $ guestfish -a test1.img run : list-devices
  libguestfs: error: unexpected end of file when reading from daemon.
  This usually means the libguestfs appliance failed to start up.  Please
  enable debugging (LIBGUESTFS_DEBUG=1) and rerun the command, then look at
  the debug messages output prior to this error.
  Or you can run 'libguestfs-test-tool' and post the complete output into
  a bug report or message to the libguestfs mailing list.

Version-Release number of selected component (if applicable):

1.13.21

How reproducible:

100%

Steps to Reproduce:

  rm test1.img
  truncate -s 1G test1.img
  sudo chown root.root test1.img
  sudo chmod 0444 test1.img

Now compare opening this test image with and without --ro flag:

$ guestfish -a test1.img --ro run : list-devices
/dev/vda

$ guestfish -a test1.img run : list-devices
libguestfs: error: unexpected end of file when reading from daemon.
This usually means the libguestfs appliance failed to start up.  Please
enable debugging (LIBGUESTFS_DEBUG=1) and rerun the command, then look at
the debug messages output prior to this error.
Or you can run 'libguestfs-test-tool' and post the complete output into
a bug report or message to the libguestfs mailing list.

Adding -v or setting LIBGUESTFS_DEBUG=1 shows the real
error message, although the output is a bit messed up:

[...]
    -append 'panic=1 console=ttyS0 udevtimeout=300 no_timer_check acpi=off printk.time=1 cgroup_disable=memory selinux=0 guestfs_verbose=1 TERM=xterm ' \
    -drive file=/var/tmp/.guestfs-500/root.28300,snapshot=on,if=virtio,cache=unsafeqemu-kvm: -drive file=test1.img,cache=off,if=virtio: could not open disk image test1.img: Permission denied
  
Actual results:

Confusing error message.

Expected results:

Should capture and show the qemu error message.

Additional info:


Note You need to log in before you can comment on or make changes to this bug.