WRT3200ACM: Changes not being saved (corrupt ubi partition)

I installed file lede-17.01.0-r3205-59508e3-mvebu-linksys-wrt3200acm-squashfs-factory.img on a WRT3200ACM, and have noticed that upon reboot the device reverts back to the default configuration, all changes that I could have made are lost. Browsing the kernel messages, I found some that seem relevant:

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.4.50 (buildbot@builds-02.infra.lede-project.org) (gcc version 5.4.0 (LEDE GCC 5.4.0 r3103-1b51a49) ) #0 SMP Mon Feb 20 17:13:44 2017
[    0.000000] CPU: ARMv7 Processor [414fc091] revision 1 (ARMv7), cr=10c5387d
[...]
[    1.395971] ubi0: attaching mtd6
[    1.597695] ubi0: scanning is finished
[    1.605795] ubi0: attached mtd6 (name "ubi", size 74 MiB)
[    1.611216] ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    1.618128] ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    1.624948] ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
[    1.631940] ubi0: good PEBs: 592, bad PEBs: 0, corrupted PEBs: 0
[    1.637968] ubi0: user volume: 2, internal volumes: 1, max. volumes count: 128
[    1.645222] ubi0: max/mean erase counter: 2/0, WL threshold: 4096, image sequence number: 1298559928
[    1.654393] ubi0: available PEBs: 0, total reserved PEBs: 592, PEBs reserved for bad PEB handling: 40
[    1.663664] ubi0: background thread "ubi_bgt0d" started, PID 643
[    1.670029] block ubiblock0_0: created from ubi0:0(rootfs)
[    1.675548] ubiblock: device ubiblock0_0 (rootfs) set to be root filesystem
[...]
[    6.594733] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" started, PID 744
[    6.623113] UBIFS (ubi0:1): recovery needed
[    6.648746] ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 120832 bytes from PEB 161:4096, read only 120832 bytes, retry
[    6.670767] ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 120832 bytes from PEB 161:4096, read only 120832 bytes, retry
[    6.692787] ubi0 warning: ubi_io_read: error -74 (ECC error) while reading 120832 bytes from PEB 161:4096, read only 120832 bytes, retry
[    6.714804] ubi0 error: ubi_io_read: error -74 (ECC error) while reading 120832 bytes from PEB 161:4096, read 120832 bytes
[...]
[    6.820019] UBIFS error (ubi0:1 pid 742): ubifs_leb_read: reading 120832 bytes from LEB 11:0 failed, error -74
[...]
[    6.906613] UBIFS error (ubi0:1 pid 742): ubifs_recover_leb: LEB 11 scanning failed
[    6.914319] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" stops
[    6.920744] mount_root: failed to mount -t ubifs /dev/ubi0_1 /tmp/overlay: Bad message
[    6.928758] mount_root: overlay filesystem has not been fully initialized yet
[    6.936033] mount_root: switching to ubifs overlay
[    6.940861] mount_root: switching to ubifs failed - fallback to ramoverlay
[    6.980554] ubi1: attaching mtd9
[    7.212534] ubi1: scanning is finished
[    7.220752] ubi1: attached mtd9 (name "syscfg", size 86 MiB)
[    7.226443] ubi1: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[    7.233349] ubi1: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[    7.240162] ubi1: VID header offset: 2048 (aligned 2048), data offset: 4096
[    7.247153] ubi1: good PEBs: 680, bad PEBs: 8, corrupted PEBs: 0
[    7.253184] ubi1: user volume: 1, internal volumes: 1, max. volumes count: 128
[    7.260434] ubi1: max/mean erase counter: 5/2, WL threshold: 4096, image sequence number: 2078512626
[    7.269605] ubi1: available PEBs: 0, total reserved PEBs: 680, PEBs reserved for bad PEB handling: 32
[    7.278868] ubi1: background thread "ubi_bgt1d" started, PID 757
[    7.288228] UBIFS (ubi1:0): background thread "ubifs_bgt1_0" started, PID 761
[    7.317371] UBIFS (ubi1:0): recovery needed
[    7.385393] UBIFS (ubi1:0): recovery completed
[    7.389879] UBIFS (ubi1:0): UBIFS: mounted UBI device 1, volume 0, name "syscfg"
[    7.397310] UBIFS (ubi1:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[    7.407268] UBIFS (ubi1:0): FS size: 80375808 bytes (76 MiB, 633 LEBs), journal size 4063232 bytes (3 MiB, 32 LEBs)
[    7.417747] UBIFS (ubi1:0): reserved for root: 3796347 bytes (3707 KiB)
[    7.424391] UBIFS (ubi1:0): media format: w4/r0 (latest is w4/r0), UUID CDCF7E85-9EA7-45CF-AA03-9913C61F026A, small LPT model
[...]

After booting, "df" returns this:

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 2560      2560         0 100% /rom
tmpfs                   256812       444    256368   0% /tmp
tmpfs                   256812        64    256748   0% /tmp/root
overlayfs:/tmp/root     256812        64    256748   0% /
ubi1:syscfg              71908       444     67756   1% /tmp/syscfg
tmpfs                      512         0       512   0% /dev

Any idea about this, please?

New to me, but looks like a seriously corrupt ubi partition. (so that it never gets properly mounted, rootfs does not get split, so there is no overlay partition on the flash, and overlay stays on ramdisk)

There may be ubi reformat/recovery tools, but the easiest solution might be to first switch boot to the other partition and then reflash this corrupt partition.

Did that happen immediately after the flash?
(I have flashed my own 3200 with 17.01.0, but with the sysupgrade image, so not quite identical. But 17.01.0 worked ok for me.)

2 Likes

I just rebooted to the original firmware and reinstalled LEDE again; now everything works as expected.
Many thanks!