Bug 591155

Summary: virt-tar prints "tar_in: tar subcommand failed on directory" if a disk image is not writable
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: mbooth, natxo, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 591250 (view as bug list) Environment:
Last Closed: 2011-07-14 19:08:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 576879, 627835    
Bug Blocks: 591250    
Attachments:
Description Flags
output of debug virt-tar -u none

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):

1.3.11

How reproducible:

Always.

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
end
EOF

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:
https://www.redhat.com/archives/virt-tools-list/2010-May/msg00008.html

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:

https://www.redhat.com/archives/libguestfs/2010-May/msg00062.html
https://www.redhat.com/archives/libguestfs/2010-May/msg00063.html