OpenWrt Forum Archive

Topic: mounting on loop my-image.bin

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

Hi,

How can I mount an image.bin under Linux?

TIA,
Ruzsi

Hi,

And how can I extract files from .trx?
I can't reload my .trx into my own image.bin.
When I tried reload backed up .trx my router
almost bricked. It took 2,5 hours making alive.

TIA,
Ruzsi

Hi Vincent,

It seems your description is working. I could make an fs.img and file command can see SquashFS v2.1.
My problem is now: making squashfs module fom my SuSE 9.3. I don't like compiling kernel modules
because I have to recompile vmware an Cisco vpnclient, too.

TIA,
Ruzsi

Hi,

Something is not good:
wsnote:/home/rattila # mount -t squashfs k16wrt-firmware-RC4-fs.img ./x -o loop
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

SQUASHFS error: zlib_fs returned unexpected result 0xfffffffd
SQUASHFS error: Unable to read cache block [fcff7:1aa9]
SQUASHFS error: Unable to read inode [fcff7:1aa9]
SQUASHFS error: Root inode create failed

TIA,
Ruzsi

Are you sure you have a kernel with squashfs?

Hi,

I hope.
Kernel module is loaded by me. (without any error messages)
Before I loaded it I compiled the kernel but I didn't restarted!
I don't want this kernel, only the new squashfs.ko module.

Is that a problem?

TIA,
Ruzsi

I would suggest downloading a standard linksys bin file like I did, and try to mount it.

If it works, then your file is probably not right.
If it does not work, then more likely you have problems with accessing squashfs generally.

I believe there is also potential issue of squashfs version and whether LZMA is supported or not. Squashfs is somewhat new.

(Last edited by vincentfox on 16 Mar 2006, 23:37)

the .bin file is not a straight sqashfs image, think about it.. it also has the .bin header and a kernel

Kevin, I think you didn't read the rest of the thread. We already covered how to extract the squashfs filesystem from a .bin or .trx.

Hi,

Do you have an absolutelly sure squashfs image what I could download for testing?
In my opinion, I can do the same mistake with original Linksys .bin like
with my .trx file ... and we know nothing more.
Are you agree with me?

TIA,
Ruzsi

Hi,

I think we're more clever!

wsnote:/home/rattila # hexdump -C WRT54GL_4.30.2_US_code.bin |grep hsqs
000a7b10  68 73 71 73 30 01 00 00  47 9a 21 00 43 9a 21 00  |hsqs0...G.!.C.!.|
wsnote:/home/rattila # dd bs=8 skip=85858 if=WRT54GL_4.30.2_US_code.bin of=test.img
275742+0 beolvasott rekord
275742+0 kiírt rekord
2205936 bytes (2,2 MB) copied, 1,44469 seconds, 1,5 MB/s
wsnote:/home/rattila # file test.img
test.img: Squashfs filesystem, little endian, version 2.0, 2202183 bytes, 304 inodes, blocksize: 65536 bytes, created: Mon Nov 14 11:06:22 2005
wsnote:/home/rattila # mount -t squashfs test.img ./x -o loop
wsnote:/home/rattila # df
Fájlrendszer         1K-blokk  Foglalt    Szabad    % Csatl. pont
...
/home/rattila/test.img
                          2176      2176         0 100% /home/rattila/x

And I can look inside the FS.

So go back! I'll do it again with my .trx...

TIA,
Ruzsi

Hi,

And here again with my image.trx:

wsnote:/home/rattila # hexdump -C k16wrt-firmware-RC4.trx |grep hsqs
0007aa00  d5 ff 67 c6 fc 00 00 00  68 73 71 73 40 01 00 00  |ÕÿgÆü...hsqs@...|
     (7aa08->502 280 -> 502 280 / 8 = 62 785)
wsnote:/home/rattila # dd bs=8 skip=62785 if=k16wrt-firmware-RC4.trx of=test.img
420543+0 beolvasott rekord
420543+0 kiírt rekord
3364344 bytes (3,4 MB) copied, 2,18029 seconds, 1,5 MB/s
wsnote:/home/rattila # file test.img
test.img: Squashfs filesystem, little endian, version 2.1, 1040313 bytes, 320 inodes, blocksize: 65536 bytes, created: Thu Nov 24 03:43:45 2005
wsnote:/home/rattila # mount -t squashfs test.img ./x -o loop
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

So the problem isn't in my squashfs module ... or my image is newer - version 2.1. Original Linksys image is v2.0!

TIA:
Ruzsi

Hi,

Noone can give me a little bit more help mounting my backup .trx image?
Now where is the problem? Wirh my trx file or squashfs module?

TIA,
Ruzsi

Hi,

The question is:
Can I get back my /etc files from a trx which was made as decribed in README?

Of course I can't mount on loop in my router:
root@k16wrt:~# mount k16wrt-firmware-RC4-fs.img x -o loop
mount: Could not find a spare loop device

TIA:
Ruzsi

Hi,

I could mount.
It was my mistake:
- the kmod-loop package wasn't installed
- loop module wasn't loaded.

Inspite of mounting trx I can't access my /etc which was on jffs2 ...
README said, jffs2 is after squashfs ...
How can I access my old jffs2 then?

TIA,
Ruzsi

The discussion might have continued from here.