56

I have downloaded Kali v1.1.0 for my Raspberry Pi 2 from here.
But the file I must transfer to the SD Card is a .img.xz, not the desired .img one.

I have tried to unpack with:

$ tar -jxvf kali-1.1.0-rpi2.img.xz 
bzip2: (stdin) is not a bzip2 file. tar: Child returned status 2tar: Error is not recoverable: exiting no 

Installing the xz-utils package:

# apt-get install xz-utils 

... seems not to solve anything (it was already installed).

Same for:

$ tar -jxvf kali-1.1.0-rpi2.img.xz 

What is the correct way to extract/convert the .img.xz file to .img ?

tarsot
  • 563
  • 1
  • 4
  • 4

5 Answers5

50

Just use the unxz program:

unxz kali-1.1.0-rpi2.img.xz

Note: the original file will be removed. Only the .img file will remain. If you want to keep the original archive, use

unxz --keep kali-1.1.0-rpi2.img.xz

.

Felix
  • 103
  • 4
49

You can use xzcat and dd together.

xzcat kali-1.1.0-rpi.img.xz | dd of=/dev/SDCARDNAMEGOESHERE

It retains original file.

goldilocks
  • 60,325
  • 17
  • 117
  • 234
Stenyg
  • 591
  • 4
  • 2
2

Use 7zip. When 7zip is installed you can right click the img.xz file and excract to an .img file. Installing 7zip can be as easy as installing applications on linux by using chocolatey. Get it from https://chocolatey.org/ Once it is installed open windows powershell in admin privi's and do "choco install 7zip" other packages can be installed the same way and you can find them using https://chocolatey.org/packages to find some of your favorites. NO MORE DOWNLOAD FOLDER CLUTTER!!! YAY!

0

On Ubuntu/Debian, I like to use unp.

unp 2022-09-22-raspios-buster-armhf-lite.img.xz

Here is a little summary from its man-page:

unp is a small script with only one goal: Extract as many archives as possible, of any kind and from any path to the current directory, pre‐ serving the subdirectory structure where needed. Is a Do-What-I-Want utility and helps managing several extraction programs without looking for needed options for the particular tool or worrying about the in‐ stallation of the needed program.

wittich
  • 103
  • 4
0

If this helps, I tried gunzip on my mac, which is native, and it worked fine:

gunzip openhabianpi-raspbian-201804031720-gitdba76f6-crc9e93c3eb.img.xz