Squashfs Tools 4.0 Windows Binaries

Friday, February 5, 2010

DomoticX has built a set of varying versions of squashfs versions, including 4.3 + lzma. You can find them on the DomoticX website, lower down on the that page.

My original post:

In case you didn't know already (unless you're a multiplatform code warrior, you probably didn't), the Squashfs tools have some problems while being compiled under Cygwin. In fact, they don't compile at all, mainly because a few lacking headers and multiprocessor detection. Nevertheless, actually convincing them to build isn't difficult at all.
To save you the extra work of doing so, I've created a patch, which can be applied against the aforementioned 4.0 version of the squashfs-tools, and I've made it available here: http://www.mediafire.com/?1txydxozzdo
If you're too lazy to patch and build your own, I've also uploaded the binaries. These don't actually need Cygwin to be installed, as long as the 2 .dll files remain in the same folder (or in the PATH) as the executables. Get those from here (tar.gz archive): http://www.mediafire.com/?yymd2mzlmnn

Edit: Upon user request, I have also compiled and uploaded squashfs 3.0, 3.1 and 3.4, and their corresponding patches:
FileDownload Link
SquashFS 3.0 Cygwinbinaries (tar.gz)
SquashFS 3.1 Cygwinbinaries (tar.gz)
SquashFS 3.4 Cygwinbinaries (tar.gz)
SquashFS 4.0 Cygwinbinaries (tar.gz)


  1. hello. Can you also patch and compile Squashfs version 3.0 for windows. thanks

  2. Here you go, Joe. I've built 3.0 and 3.4, so you have what to pick from. Let me know how they work. ;)

  3. Thanks alot for your fast response and your kind help. your compiled 3.0 works but somehow alittle bit different than the versions i have. it does not have a progress indicator like 3.4 or later. Maybe not in its source code.

    My real and biggest problem is i have squashfs image. i have extracted with unsquashfs.exe without a problem but my problem is when i repack the same files with mksquashfs i can not get the same CRC32 value , the same size . the number of block that unsquashfs uses is 500 and mksquashfs packs with 300 blocks. this makes problem.

  4. Changing the block size is easy: pass the -b parameter to mksquashfs. It accepts a value in bytes for the block size. If you know the total block numbers, convert the original squashed file's size to bytes and divide that number to the block count, and this should result in an approximate block size value for you to use. If you edit the files in the squashed filesystem, I don't think you will be able to retain the same CRC32 value, unless you are able to produce a collision by manipulating the filesystem content.

  5. i managed to have almost the same file size only 24 bytes missing. this makes the crc32 values different. there are 20 files+ 2 folders + 2 fragments ( this makes 24). i think that there is a small paramater that i must use in mksquashfs. Do you have any idea?

  6. Even if you do manage to get the filesize to be equal for the squashfs containers, any change to the files that are stored in the filesystem will cause the CRC32 of the container to change. If the application using the squash filesystem checks its CRC32, see if there is a way to replace the old value with the new one inside the application's check routine.

  7. The image file is working properly.I did not modify the files after i extract them. i only extract and repack . i do this operation for being on the safe side for going further file modification. If i get the same CRC32 value than i will understand that i have a correct squashfs executables(unsquashfs.exe and mksquashfs.exe) for my further action. if i simplt fail during the packing process without making any modification , this means that if i go further i will have more problems.

  8. I only have 21 bytes additional to the orjinal squash image. there must be an additional command parameter for mksquashfs.exe for getting same file size and hopefully the same crc32.
    Do you have any idea for this parameter?

  9. I'm not a squashfs expert in any way, but I'd try another test. I would substitute the original image with the repacked one, and see if works in the original context (application, kernel or whatever your project is). If it does, you're free to modify it.

  10. the image is made to work on a device and i do not want to risk it by uploading in this way. If the device fails to unpack properly , it will be blocked. thanks for your all help and advice.

  11. Link to the 4.0 binary is completely broken... Mediaf****rs just reloads the page over and over and tries to push tons of popups.

  12. They do push a lot of popups, but otherwise they work for me. If you wish, drop me an e-mail address (as highly obsfucated as possible, this is still the InterWebs :D ) and I'll just send you the binaries.

  13. Hi

    I'm fiddling with ExpressGate for ASUS motherboard. It's files are saved in squashfs files. It seems that the system only accepts 3.1 squashfs files. Could you help me by compiling squashfs 3.1 for cygwin? If you haven't got the source files, I can mail them to you.
    Best regards,
    Morten Knudsen

  14. Hey Morten!
    In fact, these are cygwin binaries with the cygwin1.dll and zlib packed along with the executables. I can't really remember under what cygwin version I compiled them, but you can try to use only the executables in the archive, and omit extracting the dlls to avoid munging your cygwin environment.
    Unfortunately, I don't use Windows anymore, I do have a box around here but it's been unmaintained for a long while now. At most, if those executables don't work for you, I can compile them under mingw, and you'll be able to use them with cygwin as you would any other commandline windows program.
    Good luck!

  15. Hi Doru
    I think we misunderstood each other. ExpressGate a squashFS 3.1 archive, which apparently only Squash 3.1 Tools can make. You have compiled 3.0, 3.4 and 4.0. I'll be thankful if you could compile a 3.1 executable for Windows. The sources are here.:

  16. It looks like I was wrong about compiling them under MinGW, since squashfs requires mman and sysctl, which unfortunately aren't implemented in MinGW. I'll get my Windows box running and I hope to sort out the build by tonight (GMT+2).

  17. Okay Morten, sorted it up, the download links are in the table, up in the original post. Sorry about the confusion I made initially, I gues I was a little distracted.

  18. Hi Doru!
    Thanks a lot. It would sure be a better world if we all helped each other, like you just did! Now, I'll fiddle a little with ExpressGate again.
    Again, thank you.
    Best regards, Morten Knudsen

  19. I'm not going to get into a philosophical rant about helping people right now, but I believe that the people who are ready to fiddle with things, understand how they work and then alter them to their liking are the real hackers. In this case, I was the one providing the tools for the hacking, and I must say that I feel honored.
    Good luck in your further endeavors!

  20. Hi, I tried to run this utility on windows 7 64 bit. There is a blank cmd screen but nothing. How can I run it?

  21. Hey anon. I've never really tried these tools on any x86_64 Windows system, nor do I have one around to see what's the deal.
    If I was you, I'd first install Cygwin, then I'd try to run the executables in it (discarding the cygwin1.dll and cygz.dll libraries, so that the ones in your cygwin install will be used).
    If that doesn't work, try downloading the original sources, patching them with my patch (cd to sources, patch -P0 < my_patch) and then compile them...

  22. Thank you. I used your good work. My Linux PC is broken. I WORK IT IN WINDOWS PC BY YOUR`s

  23. Should possible to have a set of tools like


    that are using the same cygwin.ddl and cygz.dll?

    In this way it's possible to handle different swaushfs version without overwrite different file name (.exe) of tools.

    Thanks. Bye.

  24. Hey Anon :D
    In theory it should be possible to put all versions in a single place, but I haven't tested that. A possible cause of problems is that some of the tools might be build on slightly different cygwin versions, but I don't know whether that would be a real problem or not.
    Try it out, see if the tools start up. Eventually, report back, if they do I will also make available an archive containing all the tools.

  25. I get this error message:

    Microsoft Windows XP [version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.




    assertion "root_idx != -1" failed: file "/ext/build/netrel/src/cygwin-1.7.1-1/wi
    nsup/cygwin/mount.cc", line 363, function: void mount_info::init()
    Stack trace:
    Frame Function Args
    002399B8 7C802542 (000007D8, 0000EA60, 000000A4, 00239AAC)
    00239AC8 610BADB3 (00000000, 7C802600, 7C802542, 00000000)
    00239BA8 610B7A37 (00000000, 00000000, 00000000, 00000000)
    00239BF8 610B7E4B (00007C2C, 00239C20, 000007EC, 00239C38)
    00239CB8 610B7F71 (00007C2C, 00000006, 00239CE8, 610B8015)
    00239CC8 610B7FAC (00000006, 0023CE88, 00008088, 00008088)
    00239CE8 610B8015 (6115D054, 61195284, 61195294, 0000016B)
    00239D18 6100109B (61195294, 0000016B, 611956EC, 61195284)
    0023CD48 6107BD5D (60FD000C, 611D8798, 0040DDD0, 6106E8A9)
    0023CDA8 610B2AE0 (00000000, 0023CDE0, 610066E0, 7FFDF000)
    End of stack trace

    Any idea ?

  26. Hey Timothee. It looks like that error is related to the cygwin version (dlls) I used to compile squashfs on. Try replacing them with the latest ones from cygwin. If that doesn't work ping me, tell me the squasfs-tools version that you need and I'll try building it on the latest cygwin.
    Hope that helps :)

  27. Cool Work!
    But can ou also compile 4.0 with LZMA support?

    Thanks a lot

  28. same question as before:
    Any chance to get a working squashfs tools version with LZMA support

  29. Hey ppl. Regarding the last two comments: Unfortunately, I have almost completely abandoned windoze world, except for what my work requires of me. That means that I am unable to spend the time to try building such a version, to say nothing about making a half-decent attempt at testing it.
    It shouldn't be such a complex endeavor, since the lzma code probably doesn't tie into any UNIX-y API that would need to be adapted to what Cygwin provides... But this is a mere supposition.
    If anyone is willing to give a try to porting, I'll be around to help.

  30. Hi! Great job, you save my (our) behind with your windows exe's. BUT I cannot understand why they are not including all these Cygwin patches into the Sourceforge trunk!?

    As you know all about the patches, and also no longer have time to support all this work, perhaps you could add your patches to the development tree OR at least put in a request for adding them!?


    Thanks again.

  31. Hey there! I'm glad I was able to help. I don't know about the squashfs developers' plans to support windows environments, I mainly built one patch to save my own ass when working with and embedded Linux OS in a router. The others followed as people requested them and it was easy for me to get the changes into different versions.
    I'd think that they aren't catering for the embedded systems out there that are built and managed from Windows machines.
    Anyhow, if you check out their sourceforge.net patch tracker, you'll see that there is a patch for 3.4 which is rotting there from 2008...

  32. version 4.0 is perfect working
    in 6% of 2gb now
    the only thing is it say i am not a superuser
    and then dont´t extract these files

  33. Judging by a quick google search, it seems that other users complained about this error message when they were trying to extract hard links.
    Bottom line is that you are trying to extract a linux filesystem onto a windows partition, so you're bound to encounter problems. I can't help you with more involved debugging because I don't really have any windows test machines, or any squashfs images.
    For any serious development work you should install a linux distribution, it's very easy nowadays and you don't even need to repartition your hard drive...

  34. It's working but when I mount a squashfs on a linux machine it doesn’t work.

  35. Bună ziua, dragă Doru,

    I tried all existing 5 squashfs_tools, but none is working on my XP:
    squashfs_tools 4.1:
    D:\temp\Android>unsquashfs system.sfs -ll
    Parallel unsquashfs: Using 2 processors
    Read on filesystem failed because EOF
    FATAL ERROR aborting: failed to read the xattr table

    squashfs_tools 4.0:
    D:\temp\Android>unsquashfs system.sfs -ll
    Parallel unsquashfs: Using 2 processors
    0 inodes (0 blocks) to write
    2 [main] unsquashfs 6056 _cygtls::handle_exceptions: Exception: STATUS_INT
    19696 [main] unsquashfs 6056 open_stackdumpfile: Dumping stack trace to unsquashfs.exe.stackdump
    ***contents of stackdump***
    Exception: STATUS_INTEGER_DIVIDE_BY_ZERO at eip=0040D91F
    eax=00000001 ebx=00000000 ecx=00000000 edx=00000000 esi=00000000 edi=00000000
    ebp=0022CC98 esp=0022CC78 program=D:\temp\Android\unsquashfs.exe, pid 4500, thread main
    cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
    Stack trace:
    Frame Function Args
    0022CC98 0040D91F (00000000, 00000000, 00000000, 00000000)
    0022CCE8 00405AF0 (00000000, 00000000, 00000000, 00000000)
    0022CD48 00406B61 (00000003, 007183B8, 00718260, 00000001)
    0022CDA8 61006DDA (00000000, 0022CDE0, 610066E0, 7FFD8000)
    ***End of stack trace***

    squashfs_tools 3.4:
    D:\temp\Android>unsquashfs system.sfs -ll
    Filesystem on system.sfs is (4:0), which is a later filesystem version than I support!

    squashfs_tools 3.1:
    D:\temp\Android>unsquashfs system.sfs -ll
    Major/Minor mismatch, filesystem on system.sfs is (4:0)
    I only support Squashfs 3.0 filesystems! Later releases will support older Squashfs filesystems

    squashfs_tools 3.0:
    D:\temp\Android>unsquashfs system.sfs -ll
    Major/Minor mismatch, filesystem on system.sfs is (4:0)
    I only support Squashfs 3.0 filesystems! Later releases will support older Squashfs filesystems

    Any ideas?
    System.sfs is OK when booting my notebook from it.

    Mulţam fain,

  36. Hello!

    Are you sure that the image you are trying to unpack is complete? Also, do you have any idea about the application/toolchain that generated it?
    I'm asking because many squashfs images, especially the ones used in routers, are mangled in some way or another and you need to jump through a lot of hoops to unpack them (custom compression, non-standard headers, pretty much anything).

    If you have access to a linux pc or you can set up a virtual machine, try to use the native linux squashfs tools. If that fails, maybe a run with extract-ng from the Firmware Mod Kit will crack it ;)

    Good luck, and I hope to hear from you soon.

  37. Bună Doru,

    trying unsquashfs under Linux is a good idea! I have a Live Ubuntu 12.04 on an USB stick.
    I am playing with android-x86 on my HP550 notebook. The German kbd layout, file generic_de.kcm, has an error (missing @). It is inside system.sfs. I am not able to mount sysrw under android, only ro; this seems to be a known issue. So I have to unpack system.sfs, edit the file and pack it back again.
    I also found squashfs-tools v4.2, but not the .exes for windows. May I kindly ask you to create and link them at this page on top, among the others? I am not able to compile them.

    Cu bine,

  38. Hello again!

    Technically, even if you did manage to remount system as rw, your modifications won't go into the squashfs filesystem, as that cannot be modified by the host system. Changes should go into a read-write overlay, such as a ext2/3 file or filesystem, or some other custom solution.

    I'm not sure squashfs 4.2 would help, from the command line output you pasted previously it seems like you're dealing with a squashfs 4.0 image. I currently don't own any windows computers (the last one died a week ago after lightning struck near my house and induced dangerous currents into the powerlines) so I am unable to build any windows squashfs binaries and test them properly. However, if you can post the squashfs image somewhere, I'll be happy to take a look and see whether I can unpack it and maybe even perform the modifications for you.


  39. Mulţam fain, dragă Doru,

    I managed to solve it like this:
    - boot Ubuntu from USB stick, SD card with Android plugged in
    - unsquashfs system.sfs from Android on Ubuntu
    - mount system.img (result of unsquashfs)
    - edit needed file and save (rw now granted :-)
    - mksquashfs back to system.sfs
    Now, Android needs a rename system.sfs -> system.img, but
    that's another story :-)

    o zi bună,

  40. Great job, I'm glad that you managed to fix it ;)
    Manipulating the squashfs filesystem this way on a windows partition could give rise to other problems, like losing the file permissions and probably messing up symlinks, so doing it in Linux was definitely the way to go.

  41. I had the unsquashfs 6056 _cygtls::handle_exceptions: Exception: STATUS_INT
    EGER_DIVIDE_BY_ZERO error, running on Windows 7 64bits.
    The, i finaly launched the cmd.exe as administrator (right click on it) and simply did unsquashfs.exe myimage.squashfs, without specyfying any path and it worked fine.


  42. hello, pretty useless binaries as they don't support lzma

  43. Pretty useless comment, since this has been talked over in the comment thread. If you need lzma support, you can get the sources for the version you need, apply my patch then try to make lzma cooperate with cygwin...

    1. Doru can you add me to your skype or yahoo messenger ? Please. snipergod3 on skype if you want.

  44. can you make the binaries for squashfs tools 4.2 with the XZ_SUPPORT = 1 line in the Makefile uncommented? I'd like to be able to use lmza2 compression.

  45. Hi,

    for some reason, this program cannot be run from a root directory (like C:\, D:\, F:\ etc)

    Also, how can I set the uuid for the image?

  46. hi, i have some errors:
    mksquashfs.exe OpenELEC-RPi.arm-4.2.1 test.sqfs
    Parallel mksquashfs: Using 4 processors
    Creating 4.0 filesystem on test.sqfs, block size 131072.
    1 [main] mksquashfs 8940 _cygtls::handle_exceptions: Exception: STATUS_ACC
    1651 [main] mksquashfs 8940 open_stackdumpfile: Dumping stack trace to mksqua
    1651 [main] mksquashfs 8940 open_stackdumpfile: Dumping stack trace to mksqua

  47. Hi All,

    I've made my own compile of the SquashFS Tools due to LZMA usage.

    This is v4.3 of the SquashFS Tools with max (de)compressor support!
    Compiled with Cygwin on Windows 8.1, compiler: GCC v4.9.2

    Added support for:
    - LZMA v5.5.0
    - LZO v2.09
    - LZ4 r129

    Download: http://domoticx.com/bestandssysteem-squashfs-tools-linux/
    Scrolll down to the end of the page!
    Filename: squashfs_tools-4.3-i686-windows-cygwin_(lzma+lzo+lz4).7z


  48. This comment has been removed by the author.

  49. *** NEW BUILD ***
    Added LZMA1 support and updated LZ4 to r130

    This is v4.3 of the SquashFS Tools with max (de)compressor support!
    Compiled with Cygwin on Windows 8.1, compiler: GCC v4.9.2

    Added support for:
    - LZMA v4.65
    - LZMA2 (XZ) v5.5.0
    - LZO v2.09
    - LZ4 r130

    Download @ http://domoticx.com/?p=2454
    Scrolll down to the end of the page!
    Filename: squashfs_tools-4.3-i686-windows-cygwin_(lzma+lzma2+lzo+lz4).7z

  50. How to build Squashfs Tools with all method compression

    1. Download latest Squashfs Tools source code (https://github.com/plougher/squashfs-tools/archive/master.zip) and Cygwin Net Release Setup Program (http://cygwin.com/setup-x86.exe).
    2. In window "Select Packages" set View - Full and select next package:
    - gcc-core: GNU Compiler Collection (C, OpenMP)
    - make: The GNU version of the 'make' utility
    - liblzma-devel: LZMA de/compressor library (development)
    - liblzo2-devel: LZO data compression library (development)
    - liblz4-devel: LZ4 de/compressor
    3. Add c:\cygwin\bin to system variable Path.
    4. Unpack squashfs-tools-master.zip in c:\cygwin.
    5. In c:\cygwin\squashfs-tools-master\squashfs-tools\Makefile uncomment (Notepad++ to help you) the following lines:
    #XZ_SUPPORT = 1
    #LZO_SUPPORT = 1
    #LZ4_SUPPORT = 1
    6. Start Cygwin Terminal and run: cd /squashfs-tools-master/squashfs-tools && make EXTRA_CFLAGS="-Dlinux -DFNM_EXTMATCH='(1<<5)' -D'sigtimedwait(a,b,c)=sigwaitinfo(a,b)'".

    For work Squashfs Tools on other PCs, you need to put with exe next files - cygwin1.dll, cyggcc_s-1.dll, cygz.dll, cyglzma-5.dll, cyglz4-1.dll from the directory c:\cygwin\bin.

    http://www.mediafire.com/download/d8j4t9cnmhm17cc/Squashfs-tools-v4.3.7z - Squashfs Tools v4.3 binaries with all kinds of compression (the archive will be updated as releas enew versions of the components).