tar: Unexpected EOF in archive - shell

I am trying extract .tar.gz file it but with no luck
gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
the file tar.gz include another file.tar only which is has the issue
when i trying to extract .tar file i got
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
i tried –ignore-zeros –ignore-failed-read with no luck
how could i extract this file even if it corrupted ?

You tar file is truncated. tar extracts everything present in the archive but cannot invent the missing part.

Related

file decompression error during kafka installation with chef

I'm trying to install kafka using the supermarket recipe as my starting point. But when I run kitchen converge it gives me the following error. It should be something inherent in the archive. What do you think?platform kitchen ubuntu 14.04 tar version 1.27.1
execute 'kafka-install' do
cwd node['kafka']['install_dir']
command <<-EOH
wget http://www-us.apache.org/dist/kafka/2.5.0/kafka_2.12-2.5.0.tgz && \
tar -zxf kafka_2.12-2.5.0.tgz && \
useradd -M #{node['kafka']['user']} && \
chown #{node['kafka']['user']}:#{node['kafka']['group']} -R #{node['kafka']['install_dir']} && \
chown +x /kafka/bin/*.sh
EOH
end
I get the following error
Error executing action `run` on resource 'execute[kafka-install]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '2'
---- Begin output of wget http://www-us.apache.org/dist/kafka/2.5.0/kafka_2.12-2.5.0.tgz && tar -zxf kafka_2.12-2.5.0.tgz && useradd -M kafka && chown kafka:kafka -R /kafka && chown +x /kafka/bin/*.sh
----
STDOUT:
STDERR: --2020-06-09 18:21:40-- http://www-us.apache.org/dist/kafka/2.5.0/kafka_2.12-2.5.0.tgz
tar: Skipping to next header
tar: Substituting `.' for empty member name
tar: .: Unknown file type ' ', extracted as normal file
tar: .: Cannot open: Is a directory
tar: Substituting `.' for empty member name
tar: .: Unknown file type ' ', extracted as normal file
tar: .: Cannot open: Is a directory
tar: Substituting `.' for empty member name
tar: .: Unknown file type ' ', extracted as normal file
tar: .: Cannot open: Is a directory
tar: Substituting `.' for empty member name
tar: .: Unknown file type ' ', extracted as normal file
tar: .: Cannot open: Is a directory
tar: Substituting `.' for empty member name
tar: .: Unknown file type ' ', extracted as normal file
tar: .: Cannot open: Is a directory
tar: Substituting `.' for empty member name
tar: .: Unknown file type ' ', extracted as normal file
tar: .: Cannot open: Is a directory
tar: Substituting `.' for empty member name
tar: .: Unknown file type ' ', extracted as normal file
tar: .: Cannot open: Is a directory
tar: Substituting `.' for empty member name
tar: .: Unknown file type ' ', extracted as normal file
tar: .: Cannot open: Is a directory
tar: Skipping to next header
gzip: stdin: invalid compressed data--format violated
tar: Child returned status 1
tar: Error is not recoverable: exiting now
---- End output of wget http://www-us.apache.org/dist/kafka/2.5.0/kafka_2.12-2.5.0.tgz && tar -zxf kafka_2.12-2.5.0.tgz && useradd -M kafka && chown kafka:kafka -R /kafka && chown +x /kafka/bin/*.sh
----
Ran wget http://www-us.apache.org/dist/kafka/2.5.0/kafka_2.12-2.5.0.tgz && tar -zxf kafka_2.12-2.5.0.tgz && useradd -M kafka && chown kafka:kafka -R /kafka && chown +x /kafka/bin/*.sh
returned 2
I tried the tar command in ubuntu 18.04 and it works, tar version 1.29

My loop bash command doesn't work

I'm trying to run a command called bedtools shuffle on a file 5 times and save each run as with its counter after the filename (i.e. SHUFFLE1... SHUFFLE 5).
Here is my code but I keep getting the error message below:
for i in {1..5}; do bedtools shuffle -i '/PATH/wgEncodeBroadHistoneOsteoblH3k27acStdPk.broadPeak_use' -g '/PATH/chrom.sizes'> rm -f '/PATH/wgEncodeBroadHistoneOsteoblH3k27acStdPk.broadPeak_use_SHUFFLED${i}.bed'; done
-bash: rm: cannot overwrite existing file
-bash: rm: cannot overwrite existing file
-bash: rm: cannot overwrite existing file
-bash: rm: cannot overwrite existing file
-bash: rm: cannot overwrite existing file
Please advise!

How to unzip a dump file created by Rethinkdb

In a Linux directory ~/Documents/Scratch, I've created the following tar file using the rethinkdb dump command:
kurt#kurt-ThinkPad:~/Documents/Scratch$ ls -tr | tail -n1
rethinkdb_dump_2016-10-10T16:58:32.tar.gz
However, if I try to untar this file, I get an "unexpected end of file" error:
kurt#kurt-ThinkPad:~/Documents/Scratch$ tar -zxvf rethinkdb_dump_2016-10-10T16:58:32.tar.gz
tar (child): Cannot connect to rethinkdb_dump_2016-10-10T16: resolve failed
gzip: stdin: unexpected end of file
tar: Child returned status 128
tar: Error is not recoverable: exiting now
Do I perhaps have to rename the file before unzipping it?
Yes you can rename it.
mv rethinkdb_dump_2016-10-10T16\:58\:32.tar.gz rethinkdb.tgz
tar zxvf rethinkdb.tgz
Or you can force it to look localy using --force-local:
tar -zxvf rethinkdb_dump_2016-10-10T16\:58\:32.tar.gz --force-local

I stupidly tar a .tex file twice and become binary, any chance to save it back?

My tex file used to be utf-8.
When I tried to compress it to send to others, I accidentally tar the file twice using
tar -xf litreview.tex figure/
tar -cf litreview.tex figure/
(figure/ is the directory where I store my figs for the .tex)
and my .tex became a binary file
Master:LitReview ning$ file litreview.tex
litreview.tex: POSIX tar archive
When I tried to untar it, I received
Master:LitReview ning$ tar -xvf litreview.tex
tar: Damaged tar archive
tar: Retrying...
tar: Damaged tar archive
tar: Retrying...
Any chance to convert it back to tex?

Tar: Cannot stat: No such file or directory even though directory exists

I've created a temporary directory in a Makefile:
export TMP := $(shell mktemp -d -t), do a bunch of work there. Then I want to create a tarball.
tar czf ../packages/$(PACKAGE).lin.tar.gz -C $(TMP) $(PACKAGE).lin
The issue is that this command always gives
Tar: Cannot stat: No such file or directory
I've added a test to see if the directory exists using this right before the tar:
if [ -d $(TMP)/$(PACKAGE).lin ]; then echo "Dir exists"; fi
I see the echo, the directory does exist. I also cannot cd into that directory!?
Also, it seems to be dropping the latter part of the directory name...it will say cannot stat'$(PACKAGE)' instead of '$(PACKAGE).lin'.
If I do this:
cd $(TMP)
tar czf ../packages/$(PACKAGE).lin.tar.gz $(PACKAGE).lin
Then it will say cannot stat $(PACKAGE).lin.

Resources