Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS#3036 - x86-64-generic-squashfs-rootfs.img image won't boot #7818

Closed
openwrt-bot opened this issue Apr 22, 2020 · 13 comments
Closed

FS#3036 - x86-64-generic-squashfs-rootfs.img image won't boot #7818

openwrt-bot opened this issue Apr 22, 2020 · 13 comments
Labels

Comments

@openwrt-bot
Copy link

Darlelet:

  • Using [[https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=8d9b36270b1faecdf8c9632e0f18251df9a0990c|8d9b36270b1faecdf8c9632e0f18251df9a0990c]]@openwrt.git (master branch)
  • compiling for generic x86_64 system

openwrt-x86-64-generic-squashfs-rootfs.img (coupled with openwrt-x86-64-generic-kernel.bin) won't boot due to incorrect squashfs image generation.

Related bootlog:

[ 1.777677] F2FS-fs (xvda): Magic Mismatch, valid(0xf2f52010) - read(0x84289960) [ 1.777713] F2FS-fs (xvda): Can't find valid F2FS filesystem in 1th superblock [ 1.778325] F2FS-fs (xvda): Magic Mismatch, valid(0xf2f52010) - read(0x4e8ee223) [ 1.778357] F2FS-fs (xvda): Can't find valid F2FS filesystem in 2th superblock [ 1.778407] List of all partitions: [ 1.778431] ca00 4207 xvda [ 1.778433] driver: vbd [ 1.778468] No filesystem could mount root, tried: [ 1.778470] ext3 [ 1.778487] ext2 [ 1.778495] ext4 [ 1.778504] squashfs [ 1.778512] iso9660 [ 1.778520] f2fs [ 1.778529] [ 1.778547] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(202,0) This used to work fine on [[https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=97940f876616ad3b6ff7f88d0c1303eaff774a0a|97940f876616ad3b6ff7f88d0c1303eaff774a0a]] (openwrt-x86-64-vmlinuz+openwrt-x86-64-rootfs-squashfs.img) using same build parameters.

Test environment: XenServer x86_64

@openwrt-bot
Copy link
Author

@openwrt-bot
Copy link
Author

Darlelet:

$ sudo mount -t squashfs openwrt-x86-64-generic-squashfs-rootfs.img /mnt (master✱)
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.

@openwrt-bot
Copy link
Author

tmn505:

Can You try with this reverted: https://git.openwrt.org/282e7862b77eb32cfff14a7b8e15089b94a9c3f9 ?

@openwrt-bot
Copy link
Author

Darlelet:

Found the culprit:

-nopad option populated in include/image.mk (Image/mkfs/squashfs)
The resulting filesystem will be padded to a multiple of 4 Kb: this is required for filesystems to be used on block devices. If you are very sure you don't ned this, use the -nopad option to disable this operation.

Without this option, the final squashfs image is OK and system boots fine.
The weird thing is that this option was already set in [[https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=97940f876616ad3b6ff7f88d0c1303eaff774a0a|97940f876616ad3b6ff7f88d0c1303eaff774a0a ]](prior to the bug), so this is a side effect I guess.

Meanwhile, if removing this option does not incur any unwanted side effect, this could be used as a workaround.

@openwrt-bot
Copy link
Author

Darlelet:

@tm505 i'm gonna give it a try

@openwrt-bot
Copy link
Author

Darlelet:

Didn't help, https://git.openwrt.org/282e7862b77eb32cfff14a7b8e15089b94a9c3f9 seems harmless

@openwrt-bot
Copy link
Author

@openwrt-bot
Copy link
Author

Darlelet:

Yes indeed.

New x86 (generic) image generation was introduced in https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=5a5df62d95f52892c9a24fe1216796a2a903e544 and https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=cb007a7bf6199ebca89f79c8ee5f9b1807a0c5b0

From the later, squashfs standalone image isn't generated anymore (only combined images, no more rootfs-squashfs.img)

The following commit https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=258f070d1a4fe1808b654f58f50779fd0afafa1a adds standalone squashfs back, but the resulting image is broken (see the original bug report)

I won't spend more time looking for a "clean fix", as someone might already know why the new image generation process breaks squashfs image.

Meanwhile, as mentioned earlier in this topic, removing the -nopad option from the mksquashfs4 command invocation in include/image.mk could be used as a workaround (assuming it does not cause any side effect) to make squashfs-rootfs image functional again.

@openwrt-bot
Copy link
Author

tmn505:

The only difference between old and new squashfs rootfs images is that the old one was padded but the new one isn't. You can pad the image Yourself, assuming CONFIG_TARGET_ROOTFS_PARTSIZE=104 then:
dd if=openwrt-x86-64-generic-squashfs-rootfs.img of=openwrt-x86-64-generic-squashfs-rootfs.img.new bs=109051904 conv=sync

Would be nice if You could test it.

@openwrt-bot
Copy link
Author

Darlelet:

Yes, def a padding issue.

Padding the image to its "real" size makes squashfs mount handler happy again :)

This is it I guess, padding is only done for combined images under Build/combined (target/linux/x86/image/Makefile), this should be done for squashfs images too. (or at least available through menuconfig option)

Thanks for your help

@openwrt-bot
Copy link
Author

ynezz:

Can you try following proposed fix https://patchwork.ozlabs.org/project/openwrt/patch/20200425105617.26258-1-ynezz@true.cz/ ?

@openwrt-bot
Copy link
Author

Darlelet:

Proposed patch works fine

@openwrt-bot
Copy link
Author

aparcar0:

Hi, tested with qemustart script and it works, thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant