Bug 591155 - virt-tar prints "tar_in: tar subcommand failed on directory" if a disk image is not writable
Summary: virt-tar prints "tar_in: tar subcommand failed on directory" if a disk image ...
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libguestfs
Version: unspecified
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact:
Depends On: 576879 627835
Blocks: 591250
TreeView+ depends on / blocked
Reported: 2010-05-11 15:08 UTC by Richard W.M. Jones
Modified: 2011-07-14 19:08 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 591250 (view as bug list)
Last Closed: 2011-07-14 19:08:04 UTC

Attachments (Terms of Use)
output of debug virt-tar -u (35.37 KB, text/plain)
2010-05-11 18:07 UTC, Natxo Asenjo
no flags Details

Description Richard W.M. Jones 2010-05-11 15:08:52 UTC
Description of problem:

virt-tar gives an obscure error if the destination directory is not
writable when uploading.

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


How reproducible:


Steps to Reproduce:

1. Create a phony disk image using guestfish:

$ guestfish -N fs -m /dev/sda1 <<EOF
mkdir /bin
mkdir /boot
mkdir /boot/grub
mkdir /etc
mkdir /usr
touch /boot/grub/menu.lst
upload -<<end /etc/fstab
/dev/sda1 / ext2 defaults 1 2

2. Make it read-only:

$ chmod -w test1.img

3. Check virt-inspector recognizes it:

$ virt-inspector --perl test1.img
[prints some Perl stuff and doesn't give an error]

4. Try uploading something:

$ virt-tar -u test1.img test.tar /
[where 'test.tar' is a random small tarball]

Actual results:

virt-tar says:
tar_in: tar subcommand failed on directory: / at /usr/bin/virt-tar line 246.

Expected results:

Better error message.

Additional info:

Originally reported by Natxo Asenjo here:

Comment 1 Richard W.M. Jones 2010-05-11 15:14:50 UTC
This is generally an instance of bug 576879.

Comment 2 Natxo Asenjo 2010-05-11 18:05:46 UTC
the vm image is on the local hard disk, so local storage. The permissions are 
-rw-------. 1 root root 8589934592 2010-05-11 19:56 wiki-clone.img

and the virt-tar -u command is being run as administrator.

SElinux is in permissive mode.

I attach the debug log using export LIBGUESTFS_DEBUG=1

Comment 3 Natxo Asenjo 2010-05-11 18:07:11 UTC
Created attachment 413213 [details]
output of debug virt-tar -u

Comment 4 Richard W.M. Jones 2010-05-13 09:27:21 UTC
Patches posted upstream to improve the error messages:


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