while trying to extract a tar.gz file in ubuntu terminal an error happened int he last sentence here it is : tar: A lone zero block at 343398
what is the solution for this problem???
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
It depends whether it happens with all
tar.gz files or just this one. This particular file could be corrupt, and so won't open properly. If using tar to extract, you need to use the
z option, as that's necessary when an archive is gzipped:
tar xzvf <file.tar.gz>. Alternatively , it is also worth trying to extract it with
To find out whether the file is corrupt, run
gzip -t <file.tar.gz>; this command will check the file for errors, and if any are found they should appear in the terminal. This should tell you whether the file is corrupt.
If the file is sound and the error reoccurs, it means it is probably the known issue with tar that occurs when a file does not have a pair of
zero blocks at the end of it, as GNU tar expects. The solution to this is to add the
-i option to ignore the
zero blocks. So use
tar ixzvf <file.tar.gz> The issue is documented here in detail.
The same thing has happened to me because I piped both stdout and stderr through a channel that doesn't separate stderr and stdout (an android adb terminal session).
That way some error messages ended up in the stream. This was the faulty command:
Faulty command, adb shell just merges stderr and stdout locally => garbage! :
adb shell tar -cf - /some/dir \| uuencode bla | uudecode -o - > backup.tar
adb shell tar -cf - /some/dir 2>/dev/null\| uuencode bla | uudecode -o - > backup.tar
The same will happen if you do a similar command over SSH like this quick tar streaming over ssh if you forget to redirect stderr to /dev/null:
ssh user@host tar -czf /some/remote/path 2\>/dev/null > /local/path/to/file.tar.gz
I got this error the other day trying to untar an archive which was not gzipped. The source of the file was unknown to me but I figured that the creator might use
cat to combine several tars into a single one. This caused the end-of-file zero marker to be read by
tar utility in the middle of a combined archive thus displaying "A lone zero block" error.
If this is the case then
-i option might help to suppress these errors. Please see
man tar or this link as a reference.