# SquashFS error mounting 2005.1 LiveCD initrd

## Lightspeed

I'm trying to access the files from the initrd used on the 2005.1 x86 minimal LiveCD. In the past this has been possible by gunzipping gentoo.igz from the isolinux directory on the LiveCD and then simply mounting it as follows:

```
mount -o loop,ro install-x86-minimal-2005.1.iso /mnt/iso1

gunzip -c /mnt/iso1/isolinux/gentoo.igz > gentoo

mount -o loop,ro gentoo /mnt/iso2
```

This would work fine with previous LiveCDs, autodetecting the loopback FS as being ext2.

However doing this for 2005.1 fails with the following message:

```
ioctl: LOOP_CLR_FD: Device or resource busy

mount: you must specify the filesystem type
```

And dmesg | tail shows:

```
SQUASHFS error: Can's find a SQUASHFS superblock on loop1
```

It is clear to see that gentoo.igz in 2005.1 is far larger than it ever was before, so something has definitely changed, but how can I mount it now? How can I work out what filesystem is used, or does anyone already know?

Thanks for any help!

----------

## cellularmitosis

I am encountering the same problem with the gentoo.igz being used in catalyst generated livecd's.

running 'file' on the gunzipped gentoo.igz reveals this:

/tmp/initramfs-genkernel-x86-2.6.12-gentoo-r10: ASCII cpio archive (SVR4 with no CRC)

however, piping it through cpio -t shows only this:

gandalf tmp # cat initramfs-genkernel-x86-2.6.12-gentoo-r10 | cpio -t

.

bin

dev

dev/null

dev/tty1

dev/console

etc

etc/fstab

sys

var

var/lock

var/lock/dmraid

usr

usr/bin

usr/sbin

proc

sbin

temp

lib64

5 blocks

now, considering this cpio archive is 1.6M, there must be more files in that archive, but I can't seem to access them.

----------

## GentooBox

I also want to mount the gentoo.igz file so that i can edit it.

but i have the same problem.

 *Quote:*   

> 
> 
> ioctl: LOOP_CLR_FD: Device or resource busy
> 
> mount: you must specify the filesystem type
> ...

 

dmesg tells me this:

 *Quote:*   

> 
> 
> Unknown EII protocol 0806: csum at 18442
> 
> FAT: invalid media value (0x64)
> ...

 

----------

## GentooBox

as cellularmitosis said, its a cpio archive. not one, but 10.

my cpio cant read all 10 archives, only the first (like cellularmitosis)

----------

## wbreeze

this may not be very usefull for someone wanting to edit the initramfs, but if you want to see whats in it:

```
localhost boot # zcat initramfs-genkernel-x86-2.6.12.5 | cpio -itv

drwxr-xr-x  11 root     root            0 Oct  4 09:36 .

drwxr-xr-x   2 root     root            0 Oct  4 09:36 dev

crw-rw----   1 root     root       5,   1 Oct  4 09:36 dev/console

crw-rw----   1 root     root       1,   3 Oct  4 09:36 dev/null

crw-------   1 root     root       4,   1 Oct  4 09:36 dev/tty1

drwxr-xr-x   2 root     root            0 Oct  4 09:36 bin

drwxr-xr-x   2 root     root            0 Oct  4 09:36 etc

-rw-r--r--   1 root     root           93 Oct  4 09:36 etc/fstab

drwxr-xr-x   4 root     root            0 Oct  4 09:36 usr

drwxr-xr-x   2 root     root            0 Oct  4 09:36 usr/bin

drwxr-xr-x   2 root     root            0 Oct  4 09:36 usr/sbin

drwxr-xr-x   2 root     root            0 Oct  4 09:36 proc

drwxr-xr-x   2 root     root            0 Oct  4 09:36 temp

drwxr-xr-x   2 root     root            0 Oct  4 09:36 sys

drwxr-xr-x   3 root     root            0 Oct  4 09:36 var

drwxr-xr-x   3 root     root            0 Oct  4 09:36 var/lock

drwxr-xr-x   2 root     root            0 Oct  4 09:36 var/lock/dmraid

drwxr-xr-x   2 root     root            0 Oct  4 09:36 sbin

lrwxrwxrwx   1 root     root            6 Oct  4 09:36 lib64 -> ../lib

5 blocks

```

notice the 5 blocks at the bottom?

now try

```
localhost boot # zcat initramfs-genkernel-x86-2.6.12.5 | dd skip=5 | cpio -itv

drwxr-xr-x   5 root     root            0 Oct  4 09:36 .

drwxr-xr-x   2 root     root            0 Oct  4 09:36 etc

-rwxr-xr-x   1 root     root        15316 Oct  4 09:36 etc/initrd.scripts

-rwxr-xr-x   1 root     root         1649 Oct  4 09:36 etc/initrd.defaults

drwxr-xr-x   2 root     root            0 Oct  4 09:36 sbin

skip a few

-rwxr-xr-x   2 505      users        2823 May 12  2001 lib/keymaps/us.map

-rwxr-xr-x   2 505      users           0 May 12  2001 lib/keymaps/42.map

-rwxr-xr-x   2 505      users        2823 May 12  2001 lib/keymaps/wangbe.map

-rwxr-xr-x   1 will     wheel         593 Sep 10  2003 lib/keymaps/keymapList

338 blocks

```

now the rest of the math someone else will figure out because I don't know what to do next. You might try 338+5

will

----------

## mmike

have you tried to compile your kernel with squashfs support?

----------

## HaraldJ

Hi,

I am having some problems understanding this. 

I have made two scripts to extract and glue togheter a 2005.1-r1 Gentoo Minimal LiveCD's gentoo.igz

```
#!/bin/sh

#

# This will extract all 10 cpio images in the gentoo.igz initrd image to 10 different folders.

#

mkdir cpio1 cpio2 cpio3 cpio4 cpio5 cpio6 cpio7 cpio8 cpio9 cpio10

cd cpio1

zcat ../gentoo.igz | dd skip=0       | cpio --extract 

cd ../cpio2

zcat ../gentoo.igz | dd skip=5       | cpio --extract 

cd ../cpio3

zcat ../gentoo.igz | dd skip=343    | cpio --extract 

cd ../cpio4

zcat ../gentoo.igz | dd skip=1827    | cpio --extract 

cd ../cpio5

zcat ../gentoo.igz | dd skip=2703    | cpio --extract 

cd ../cpio6

zcat ../gentoo.igz | dd skip=2809    | cpio --extract 

cd ../cpio7

zcat ../gentoo.igz | dd skip=9805    | cpio --extract 

cd ../cpio8

zcat ../gentoo.igz | dd skip=11929    | cpio --extract 

cd ../cpio9

zcat ../gentoo.igz | dd skip=13057    | cpio --extract 

cd ../cpio10

zcat ../gentoo.igz | dd skip=18960    | cpio --extract 

cd ..

echo "Done!"

exit
```

```

#!/bin/sh

#

# This will glue the content from the 10 folders created in previous script toghether.

# And gzip it to file initrd.igz with max compression.

#

STOPAT=11

STARTAT=1

echo "Creating 10 cpio archives" 

while [ "$STARTAT" -lt "$STOPAT" ]

do

   cd cpio$STARTAT

   find -depth -print | cpio -o -H crc > ../cpio$STARTAT.archive

   cd ..

    STARTAT=`expr $STARTAT + 1`

done

echo "Done, creating cpio archives"

echo "Starting to glue the archives togheter"

cat \

 cpio1.archive \

 cpio2.archive \

 cpio3.archive \

 cpio4.archive \

 cpio5.archive \

 cpio6.archive \

 cpio7.archive \

 cpio8.archive \

 cpio9.archive \

 cpio10.archive \

> initrd

echo "Done with the glue"

echo "Compressing the initrd with gzip"

gzip -9 -c initrd > initrd.igz

echo "Cleaning up"

rm cpio*.archive

rm initrd

echo "Done!"

exit

```

Problem!

The glued toghether version does not work.

The kernel gives the following error:

PCI: Cannot allocate resorce region 4 of device 0000:00:07.1

RAMDISK: incomplete write (-28 != 32768) 8388608

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)

If I uncompless the original gentoo.igz and my initrd.igz using gunzip I can see that the files are exactly the same size.

Still only the gentoo.igz works.

Can anyone shed some light on this? I am a bit   :Confused:  now...   :Very Happy: 

----------

## HaraldJ

I figured it out.

Here is the scipts I used to extract the CPIO archives and one to put it all back togheter.

cpio-extract.sh

```

#!/bin/sh 

# 

# This will extract all 10 cpio images in the gentoo.igz initrd image to 

10 different folders. 

# 

mkdir cpio1 cpio2 cpio3 cpio4 cpio5 cpio6 cpio7 cpio8 cpio9 cpio10 

cd cpio1 

zcat ../gentoo.igz | dd skip=0       | cpio -idv 

cd ../cpio2 

zcat ../gentoo.igz | dd skip=5       | cpio -idv 

cd ../cpio3 

zcat ../gentoo.igz | dd skip=343    | cpio -idv 

cd ../cpio4 

zcat ../gentoo.igz | dd skip=1827    | cpio -idv 

cd ../cpio5 

zcat ../gentoo.igz | dd skip=2703    | cpio -idv 

cd ../cpio6 

zcat ../gentoo.igz | dd skip=2809    | cpio -idv 

cd ../cpio7 

zcat ../gentoo.igz | dd skip=9805    | cpio -idv 

cd ../cpio8 

zcat ../gentoo.igz | dd skip=11929    | cpio -idv 

cd ../cpio9 

zcat ../gentoo.igz | dd skip=13057    | cpio -idv 

cd ../cpio10 

zcat ../gentoo.igz | dd skip=18960    | cpio -idv 

cd .. 

echo "Done!" 

exit

```

cpio-glue.sh

```

#!/bin/sh 

# 

# This will glue the content from the 10 folders created in previous script toghether. 

# And gzip it to file initrd.igz with max compression. 

# 

STOPAT=11 

STARTAT=1 

echo "Creating 10 cpio archives" 

while [ "$STARTAT" -lt "$STOPAT" ] 

do 

   cd cpio$STARTAT 

   find . | cpio --quiet --dereference -o -H newc > ../cpio$STARTAT.archive 

   cd .. 

    STARTAT=`expr $STARTAT + 1` 

done 

echo "Done, creating cpio archives" 

echo "Starting to glue the archives togheter" 

cat cpio1.archive cpio2.archive cpio3.archive cpio4.archive cpio5.archive cpio6.archive cpio7.archive cpio8.archive cpio9.archive cpio10.archive > initrd 

echo "Done with the glue" 

echo "Compressing the initrd with gzip" 

gzip -9 -c initrd > initrd.igz 

echo "Cleaning up" 

rm cpio*.archive 

rm initrd 

echo "Done!" 

exit 

```

There is some errors regarding linuxrc and lib64 when running the cpio-glue.sh script. But the initramfs works..

----------

## irondog

Did it in C:

https://forums.gentoo.org/viewtopic-p-2749207-highlight-.html#2749207

----------

