opening tar file displays "This does not look like a tar archive" - linux

I have downloaded some data from the internet and the files come with this format
file.pth.tar
when I am trying to open it through cygwin terminal it says:
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors
I tried to open it in windows but it says
Invalid archive open/read error
I tried to find the file type using: file full_graph.pth.tar
and it displays:
full_graph.pth.tar: data

Related

How to tar a directory

I want to tar two directories I have downloaded into my program. I am working in Colab environment similar to tensorflow. But when i run the following commands
!tar -zxf ./RoadDamageDataset.tar.gz
!tar -zxf ./trainedModels.tar.gz
I get this type of error
gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
So far I have tried to run the above commands without - but it doesn't work.
Also somewhere I have read that maybe the files are not downloaded properly so I have double checked the files and again downloaded for two times but still this error remains.
Can anyone here help me with this kind of problem as I have no idea with how to deal with tar.
Thank you

Gitlab backup restore Error --> tar: This does not look like a tar archive

I am trying to restore GitLab (8.16.1) backup on Ubuntu server (backup taken by command sudo gitlab-rake gitlab:backup:create) using command:
sudo gitlab-rake gitlab:backup:restore BACKUP=1493107454_2018_04_25_10.6.4-ce
Its giving me error:
gzip: stdin: not in gzip format
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
my Backup file is .tar file.
gzip version 1.6
As of my knowledge before it restore that backup file it first extract.
I don't know why that extracted files are having extension .tar.gz.
Can anyone help with this ?
sudo gitlab-rake gitlab:backup:restore BACKUP=1493107454_2018_04_25_10.6.4-ce
That means you should have a file like:
var/opt/gitlab/backups/1493107454_2018_04_25_10.6.4-ce_gitlab_backup.tar
And a cat backup_information.yml in that same folder giving you information about that backup.
If the file is not a valid archive, that would explain the error message.
You can add --trace to the rake command to know more.

extract good files from corrupt tar archive

I have a large tar archive with many xml files in it. a couple of xml files in this archive are corrupt. How can I extract the good files without the program exiting?
There is a tar file within the gz
tar zxf myFile.gz
tar: Unexpected EOF in archive
tar: rmtlseek not stopped at a record boundary
tar: Error is not recoverable: exiting now
It looks, from the filename, as though you're trying to unpack something that isn't a tar archive. Usually a tar file would have a .tar extension, and if it had been then compressed with gzip, it would be .tar.gz or .tgz.
The command you're running, with the z option to tar, tries to undo gzip compression first, and then untar the resulting archive. But from the .gz extension, it rather looks as though you've got a gzipped file rather than a gzipped tar archive.
The best thing to do is to examine the file to find out what sort of file it is:
file myFile.gz
That will tell you whether it's gzipped or whatever. If it's gzipped, then run
gunzip myFile.gz
That will leave you with myFile without the extension; you can then use
file myFile
to probe it to determine whether it's a tar archive or something else.
mv myFile.gz myFile.tar.gz
gunzip myfile.tar.gz
tar xf myFile.tar
You might try bzip2recover to try recover the bondaries first!
bzip2recover file.bzip
eg from manual:
In case of damage to one member of a .gz file, other members can still be recovered (if the
file: Corrupt input. Use zcat to recover some data.
usage: zcat file > recover

How tar xvfz works in cygwin?

I tried tar with xvfz and -xvfc both didn't work in Cygwin on Windows.
$ tar xvfz sshpass-1.0.5.tar.gz
tar (child): sshpass-1.0.5.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
Here cmd tar with '-'
$ tar -xvfz sshpass-1.0.5.tar.gz
tar: z: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
Question :
1 . How does tar works with - or without _ ?
Please suggest to execute tar -xvfz sshpass-1.0.5.tar.gz.
tar has 3 types of syntax (according to this ):
long options (--file)
short options (-f)
old options (f)
For the old option syntax, all the letters must follow "tar" and must all fall into a single clump with no spaces. The order of the letters doesn't really matter, so long as the arguments to those letters follow the same order after the clump of options.
This old way of writing tar options can surprise even experienced users. For example, the two commands:
# tar cfz sshpass-1.0.5.tar.gz file
# tar -cfz sshpass-1.0.5.tar.gz file
are quite different. The first example uses ‘sshpass-1.0.5.tar.gz’ as the value for option ‘f’ and recognizes the option ‘z’. The second example, however, uses ‘z’ as the value for option ‘f’ — probably not what was intended.
Old options are kept for compatibility with old versions of tar.
The command with a '-' is equivalent to
tar -czf sshpass-1.0.5.tar.gz file
tar -cf sshpass-1.0.5.tar.gz -z file
tar cf sshpass-1.0.5.tar.gz -z file
Got it, there was a typo error for in file name, corrected and ran. it worked.
$ tar xvfz sshpass-1.05.tar.gz
sshpass-1.05/
sshpass-1.05/COPYING
sshpass-1.05/AUTHORS
sshpass-1.05/aclocal.m4
sshpass-1.05/INSTALL
sshpass-1.05/Makefile.am
sshpass-1.05/configure.ac
sshpass-1.05/install-sh
sshpass-1.05/Makefile.in
sshpass-1.05/sshpass.1
sshpass-1.05/configure
sshpass-1.05/depcomp
sshpass-1.05/README
sshpass-1.05/NEWS
sshpass-1.05/config.h.in
sshpass-1.05/missing
sshpass-1.05/main.c
sshpass-1.05/ChangeLog

How to extract this .tgz file in cygwin

I have install cygwin and want to install a tgz file. I typed following command:
$tar xvfz tidy_src.tgz
Error occurs:
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
Then I type following command to check;
$file tidy_src.tgz
It shows it's a ASCII text
So I continue type:
$tar xvf tidy_src.tgz
Still doesn't work.
Anyone can give some help?
You can download this free-virus file at http://tidy.sourceforge.net/src/tidy_src.tgz
untarring a gzipped file that you have made yourself from known content with the same command.
if that works then you confirm that the archive is corrupt.

Resources