24

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 ?

  • On Mac OS X you can just double click the file and it decompresses on the spot. #ElCapitan – Jacksonkr Apr 6 '16 at 16:13
  • On Windows, you can use 7-zip to decompress xz files. – Hydraxan14 May 27 '16 at 14:50
  • tar is for manipulating tar files; it is not a compression utility. But since tar automatically decompresses tar files before extracting them, people get confused... – Hydraxan14 May 27 '16 at 15:09
24

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

.

  • 3
    If you wish to retain the original file, add -k or --keep to the command. – Hydraxan14 May 27 '16 at 14:38
  • For example, xz -d -k kali-1.1.0-rpi2.img.xz. – Hydraxan14 May 27 '16 at 14:54
  • What about the -d flag, @Hydraxan14 ? – Sopalajo de Arrierez Jan 29 '17 at 11:47
  • From the xz man page: unxz is equivalent to xz --decompress. -d is short version of --decompress. – Hydraxan14 Jan 30 '17 at 17:01
17

You can use xzcat and dd together.

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

It retains original file.

  • This is definitely better than the unxz solution. For storage purpose, you can keep the img.xz as it is. – Dushyant Bangal May 4 '18 at 19:45
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

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

gunzip openhabianpi-raspbian-201804031720-gitdba76f6-crc9e93c3eb.img.xz
  • 1
    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 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. – user101663 Apr 18 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 at 7:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.