Extracting a *.tar.bz2 file?



I always used to use this command to extract files from a bzip2 tar ball:

tar xjvf file.tar.bz2

But right now on Ubuntu 14.04, I get this error:

tar: Conflicting compression options
Try 'tar --help' or 'tar --usage' for more information.

Did something change or is this a bug?

EDIT: I think there might be a bug. I just tried running it through bunzip2 first, and then extracting everything from the resulting tar ball, and got this:

$ tar xvf file.tar
tar (child): pbzip2: Cannot exec: 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

EDIT2: This is what I get after installing pbzip2:

$ tar xf file.tar
pbzip2: producer_decompress: *ERROR: when reading bzip2 input stream
Terminator thread: premature exit requested - quitting...
tar: Child returned status 1
tar: Error is not recoverable: exiting now


Posted 2014-08-25T01:50:13.297

Reputation: 836

Are you sure someone hasn't aliased tar to tar xz or something like that? – David Schwartz – 2014-08-25T02:08:18.703

Pretty certain. I'm pretty paranoid about access on my machine, so it's rather locked down, but I ran unalias tar and got bash: unalias: tar: not found just to sure. – supercheetah – 2014-08-25T02:14:02.940

If the file were created with -z, you would get bzip2: (stdin) is not a bzip2 file – Bert – 2014-08-25T02:32:11.820

Notice that I got that error after running the original file through bunzip2 and then running tar xvf, so the error doesn't even make sense. – supercheetah – 2014-08-25T02:34:41.287

The pbzip2: cannot exec: no such file or directory leads me to ask if bzip2 is even installed? whereis bzip2 If it is not found, sudo apt-get install bzip2 – Bert – 2014-08-25T02:35:56.170

@Bert See second edit – supercheetah – 2014-08-25T02:39:06.587



My solution was to install bsdtar. I don't know why the regular tar wasn't working, but I'm going to file a bug report.


Posted 2014-08-25T01:50:13.297

Reputation: 836


You must be combining the -z and -j compression options. The first uses gzip the second uses bzip. The command tar xjvf will not give you that error.


Posted 2014-08-25T01:50:13.297

Reputation: 1 476

I promise I'm not. The command I use is exactly as I've shown it here. – supercheetah – 2014-08-25T01:56:44.963

1What does the command file file.tar.bz2 return? – Bert – 2014-08-25T02:31:37.053

1file file.tar.bz2: bzip2 compressed data, block size = 900k – supercheetah – 2014-08-25T02:35:26.543


install bzip2 and then it should be working. for example in debian/ubuntu

sudo apt-get install bzip2

or in gentoo

emerge bzip2

Chenming Zhang

Posted 2014-08-25T01:50:13.297

Reputation: 251