Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extract tar the tar.bz2 file error

Tags:

linux

tar

fedora

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?

like image 463
Vincent Huang Avatar asked Nov 16 '14 15:11

Vincent Huang


People also ask

How do I extract a TAR bz2 file?

To extract (unzip) a tar. bz2 file simply right-click the file you want to extract and select “Extract”. Windows users will need a tool named 7zip to extract tar.

How do I unzip a TAR bz2 file in Linux?

How to Unzip tar. bz2 file. You can use Linux tar command with option -j to extract bz2 file. As this is a Tar compressed file, You also need to use -x command line option.


2 Answers

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.

like image 123
Kevin S Avatar answered Sep 23 '22 20:09

Kevin S


I solved it using:

aptitude install bzip2 
like image 22
vsxen Avatar answered Sep 23 '22 20:09

vsxen