u-boot gives Error 22 for ubi partion , but mounts ok in linux

Issue

This Content is from Stack Overflow. Question asked by varta

I have a buildroot system, which mounts ubi ok in linux, but in u-boot I get error 22

When starting in linux this is in dmesg:

ubi0: scanning is finished
ubi0: attached mtd2 (name "rootfs", size 32 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
ubi0: good PEBs: 256, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 2/0, WL threshold: 4096, image sequence number: 894512245
ubi0: available PEBs: 0, total reserved PEBs: 256, PEBs reserved for bad PEB handling: 40
ubi0: background thread "ubi_bgt0d" started, PID 1103
--
UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "rootfs", R/O mode
UBIFS (ubi0:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
UBIFS (ubi0:0): FS size: 25649152 bytes (24 MiB, 202 LEBs), journal size 4444160 bytes (4 MiB, 35 LEBs)
UBIFS (ubi0:0): reserved for root: 0 bytes (0 KiB)
UBIFS (ubi0:0): media format: w4/r0 (latest is w4/r0), UUID 29B5D4CF-8B0B-465A-8D03-F3A464E6250E, small LPT model
UBIFS (ubi0:0): full atime support is enabled.
VFS: Mounted root (ubifs filesystem) readonly on device 0:13.

in u-boot mtd returns

device nand0 <nand0>, # parts = 4
 #: name                size            offset          mask_flags
 0: u-boot              0x00200000      0x00000000      0
 1: kernel              0x01e00000      0x00200000      0
 2: rootfs              0x02000000      0x02000000      0
 3: user                0x0c000000      0x04000000      0

active partition: nand0,0 - (u-boot) 0x00200000 @ 0x00000000

defaults:
mtdids  : nand0=nand0
mtdparts: mtdparts=nand0:0x200000@0x0(u-boot),0x1e00000@0x200000(kernel),0x2000000@0x2000000(rootfs),-(user)

but when it try to attach

=> ubi part rootfs
ubi0: attaching mtd1
UBI init error 22

It’s on an embedded system which uses older versions U-Boot 2016.11 and Linux/arm 4.4.289 Kernel
I suppose some parameter is wrong somewhere, can somebody give me some advise where to look?



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?