55

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
  • 553
  • 1
  • 4
  • 4

5 Answers5

49

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
44

You can use xzcat and dd together.

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

It retains original file.

goldilocks
  • 58,859
  • 17
  • 112
  • 227
Stenyg
  • 541
  • 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
  • 2
    This cannot work if the file is really xz compressed as its prefix .xz indicates. gunzip can only uncompress files in gzip format. You have to use unxz. – Ingo Apr 18 '19 at 21:37
  • Thanks. Interesting... Well, I've just unarchived it and also etched the image on the sdcard. I didn't start the openhabian installation actually to see if the image is valid, but I'll do it next days and let you know the result. –  Apr 18 '19 at 23:03
  • With unix, file names doesn't matter. You can name a file as you like no matter what type it is. It's possible to name a file with prefix .xz but in real it is a gzip compressed file. Check the real file type with file ./filename.xz. – Ingo Apr 19 '19 at 07:23