Mounting issue with old uboot and new rootfs

Jaap de Jong jaap.dejong at nedap.com
Thu Dec 14 01:51:36 PST 2017



On 14-12-17 08:28, Jaap de Jong wrote:
> 
> 
> On 13-12-17 17:42, Richard Weinberger wrote:
>> Am Mittwoch, 13. Dezember 2017, 11:18:02 CET schrieb Jaap de Jong:
>>>> Does everything work as expected if you don't set the resize flag in
>>>> ubinize? Maybe this is the culprit.
>>>
>>> Yes, that was my last experiment and that works. It turns off the code
>>> in the old uboot that modifies the volume in such a way that the new
>>> kernel is not able to deal with it.
>>> The strange thing is, that an old kernel doesn't mind.
>>
>> Can you please rule out U-Boot first?
>> IOW don't attach UBI from U-Boot and load the kernel via TFTP/NFS, etc...
>> I'm still not sure whether this is a regression in Linux or U-Boot.
> Sure. Did that and then there is no corruption. The old version uboot 
> modifies the volume in a way that the new kernel can't handle. The old 
> kernel on the other hand is able to mount that 'mangled' volume.
In addition to this: In the situation where you replace the old kernel 
with a new kernel, the filesystem is damaged by the new kernel in a way 
that it is unusable. The way I reproduce this is by flashing a unit with 
an old uboot/kernel/filesystem. Start it: the old uboot resizes the fs 
and the old kernel also changes something with it. Restart with a new 
kernel. Bricked.
The first run of the new kernel shows:
  ubi0 error: ubi_read_volume_table: the layout volume was not found
  ubi0 error: ubi_attach_mtd_dev: failed to attach mtd3, error -22
  UBI error: cannot attach mtd3
  Kernel panic - not syncing: VFS: Unable to mount root fs on 
unknown-block(0,0)
  Rebooting in 1 seconds..

The last run of uboot:
  Creating 1 MTD partitions on "nand0":
  0x000000100000-0x000020000000 : "mtd=3"
  UBI: attaching mtd1 to ubi0
  UBI: physical eraseblock size:   131072 bytes (128 KiB)
  UBI: logical eraseblock size:    129024 bytes
  UBI: smallest flash I/O unit:    2048
  UBI: sub-page size:              512
  UBI: VID header offset:          512 (aligned 512)
  UBI: data offset:                2048
  UBI error: ubi_read_volume_table: the layout volume was not found
  UBI error: ubi_init: cannot attach mtd1
  UBI error: ubi_init: UBI error: cannot initialize UBI, error -22
  UBI init error -22
  UBIFS not mounted, use ubifs mount to mount volume first!
  UBIFS not mounted, use ubifs mount to mount volume first!
  UBIFS not mounted, use ubifs mount to mount volume first!
  UBIFS not mounted, use ubifs mount to mount volume first!

Same setup but bypassing the first uboot run: no issues.

To put my experiments in a table:

uboot kernel  kernel  result
       1st run 2nd run
-     old     old     fine
old   old     old     fine
new   old     old     fine

-     old     new     fine
old   old     new     bricked
new   old     new     bricked

-     new     new     fine
old   new     new     bricked
new   new     new     fine

So I see 2 issues...




More information about the linux-mtd mailing list