# Unable to mount squashfs

## krotuss

Hi, I am unable to mount squashfs on gentoo. When I execute:

```
mount rootfs.img /mnt/squash -o loop
```

I'll get:

```
mount: wrong fs type, bad option, bad superblock on /dev/loop0,

       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try

       dmesg | tail  or so

```

and in dmesg. output:

```
SQUASHFS error: Can't find a SQUASHFS superblock on loop0
```

Although 

```
unsquashfs rootfs.img
```

 from sys-fs/squashfs-tools-4.0 works well. So why mount command refuses to mount it?

file rootfs.img: 

```
rootfs.img: Squashfs filesystem, big endian, version 3.0, 3168438 bytes, 699 inodes, blocksize: 65536 bytes, created: Thu Jan  1 01:00:00 1970
```

----------

## Hu

It appears that =sys-fs/squashfs-tools-4.0 can unsquash legacy Squash 3 filesystems, but the kernel support does not read legacy Squash 3 filesystems.  A newly made squashfs using =sys-fs/squashfs-tools-4.0 identifies for me as Squashfs version 4.0, and is correctly mounted.  Try unsquashing your old image and making a v4 squashfs from it.

----------

## krotuss

Thanks. Thats possible, although strange. In most fs there is usually backwards compatibility, or both drivers kept in kernel. Despite  =sys-fs/squashfs-tools-4.0 can read 3.0 filesystems I wasn't able to find switch to create 3.0 filesystem, -be option doest work either.

----------

## Hu

The driver for Squashfs v3 was never in mainline, so there was no backwards compatibility to remove.  Outside distributors patched it in for many years, and finally mainline accepted a Squashfs v4 driver for inclusion.

----------

## BitJam

 *krotuss wrote:*   

> Thanks. Thats possible, although strange. In most fs there is usually backwards compatibility, or both drivers kept in kernel.

 I can verify that no backward compatibility exists in the kernel modules.  This can be a PITA.

 *Quote:*   

> Despite  =sys-fs/squashfs-tools-4.0 can read 3.0 filesystems I wasn't able to find switch to create 3.0 filesystem, -be option doest work either.

 

Do you really want to create a 3.0 squashfs?   If so, just emerge the 3.1 slotted version:

```
# emerge -av squashfs-tools:3.1
```

This will create:

```
/usr/bin/mksquashfs-3.1

/usr/bin/unsquashfs-3.1
```

The root names mksquashfs and unsquashfs will stay associated with version 4.x from the :0 slot.

----------

