[FS#960] x86: squashfs: overlay too small (108KB)

LEDE Bugs lede-bugs at lists.infradead.org
Mon Aug 14 05:50:47 PDT 2017


The following task has a new comment added:

FS#960 - x86: squashfs: overlay too small (108KB)
User who did this - Charlemagne Lasse (charlemagnelasse)

----------

root@(none):/# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 2.3M      2.3M         0 100% /rom
tmpfs                    58.5M     40.0K     58.5M   0% /tmp
/dev/loop0              101.0K      8.0K     86.0K   9% /overlay
overlayfs:/overlay      101.0K      8.0K     86.0K   9% /
tmpfs                   512.0K         0    512.0K   0% /dev
root@(none):/# grep /sys/block/loop0/loop/*
root@(none):/# grep '' /sys/block/loop0/loop/*
/sys/block/loop0/loop/autoclear:0
/sys/block/loop0/loop/backing_file:/sda2
/sys/block/loop0/loop/dio:0
/sys/block/loop0/loop/offset:2359296
/sys/block/loop0/loop/partscan:0
/sys/block/loop0/loop/sizelimit:0
root@(none):/# grep '' /sys/block/loop0//*
/sys/block/loop0//alignment_offset:0
/sys/block/loop0//capability:250
/sys/block/loop0//dev:7:0
/sys/block/loop0//discard_alignment:0
/sys/block/loop0//ext_range:256
/sys/block/loop0//inflight:       0        0
/sys/block/loop0//range:1
/sys/block/loop0//removable:0
/sys/block/loop0//ro:0
/sys/block/loop0//size:223
/sys/block/loop0//stat:      24        0      271        0      148        0      160        0        0        0        0
/sys/block/loop0//uevent:MAJOR=7
/sys/block/loop0//uevent:MINOR=0
/sys/block/loop0//uevent:DEVNAME=loop0
/sys/block/loop0//uevent:DEVTYPE=disk
root@(none):/# grep ''  /sys/block/sda/sda2/*
/sys/block/sda/sda2/alignment_offset:0
/sys/block/sda/sda2/dev:8:2
/sys/block/sda/sda2/discard_alignment:0
/sys/block/sda/sda2/inflight:       0        0
/sys/block/sda/sda2/partition:2
/sys/block/sda/sda2/ro:0
/sys/block/sda/sda2/size:4831
/sys/block/sda/sda2/start:33792
/sys/block/sda/sda2/stat:      51     1873     4063        0       10       70      160        0        0        0        0
/sys/block/sda/sda2/uevent:MAJOR=8
/sys/block/sda/sda2/uevent:MINOR=2
/sys/block/sda/sda2/uevent:DEVNAME=sda2
/sys/block/sda/sda2/uevent:DEVTYPE=partition




----

Tried to mount it on an Debian system using:


sudo kpartx -av lede-17.01.2-x86-generic-combined-squashfs.img         
add map loop1p1 (254:3): 0 32768 linear 7:1 512
device-mapper: resume ioctl on loop1p2 failed: Invalid argument
create/reload failed on loop1p2


It looks like the image is smaller than the allocated blocks in the partition table. I therefore had to:


sudo truncate -s 4G lede-17.01.2-x86-generic-combined-squashfs.img
sudo kpartx -av lede-17.01.2-x86-generic-combined-squashfs.img
sudo losetup --offset=2359296 /dev/loop7 /dev/mapper/loop1p2
sudo mount /dev/loop7 /mnt


This gave me an error:


mount: wrong fs type, bad option, bad superblock on /dev/loop7,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.


I know now that the image will be initialized during booting. I have tested now whether it works after my "truncate" call. And yes, it works now. The problem which must be fixed is the too small file which is smaller than the images in the partition table.

----------

More information can be found at the following URL:
https://bugs.lede-project.org/index.php?do=details&task_id=960#comment3240



More information about the lede-bugs mailing list