tar: Unexpected EOF in archive

88,363

Solution 1

Check two items:

(1) Is the FILE INCOMPLETE due to a faulty download? Re-download, and use the -c option if your are using wget. (happens all the time).

(2) Does the .tar or .tar.gz filename have ILLEGAL CHARACTERS. It's best to keep archive names simple, short, composed of letters and numbers. (happens all the time). So just rename the file. This one nailed me recently as I thought it would be convenient to include a time/date stamp as part of the archive name. BAD IDEA!

Solution 2

You don't. It appears the file has been truncated. How long is it? If you only have the first few bytes then you're done.

Solution 3

are you unpacking the .tar.gz file on the same platform it was made on? there are some differences between older Unix versions of tar, such as the non-GNU versions of tar that have shipped with Solaris, and the GNU tar that ships with Linux, etc. If you're going to unpack an archive with GNU tar, it's best to create it with GNU tar.

how does your system look for disk space? was the disk full when you made the archive, or is it full as you attempt to unpack it?

did you create the archive with a cron job? without output redirection, cron can do funky things to archives due to limitations in the size of output it will allow to STDOUT. If you're making an archive in cron, and you're using -v with tar, try redirecting STDOUT to a file, and STDERR, too. See if that helps. tar -cvf archive.tar.gz /path/ 1>archive.stdout.log 2>archive.stderr.log or something like that.

Solution 4

just faced this recently, solution was to rename the file (remove the _).E.g Bad file name which was causing issue MAA07-0100-0100-01AAA_show_tech_output.tgz , renaming this to MAA07-0100-0100-01AAA.tgz helped to resolve the issue.

Share:
88,363

Related videos on Youtube

iLinux85
Author by

iLinux85

Updated on September 18, 2022

Comments

  • iLinux85
    iLinux85 over 1 year

    I was attempting to untar a .tar.gz file, but came across this error:

    gzip: stdin: unexpected end of file
    tar: Unexpected EOF in archive
    tar: Unexpected EOF in archive
    tar: Error is not recoverable: exiting now
    

    The tar.gz file includes a .tar file, which when untarred results in:

    tar: Unexpected EOF in archive
    tar: Unexpected EOF in archive
    tar: Error is not recoverable: exiting now
    

    I tried both –ignore-zeros and –ignore-failed-read, although they both didn't work.

    Is there any way I could extract this file even if it is corrupted?

    The file type in question: .tar.gz: Gzip Compressed Data, from a UNIX system.

  • iLinux85
    iLinux85 over 11 years
    i am trying to extract cpanel backup site made by .tar.gz , the problem is this site large over 13 G.B and i think it didn't backup the file as well , so it's corrupted , all i want is how could i skip the corrupted files and extract the files has been packed as well ?
  • vonbrand
    vonbrand about 4 years
    @iLinux85, the file is probably truncated (cut short, the "unexpected EOF"), you can only recover what is stored in it.