OpenWrt Forum Archive

Topic: Trying to mount/extract a squashfs router firmware

The content of this topic has been archived on 22 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi all, thanks in advance for any help you can give me on this.

I have a img file of a stock netgear firmware I'm trying to mount or extract on a linux system. I dd'd the header off of the file and it now starts with SQSH at offset 0. unsquashfs seems to be able to read what it's supposed to:

root@Apoc:/home/pathos/wnr2000v3# unsquashfs -s squashfs.img 
Reading a different endian SQUASHFS filesystem on squashfs.img
Found a valid big endian SQUASHFS 3:0 superblock on squashfs.img.
Creation or last append time Thu Jun  3 22:14:14 2010
Filesystem is not exportable via NFS
Inodes are compressed
Data is compressed
Fragments are compressed
Check data is not present in the filesystem
Fragments are present in the filesystem
Always_use_fragments option is not specified
Duplicates are removed
Filesystem size 2914.08 Kbytes (2.85 Mbytes)
Block size 65536
Number of fragments 62
Number of inodes 871
Number of uids 1
Number of gids 0

When I try to list or extract the contents of it, here's what I get.

root@Apoc:/home/pathos/wnr2000v3# unsquashfs -l squashfs.img  
Reading a different endian SQUASHFS filesystem on squashfs.img
Parallel unsquashfs: Using 1 processor
zlib::uncompress failed, unknown error -3
read_block: failed to read block @0x2d86e5
read_fragment_table: failed to read fragment table block
FATAL ERROR aborting: failed to read fragment table

Anyone got any ideas? I would be much appreciative! Thanks

path0s wrote:

When I try to list or extract the contents of it, here's what I get.

root@Apoc:/home/pathos/wnr2000v3# unsquashfs -l squashfs.img  
Reading a different endian SQUASHFS filesystem on squashfs.img
Parallel unsquashfs: Using 1 processor
zlib::uncompress failed, unknown error -3
read_block: failed to read block @0x2d86e5
read_fragment_table: failed to read fragment table block
FATAL ERROR aborting: failed to read fragment table

Anyone got any ideas? I would be much appreciative! Thanks

The standard Linux squashfs only supports gzip compression, but OpenWrt and other embedded systems also use the LZMA variant.  I think you'll have to compile unsquashfs yourself with LZMA support enabled if you want to read the image.

Ahh.. Ok.. trying not to be spoon fed here smile but do you know of a how-to anywhere? I seriously can't seem to wade through all the junk on google to find the relevant info. Closest thing I've been able to find is how to recompile the squashfs kernel module for lzma.. I'm assuming all that isn't necessary just to extract the image?

Aha.. Got it done. Found a working unsquashfs-lzma v3 that worked from an old openwrt buildroot I had on this linux box smile Now to figure out how to put this netgear into debug mode, looks like it starts up a telnetd then.

Anyway, thanks again for the tip on lzma!

do you have an unsquashfs version wich is able to handle the case when we have this error:  "zlib::uncompress failed, unknown error -3", i've tried evrery unsquashfs lzma version i can find with no luck, thank you

The discussion might have continued from here.