Extract tar the tar.bz2 file error - linux

I tried to extract the tar.bz2 file in Fedora 17 OS. I used the command:
# tar -xvjf myfile.tar.bz2
I received this error message:
tar (child):bzip2: Cannot exec :Nosuch of file or directory
tar (child): Error is not recoverable: exitng now
tar: Child returned status 2
tar:Error is not recoverable: exitng now
How can I resolve this?

Ensure that you have the bzip2 and bzip2-libs RPMs installed.
It looks like the tar command defers to the bzip2 command which the bzip2 RPM provides (/usr/bin/bzip2). In your case, tar specifically tries to call bzip2 -d to decompress the bzipped archive.
Also, a couple of tips:
The -v option is not necessary. It just gives verbose output, which means that it lists the files that were extracted from the archive. Most of the time this prints useless data to your terminal.
As #Skynet said, it is helpful to run the file command on your bzip2 archive to ensure that it is actually in bzip2 format.
As #Odin said, it appears that you don't need to specify the -j option when extracting the archive, as the tar command seems to be smart enough to figure this out.

I solved it using:
aptitude install bzip2

I found the same error as you in CentOS 7. It looks like this:
tar -jxvf target_gile.tar.bz2
<br>tar (child): bzip2: Cannot exec: No such file or directory
<br>tar (child): Error is not recoverable: exiting now
<br>tar: Child returned status 2
<br>tar: Error is not recoverable: exiting now
Then I installed bzip2 package : yum install bzip2
After that, I extracted again using this command: tar -jxvf target_gile.tar.bz2

You may need to install the bzip2 on your system.
yum -y install bzip2
I got the same problem . I have two server.
A: CentOS 7.6 Min install
B: Fedora 29 Workstation
On B:create a tarball with:
tar -jcvf XXX.tar.bz2 /Path_to_my_dir
Then scp this tarball to A server to decrompress it, but when I want to decompression it I got the same error.Finally it turns out that, tar could work with bzip2 but you have to install it first .

This worked for my file:
binutils-2.15.tar.bz2 (Found at http://ftp.gnu.org/gnu/binutils/)
bunzip2 your-tar-file.tar.bz2
Your file now looks like this:
your-tar-file.tar
tar xvf your-tar-file.tar
File will finish extracting

First you need to install lbzip2 package:
yum install lbzip2
then untar the file
tar file.tar.bz2
Regards

You can extract either tar.gz or tar.bz2 with this command:
tar -xvf ~/sometar.tar.bz2

this error come also if you use some wrong alias in your .bashrc/.zshrc as:
alias tar='tar -cf'
when you execute in terminal
$ tar -xf file.tar
it's been
$ tar -cf -xf file.tar
tar (child):bzip2: Cannot exec :Nosuch of file or directory
tar (child): Error is not recoverable: exitng now
tar: Child returned status 2
tar:Error is not recoverable: exitng now
so, you should not use an alias for tar or do
$ unalias tar
$ tar -xf file.tar

For bz2 you need to execute like this,
tar -jxvf
Alternatively, you can also execute like this
bunzip2 myfile.tar.bz2
For more information you should check it,
tar --help
If in doubt, run file on the archive to make sure it actually is compressed in bz2 format.

Related

Unzip signature not found

I tried to unzip https://github.com/CleanTalk/phpbb3.1-3.2-antispam/releases/tag/5.7.2
on debian 10 vps machine or linux Mint but It always returns the same error:
unzip phpbb3.1-3.2-antispam-5.7.2.zip
Archive: phpbb3.1-3.2-antispam-5.7.2.zip
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of phpbb3.1-3.2-antispam-5.7.2.zip or
phpbb3.1-3.2-antispam-5.7.2.zip.zip, and cannot find phpbb3.1-3.2-antispam-5.7.2.zip.ZIP,
period.
unzip -v is 6.0 Compiled with gcc 8.3.0 for Unix (Linux ELF)
tarball version :
tar -xvf phpbb3.1-3.2-antispam-5.7.2.tar.gz
tar: This does not look like a tar archive
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
what I'm doing wrong ?
Thanks

Rocket.chat issue

I have problem with installin Rocket.Chat server on ElementaryOS.
I try to unpack tgz file, but getting error.
Listing:
sudo apt-get install npm curl graphicsmagick
curl -L http://rocket.chat/releases/latest/download/ -o rocket.chat.tgz
tar zxvf rocket.chat.tgz
And after last command I get this error:
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
I try file rocket.chat.tgz:
rocket.chat.tgz: HTML document, UTF-8 Unicode text
Instead use this url:
curl -L https://releases.rocket.chat/latest/download -o rocket.chat.tgz

tar (child): phpMyAdmin-3.4.1-all-languages-tar.bz2: Cannot open: No such file or directory

I'm using amazon web services for the first time, I'm using the ec2 Amazon Linux instance for this. What I want to do is, I want to install PhpmyAdmin over there, so for that first of all I have already installed php, mysql and apache. After that I was trying to install phpmyAdmin. So for that I fired following commands:
cd /var/www/html
sudo chown ec2-user
wget http://www.sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/3.4.1/phpMyAdmin-3.4.1-all-languages.tar.bz2
So after this I tried to extract phpmyadmin with following command
tar -jxf phpMyAdmin-3.4.1-all-languages-tar.bz2 -C /var/www/html
After firing that command I got the following errors:
tar (child): phpMyAdmin-3.4.1-all-languages-tar.bz2: 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
Please help me out with this :-). Every comments and helps are appreciated :-). Thanks in advance.
Have you tried adding ./ before the filename to indicate the file is located in the current directory?
tar -jxf ./phpMyAdmin-3.4.1-all-languages-tar.bz2 -C /var/www/html
tar -jxf phpMyAdmin-3.4.1-all-languages.tar.bz2
This command worked.

Cannot build Mercurial from sources in CentOS

I'm trying to build Mercurial on CentOS 6, so here is what I've done so far:
I got mercurial's latest sources, file is named mercurial-2.4.1.tar.gz
I try running rpmbuild on it and I get the following:
# rpmbuild -tb mercurial-2.4.1.tar.gz
error: File /home/someuser/rpms/mercurial/mercurial-snapshot.tar.gz: No such file or directory
So I try creating the file that it wants by copying from the other guy:
# cp mercurial-2.4.1.tar.gz mercurial-snapshot.tar.gz
I try again, appears to pass the previous error:
# rpmbuild -tb mercurial-2.4.1.tar.gz
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.vV9ZXc
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd /root/rpmbuild/BUILD
+ rm -rf mercurial-snapshot
+ /usr/bin/gzip -dc /home/someuser/rpms/mercurial/mercurial-snapshot.tar.gz
+ /bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd mercurial-snapshot
/var/tmp/rpm-tmp.vV9ZXc: line 34: cd: mercurial-snapshot: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.vV9ZXc (%prep)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.vV9ZXc (%prep)
I'm not sure what is happening, my guess is that rpmbuild is not being able to create files... any ideas?
The easiest way I have found to build an RPM for CentOS that isn't already available is to find a source RPM from Fedora and do rpmbuild --rebuild on it. CentOS documents it here but seems to be down right now.
Here is a src RPM you can give a try to start with.
You don't have a /var/tmp/ directory or can't write to it. Try creating it: mkdir /var/tmp - you may have to use "sudo" for this to work, depending on the setup of your system.
I think that creating tarball by cp command is not good.
You should rename the mercurial-[version]/ directory generated after extracting the official tarball to mercuial-snapshot/ and then create zipped tar archive of the directory named mercurial-snapshot.tar.gz.
$ tar zxvf mercurial-2.4.1.tar.gz
$ mv mercurial-2.4.1 mercurial-snapshot
$ tar zcvf mercurial-snapshot.tar.gz mercurial-snapshot
The issue is that the bundled spec file has a version default of "snapshot", so it's going to look for a tar file named "mercurial-snapshot.tar.gz", and also expects the extracted directory to be "mercurial-snapshot" (so you can't just rename the tar file).
The best way (or at least, a way) to handle this is to extract the spec file, update it with the correct version and release number, then build the rpm from that.
Here's the process:
tar fxz mercurial-X.Y.tar.gz --strip-components=2 mercurial-X.Y/contrib/mercurial.spec
Place the spec file in rpmbuild/SPECS and edit it. Replace the "Version: snapshot" line with "Version: X.Y", and replace the "Release: 0" line with "Release: 1.xyz" where xyz is a custom tag so you know that you built the package yourself.
Then run rpmbuild:
rpmbuild -bb --target=i686 SPECS/mercurial.spec
Use --target=x86_64 if you're on and building for a 64-bit system.
You should then have a correctly built and named rpm file in the RPMS/$target directory.

tar: Error is not recoverable: exiting now

when I untar doctrine
-rw-r--r-- 1 root root 660252 2010-10-16 23:06 Doctrine-1.2.0.tgz
I always get this error messages
root#X100e:/usr/local/lib/Doctrine/stable# tar -xvzf Doctrine-1.2.0.tgz
.
.
.
Doctrine-1.2.0/tests/ViewTestCase.php
Doctrine-1.2.0/CHANGELOG
gzip: stdin: decompression OK, trailing garbage ignored
Doctrine-1.2.0/COPYRIGHT
Doctrine-1.2.0/LICENSE
tar: Child returned status 2
tar: Error is not recoverable: exiting now
The untar operation works, but I always get this error messages.
Any clues what I do wrong?
I would try to unzip and untar separately and see what happens:
mv Doctrine-1.2.0.tgz Doctrine-1.2.0.tar.gz
gunzip Doctrine-1.2.0.tar.gz
tar xf Doctrine-1.2.0.tar
It's possible your tar file is not zipped. I just had this same error, but all I had was a plain old tar file. So try just removing the z from your flags. The z flag unzips your tar file as well as whatever other commands you requested with other flags. i.e. try:
tar -xvf Doctrine-1.2.0.tgz
Notice I removed the z from -xvzf
If you got "Error is not recoverable: exiting now" You might have specified incorrect path references.
[me#host ~]$ tar -xvf nameOfMyTar.tar -C /someSubDirectory/
tar: /someSubDirectory: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
[me#host ~]$
Make sure you provide correct relative or absolute directory references e.g.:
[me#host ~]$ tar -xvf ./nameOfMyTar.tar -C ./someSubDirectory/
./foo/
./bar/
[me#host ~]$
Try to get your archive using wget, I had the same issue when I was downloading archive through browser. Than I just copy archive link and in terminal use the command:
wget http://PATH_TO_ARCHIVE
The problem is that you do not have bzip2 installed. The tar program relies upon this external program to do compression.
For installing bzip2, it depends on the system you are using. For example, with Ubuntu that would be on Ubuntu
sudo apt-get install bzip2
The GNU tar program does not know how to compress an existing file such as user-logs.tar (bzip2 does that). The tar program can use external compression programs gzip, bzip2, xz by opening a pipe to those programs, sending a tar archive via the pipe to the compression utility, which compresses the data which it reads from tar and writes the result to the filename which the tar program specifies.
Alternatively, the tar and compression utility could be the same program. BSD tar does its compression using lib archive (they're not really distinct except in name).
use sudo
sudo tar -zxvf xxxxxxxxx.tar.gz
Error messages
Easy way to fix this issue
First Remove files
Download file again
Extract file again ( tar -xzvf(or -xvf) FreeFileSync**.tar.gz
Had the same error code:
tar -xvfz processed.json.gz
tar: z: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
Turned out the file had the .gz extension but wasn't compressed. Just removed the .gz and opened it.

Resources