ASUS RT-AC58U with new NAND memory

Are you prepared to wait for Qualcomm to do any more IPQ40xx development? The situation stayed pretty much the same since the linux kernel 4.8-days (this was late-2016-ish). It's been three years and tech is moving on to WIFI 6, NBASE-T.

Hi,
I am facing the same issue that my router refuses to boot.

Boot log

Format: Log Type - Time(microsec) - Message - Optional Info
Log Type: B - Since Boot(Power On Reset), D - Delta, S - Statistic
S - QC_IMAGE_VERSION_STRING=BOOT.BF.3.1.1-00110
S - IMAGE_VARIANT_STRING=DAABANAZA
S - OEM_IMAGE_VERSION_STRING=CRM
S - Boot Config, 0x00000021
S - Reset status Config, 0x00000000
S - Core 0 Frequency, 0 MHz
B - 261 - PBL, Start
B - 1339 - bootable_media_detect_entry, Start
B - 1678 - bootable_media_detect_success, Start
B - 1692 - elf_loader_entry, Start
B - 5069 - auth_hash_seg_entry, Start
B - 7211 - auth_hash_seg_exit, Start
B - 578514 - elf_segs_hash_verify_entry, Start
B - 694672 - PBL, End
B - 694696 - SBL1, Start
B - 784967 - pm_device_init, Start
D - 7 - pm_device_init, Delta
B - 786492 - boot_flash_init, Start
D - 54284 - boot_flash_init, Delta
B - 844921 - boot_config_data_table_init, Start
D - 3838 - boot_config_data_table_init, Delta - (419 Bytes)
B - 852129 - clock_init, Start
D - 7572 - clock_init, Delta
B - 864200 - CDT version:2,Platform ID:8,Major ID:1,Minor ID:1,Subtype:0
B - 867614 - sbl1_ddr_set_params, Start
B - 872711 - cpr_init, Start
D - 2 - cpr_init, Delta
B - 877093 - Pre_DDR_clock_init, Start
D - 4 - Pre_DDR_clock_init, Delta
D - 13175 - sbl1_ddr_set_params, Delta
B - 890825 - pm_driver_init, Start
D - 2 - pm_driver_init, Delta
B - 960726 - sbl1_wait_for_ddr_training, Start
D - 28 - sbl1_wait_for_ddr_training, Delta
B - 975820 - Image Load, Start
D - 138315 - QSEE Image Loaded, Delta - (268920 Bytes)
B - 1114562 - Image Load, Start
D - 1439 - SEC Image Loaded, Delta - (2048 Bytes)
B - 1124971 - Image Load, Start
D - 229132 - APPSBL Image Loaded, Delta - (468675 Bytes)
B - 1354501 - QSEE Execution, Start
D - 60 - QSEE Execution, Delta
B - 1360738 - SBL1, End
D - 668121 - SBL1, Delta
S - Flash Throughput, 2007 KB/s (740062 Bytes, 368701 us)
S - DDR Frequency, 537 MHz

U-Boot 2012.07-06802-ge44cc30 [local,local] (Apr 12 2017 - 17:24:25)
RT-AC58U bootloader version: 1.0.0.5

smem ram ptable found: ver: 1 len: 3
ASUS RT-AC58U gpio init : wps / reset pin
DRAM: 128 MiB
machid : 0x8010100
Maximum malloc length: 4096 KBytes
mem_malloc_start/brk/end: 0x86ee0000/86ee0000/872f0000
Relocation offset: 0
NAND: spi_nand: spi_nand_flash_probe SF NAND ID 0:ef:aa:21
SF: Detected W25N01GV with page size 2 KiB, total 128 MiB
SF: Detected MX25L1605D with page size 4 KiB, total 2 MiB
ipq_spi: page_size: 0x100, sector_size: 0x1000, size: 0x200000
130 MiB
*** Warning - bad CRC, using default environment

In: serial
Out: serial
Err: serial
name : offset size
0:SBL1 : 00000000 00040000
0:MIBIB : 00040000 00020000
0:QSEE : 00060000 00060000
0:CDT : 000c0000 00010000
0:DDRPARAMS : 000d0000 00010000
0:APPSBLENV : 000e0000 00010000
0:APPSBL : 000f0000 00080000
0:ART : 00170000 00010000
machid: 8010100
flash_type: 0
Creating 1 MTD partitions on "nand1":
0x00000000-0x08000000 : "mtd=0"
UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 126976 bytes
UBI: smallest flash I/O unit: 2048
UBI: VID header offset: 2048 (aligned 2048)
UBI: data offset: 4096
UBI: max. sequence number: 2331
UBI warning: print_rsvd_warning: cannot reserve enough PEBs for bad PEB handling, reserved 9, need 10
UBI error: ubi_wl_init_scan: no enough physical eraseblocks (0, need 1)
UBI error: ubi_init: cannot attach mtd2
UBI error: ubi_init: UBI error: cannot initialize UBI, error -12
UBI init error 12
Mount UBI device fail. (r = 12)

Please choose the operation:
1: Load System code to SDRAM via TFTP.
2: Load System code then write to Flash via TFTP.
3: Boot System code via Flash (default).
4: Entr boot command line interface.
7: Load Boot Loader code then write to Flash via Serial.
9: Load Boot Loader code then write to Flash via TFTP.

I have a backup of /dev/ubi0_1 and /dev/ubi0_2. @chunkeey You also mentioned to backup the nvram before doing nand erase.chip. Can you tell me how to do that?
I managed to boot https://downloads.openwrt.org/releases/23.05.2/targets/ipq40xx/generic/openwrt-23.05.2-ipq40xx-generic-asus_rt-ac58u-initramfs-uImage.itb, but trying to sysupgrade from there fails:

Watchdog handover: fd=3
- watchdog -
Watchdog did not previously reset the system
Tue Nov 14 13:39:47 UTC 2023 upgrade: Sending TERM to remaining processes ...
Tue Nov 14 13:39:47 UTC 2023 upgrade: Sending signal TERM to ntpd (2047)
Tue Nov 14 13:39:47 UTC 2023 upgrade: Sending signal TERM to ntpd (2049)
Tue Nov 14 13:39:51 UTC 2023 upgrade: Sending KILL to remaining processes ...
Tue Nov 14 13:39:51 UTC 2023 upgrade: Sending signal KILL to ntpd (2047)
[  117.282466] stage2 (2835): drop_caches: 3
Tue Nov 14 13:39:59 UTC 2023 upgrade: Switching to ramdisk...
Tue Nov 14 13:40:01 UTC 2023 upgrade: Performing system upgrade...
verifying sysupgrade tar file integrity
umount: can't unmount /dev/ubiblock0_5: Invalid argument
[  120.253903] block ubiblock0_5: released
[  120.279561] ubi0 error: 0xc0709ae8: error -5 while writing 22528 bytes to PEB 424:4096, written 20480 bytes
[  120.279640] CPU: 2 PID: 3570 Comm: ubirmvol Not tainted 5.15.137 #0
[  120.288145] Hardware name: Generic DT based system
[  120.294401] Function entered at [<c030d3a8>] from [<c0309784>]
[  120.299258] Function entered at [<c0309784>] from [<c060cd44>]
[  120.305073] Function entered at [<c060cd44>] from [<c0709aec>]
[  120.310890] Function entered at [<c0709aec>] from [<c070658c>]
[  120.316704] Function entered at [<c070658c>] from [<c07078fc>]
[  120.322518] Function entered at [<c07078fc>] from [<c06ff1ac>]
[  120.328337] Function entered at [<c06ff1ac>] from [<c0700b64>]
[  120.334152] Function entered at [<c0700b64>] from [<c0704590>]
[  120.339968] Function entered at [<c0704590>] from [<c0495184>]
[  120.345785] Function entered at [<c0495184>] from [<c0300040>]
[  120.351599] Exception stack(0xc32e5fa8 to 0xc32e5ff0)
[  120.357422] 5fa0:                   00000003 becbced3 00000003 40046f01 becbcc3c becbcc28
[  120.362546] 5fc0: 00000003 becbced3 becbced3 00000036 becbcc3c 00000003 00000000 00012a7c
[  120.370703] 5fe0: 00014f84 becbcaf8 00012108 b6f1c73c
[  120.387850] ubi0: dumping 22528 bytes of data from PEB 424, offset 4096
[  120.396782] ubi0 warning: 0xc07065bc: failed to write 22528 bytes at offset 0 of LEB 2147479551:0, PEB 424
[  120.396855] ubi0: try another PEB
[  120.396875] ubi0: run torture test for PEB 424
[  120.648844] ubi0 error: 0xc0709ae8: error -5 while writing 22528 bytes to PEB 433:4096, written 20480 bytes
[  120.648930] CPU: 1 PID: 3571 Comm: ubirmvol Not tainted 5.15.137 #0
[  120.657431] Hardware name: Generic DT based system
[  120.663688] Function entered at [<c030d3a8>] from [<c0309784>]
[  120.668545] Function entered at [<c0309784>] from [<c060cd44>]
[  120.674360] Function entered at [<c060cd44>] from [<c0709aec>]
[  120.680176] Function entered at [<c0709aec>] from [<c070658c>]
[  120.685990] Function entered at [<c070658c>] from [<c07078fc>]
[  120.691805] Function entered at [<c07078fc>] from [<c06ff1d0>]
[  120.697623] Function entered at [<c06ff1d0>] from [<c0700b64>]
[  120.703438] Function entered at [<c0700b64>] from [<c0704590>]
[  120.709254] Function entered at [<c0704590>] from [<c0495184>]
[  120.715072] Function entered at [<c0495184>] from [<c0300040>]
[  120.720886] Exception stack(0xc32fbfa8 to 0xc32fbff0)
[  120.726708] bfa0:                   00000003 bec5fed2 00000003 40046f01 bec5fc3c bec5fc28
[  120.731834] bfc0: 00000003 bec5fed2 bec5fed2 00000036 bec5fc3c 00000003 00000000 00012a7c
[  120.739991] bfe0: 00014f84 bec5faf8 00012108 b6f5073c
[  120.791208] ubi0: dumping 22528 bytes of data from PEB 433, offset 4096
[  120.800350] ubi0 warning: 0xc07065bc: failed to write 22528 bytes at offset 0 of LEB 2147479551:1, PEB 433
[  120.800420] ubi0: try another PEB
[  121.073992] ubi0: PEB 424 passed torture test, do not mark it as bad
[  121.144711] ubi0: run torture test for PEB 433
[  121.698155] ubi0: PEB 433 passed torture test, do not mark it as bad
Volume ID 3, size 25 LEBs (3174400 bytes, 3.0 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "linux", alignment 1
Volume ID 5, size 32 LEBs (4063232 bytes, 3.8 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "rootfs", alignment 1
Set volume size to 68694016
Volume ID 6, size 541 LEBs (68694016 bytes, 65.5 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "rootfs_data", alignment 1
sysupgrade successful
umount: can't unmount /dev: Resource busy
umount: can't unmount /tmp: Resource busy
[

But I am unsure of what to backup now before the nand erase?

I'm sorry, I'm not exactly sure how to answer that. Or what's the question?

Since from what I read: you have already backuped ubi0_1 and ubi0_2. I'm wondering if you just want to know where "nvram" is? Well that's easy: look at https://openwrt.org/toh/asus/rt-ac58u#flash_layout . The Wiki has a table that lists ubi0_0 as "nvram". So just backup it as well :slight_smile: .

If not and you know that nvram is in ubi0_0 because you already read the wiki, then I'm wondering how you managed to backup ubi0_1 and ubi0_2 but skipped ubi0_0?

1 Like

Thanks, I totally missed ubi_0 in the table :man_facepalming:

I backed up the partitions and copied them to my pc

cp /dev/ubi0_0 /tmp/ubi0_0
cp /dev/ubi0_1 /tmp/ubi0_1
cp /dev/ubi0_2 /tmp/ubi0_2
sha256sum /dev/ubi0_0 /dev/ubi0_1 /dev/ubi0_2

Afterwards I booted OpenWrt using tftp:

tftpboot 0x84000000 openwrt-23.05.2-ipq40xx-generic-asus_rt-ac58u-initramfs-uImage.itb
bootm 0x84000000

Then I cleared out the ubi volumes and created the partition table manually

root@OpenWrt:~# ubidetach -p /dev/mtd8
root@OpenWrt:~# ubiformat /dev/mtd8
ubiformat: mtd8 (nand), size 134217728 bytes (128.0 MiB), 1024 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 1023 -- 100 % complete
ubiformat: 1012 eraseblocks have valid erase counter, mean value is 3
ubiformat: 12 bad eraseblocks found, numbers: 242, 347, 350, 356, 359, 387, 397, 401, 402, 408, 412, 426
ubiformat: formatting eraseblock 1023 -- 100 % complete
root@OpenWrt:~# ubiattach -p /dev/mtd8 --max-beb-per1024 40
UBI device number 0, total 1012 LEBs (128499712 bytes, 122.5 MiB), available 980 LEBs (124436480 bytes, 118.6 MiB), LEB size 126976 bytes (124.0 KiB)
root@OpenWrt:~# ubinfo --all
UBI version:                    1
Count of UBI devices:           1
UBI control device major/minor: 10:126
Present UBI devices:            ubi0

ubi0
Volumes count:                           0
Logical eraseblock size:                 126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:     1012 (128499712 bytes, 122.5 MiB)
Amount of available logical eraseblocks: 980 (124436480 bytes, 118.6 MiB)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       12
Count of reserved physical eraseblocks:  28
Current maximum erase counter value:     10
Minimum input/output unit size:          2048 bytes
Character device major/minor:            245:0
root@OpenWrt:~# ubimkvol /dev/ubi0 --name=nvram --type=static --lebs=3
Volume ID 0, size 3 LEBs (380928 bytes, 372.0 KiB), LEB size 126976 bytes (124.0 KiB), static, name "nvram", alignment 1
root@OpenWrt:~# ubimkvol /dev/ubi0 --name=Factory --type=static --lebs=1
Volume ID 1, size 1 LEBs (126976 bytes, 124.0 KiB), LEB size 126976 bytes (124.0 KiB), static, name "Factory", alignment 1
root@OpenWrt:~# ubimkvol /dev/ubi0 --name=Factory2 --type=static --lebs=1
Volume ID 2, size 1 LEBs (126976 bytes, 124.0 KiB), LEB size 126976 bytes (124.0 KiB), static, name "Factory2", alignment 1
root@OpenWrt:~# ubimkvol /dev/ubi0 --name=linux --lebs=18
Volume ID 3, size 18 LEBs (2285568 bytes, 2.1 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "linux", alignment 1
root@OpenWrt:~# ubimkvol /dev/ubi0 --name=linux2 --lebs=397
Volume ID 4, size 397 LEBs (50409472 bytes, 48.0 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "linux2", alignment 1
root@OpenWrt:~# ubimkvol /dev/ubi0 --name=rootfs --lebs=22
Volume ID 5, size 22 LEBs (2793472 bytes, 2.6 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "rootfs", alignment 1
root@OpenWrt:~# ubimkvol /dev/ubi0 --name=rootfs_data --maxavsize
Set volume size to 68313088
Volume ID 6, size 538 LEBs (68313088 bytes, 65.1 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "rootfs_data", alignment 1
root@OpenWrt:~# ubinfo --all
UBI version:                    1
Count of UBI devices:           1
UBI control device major/minor: 10:126
Present UBI devices:            ubi0

ubi0
Volumes count:                           7
Logical eraseblock size:                 126976 bytes, 124.0 KiB
Total amount of logical eraseblocks:     1012 (128499712 bytes, 122.5 MiB)
Amount of available logical eraseblocks: 0 (0 bytes)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       12
Count of reserved physical eraseblocks:  28
Current maximum erase counter value:     10
Minimum input/output unit size:          2048 bytes
Character device major/minor:            245:0
Present volumes:                         0, 1, 2, 3, 4, 5, 6

Volume ID:   0 (on ubi0)
Type:        static
Alignment:   1
Size:        3 LEBs (380928 bytes, 372.0 KiB)
Data bytes:  0 bytes
State:       OK
Name:        nvram
Character device major/minor: 245:1
-----------------------------------
Volume ID:   1 (on ubi0)
Type:        static
Alignment:   1
Size:        1 LEBs (126976 bytes, 124.0 KiB)
Data bytes:  0 bytes
State:       OK
Name:        Factory
Character device major/minor: 245:2
-----------------------------------
Volume ID:   2 (on ubi0)
Type:        static
Alignment:   1
Size:        1 LEBs (126976 bytes, 124.0 KiB)
Data bytes:  0 bytes
State:       OK
Name:        Factory2
Character device major/minor: 245:3
-----------------------------------
Volume ID:   3 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        18 LEBs (2285568 bytes, 2.1 MiB)
State:       OK
Name:        linux
Character device major/minor: 245:4
-----------------------------------
Volume ID:   4 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        397 LEBs (50409472 bytes, 48.0 MiB)
State:       OK
Name:        linux2
Character device major/minor: 245:5
-----------------------------------
Volume ID:   5 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        22 LEBs (2793472 bytes, 2.6 MiB)
State:       OK
Name:        rootfs
Character device major/minor: 245:6
-----------------------------------
Volume ID:   6 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        538 LEBs (68313088 bytes, 65.1 MiB)
State:       OK
Name:        rootfs_data
Character device major/minor: 245:7

and restored the partitions

root@OpenWrt:~# ubiupdatevol /dev/ubi0_0 /tmp/ubi0_0
root@OpenWrt:~# ubiupdatevol /dev/ubi0_1 /tmp/ubi0_1
root@OpenWrt:~# ubiupdatevol /dev/ubi0_2 /tmp/ubi0_2
root@OpenWrt:~# sha256sum /dev/ubi0_0 /dev/ubi0_1 /dev/ubi0_2
9b9303ca2390d9ee275377499a2e802b176172e630f4715073f4f15b0a34bd94  /dev/ubi0_0
9b0e3310ee76468b3f88c47e3ec661c19631172602bd08f3176a2898f44dd897  /dev/ubi0_1
9b0e3310ee76468b3f88c47e3ec661c19631172602bd08f3176a2898f44dd897  /dev/ubi0_2

Afterwards I flashed OpenWrt while preserving the partition table:

sysupgrade -n -p /tmp/openwrt-23.05.2-ipq40xx-generic-asus_rt-ac58u-squashfs-sysupgrade.bin
1 Like

On the next boot I do no longer get the u-boot error that I had before

UBI warning: print_rsvd_warning: cannot reserve enough PEBs for bad PEB handling, reserved 9, need 10
UBI error: ubi_wl_init_scan: no enough physical eraseblocks (0, need 1)
UBI error: ubi_init: cannot attach mtd2
UBI error: ubi_init: UBI error: cannot initialize UBI, error -12
UBI init error 12
Mount UBI device fail. (r = 12)

and u-boot appears to be error-free

Watchdog did not previously reset the system
Tue Nov 14 13:45:25 UTC 2023 upgrade: Sending TERM to remaining processes ...
Tue Nov 14 13:45:29 UTC 2023 upgrade: Sending KILL to remaining processes ...
[  453.345631] stage2 (2783): drop_caches: 3
Tue Nov 14 13:45:35 UTC 2023 upgrade: Switching to ramdisk...
Tue Nov 14 13:45:37 UTC 2023 upgrade: Performing system upgrade...
verifying sysupgrade tar file integrity
Volume ID 3, size 25 LEBs (3174400 bytes, 3.0 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "linux", alignment 1
Volume ID 5, size 32 LEBs (4063232 bytes, 3.8 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "rootfs", alignment 1
Set volume size to 66154496
Volume ID 6, size 521 LEBs (66154496 bytes, 63.0 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "rootfs_data", alignment 1
sysupgrade successful
umount: can't unmount /dev: Resource busy
umount: can't unmount /tmp:
Format: Log Type - Time(microsec) - Message - Optional Info
Log Type: B - Since Boot(Power On Reset),  D - Delta,  S - Statistic
S - QC_IMAGE_VERSION_STRING=BOOT.BF.3.1.1-00110
S - IMAGE_VARIANT_STRING=DAABANAZA
S - OEM_IMAGE_VERSION_STRING=CRM
S - Boot Config, 0x00000021
S - Reset status Config, 0x00000010
S - Core 0 Frequency, 0 MHz
B -       261 - PBL, Start
B -      1339 - bootable_media_detect_entry, Start
B -      1678 - bootable_media_detect_success, Start
B -      1692 - elf_loader_entry, Start
B -      5069 - auth_hash_seg_entry, Start
B -      7211 - auth_hash_seg_exit, Start
B -    578514 - elf_segs_hash_verify_entry, Start
B -    694672 - PBL, End
B -    694696 - SBL1, Start
B -    784964 - pm_device_init, Start
D -         7 - pm_device_init, Delta
B -    786489 - boot_flash_init, Start
D -     54272 - boot_flash_init, Delta
B -    844903 - boot_config_data_table_init, Start
D -      3838 - boot_config_data_table_init, Delta - (419 Bytes)
B -    852112 - clock_init, Start
D -      7576 - clock_init, Delta
B -    864187 - CDT version:2,Platform ID:8,Major ID:1,Minor ID:1,Subtype:0
B -    867599 - sbl1_ddr_set_params, Start
B -    872696 - cpr_init, Start
D -         2 - cpr_init, Delta
B -    877078 - Pre_DDR_clock_init, Start
D -         5 - Pre_DDR_clock_init, Delta
D -     13176 - sbl1_ddr_set_params, Delta
B -    890809 - pm_driver_init, Start
D -         2 - pm_driver_init, Delta
B -    960653 - sbl1_wait_for_ddr_training, Start
D -        27 - sbl1_wait_for_ddr_training, Delta
B -    975748 - Image Load, Start
D -    138235 - QSEE Image Loaded, Delta - (268920 Bytes)
B -   1114408 - Image Load, Start
D -      1439 - SEC Image Loaded, Delta - (2048 Bytes)
B -   1124788 - Image Load, Start
D -    229004 - APPSBL Image Loaded, Delta - (468675 Bytes)
B -   1354188 - QSEE Execution, Start
D -        60 - QSEE Execution, Delta
B -   1360405 - SBL1, End
D -    667788 - SBL1, Delta
S - Flash Throughput, 2008 KB/s  (740062 Bytes,  368498 us)
S - DDR Frequency, 537 MHz


U-Boot 2012.07-06802-ge44cc30 [local,local] (Apr 12 2017 - 17:24:25)
RT-AC58U bootloader version: 1.0.0.5

smem ram ptable found: ver: 1 len: 3
ASUS RT-AC58U gpio init : wps / reset pin
DRAM:  128 MiB
machid : 0x8010100
Maximum malloc length: 4096 KBytes
mem_malloc_start/brk/end: 0x86ee0000/86ee0000/872f0000
Relocation offset: 0
NAND:  spi_nand: spi_nand_flash_probe SF NAND ID 0:ef:aa:21
SF: Detected W25N01GV with page size 2 KiB, total 128 MiB
SF: Detected MX25L1605D with page size 4 KiB, total 2 MiB
ipq_spi: page_size: 0x100, sector_size: 0x1000, size: 0x200000
130 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
name         : offset   size
0:SBL1       : 00000000 00040000
0:MIBIB      : 00040000 00020000
0:QSEE       : 00060000 00060000
0:CDT        : 000c0000 00010000
0:DDRPARAMS  : 000d0000 00010000
0:APPSBLENV  : 000e0000 00010000
0:APPSBL     : 000f0000 00080000
0:ART        : 00170000 00010000
machid: 8010100
flash_type: 0
Creating 1 MTD partitions on "nand1":
0x00000000-0x08000000 : "mtd=0"
UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    126976 bytes
UBI: smallest flash I/O unit:    2048
UBI: VID header offset:          2048 (aligned 2048)
UBI: data offset:                4096
UBI: max. sequence number:       108
UBI: attached mtd2 to ubi0
UBI: MTD device name:            "mtd=0"
UBI: MTD device size:            128 MiB
UBI: number of good PEBs:        1012
UBI: number of bad PEBs:         12
UBI: number of corrupted PEBs:   0
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     7
UBI: available PEBs:             18
UBI: total number of reserved PEBs: 994
UBI: number of PEBs reserved for bad PEB handling: 10
UBI: max/mean erase counter: 10/4
UBI: image sequence number:  1441903310
UBI:   vol_id  reserved_pebs  alignment  data_pad  vol_type  usable_leb_size  used_ebs  used_bytes  last_eb_bytes  corrupted  upd_marker  name_len  name
UBI:        0              3          1         0    static            1f000         3       5d000          1f000          0           0         5  nvram
UBI:        1              1          1         0    static            1f000         1       1f000          1f000          0           0         7  Factory
UBI:        2              1          1         0    static            1f000         1       1f000          1f000          0           0         8  Factory2
UBI:        3             19          1         0   dynamic            1f000        19      307000          1f000          0           0         5  linux
UBI:        4            18d          1         0   dynamic            1f000       18d     3013000          1f000          0           0         6  linux2
UBI:        5             20          1         0   dynamic            1f000        20      3e0000          1f000          0           0         6  rootfs
UBI:        6            209          1         0   dynamic            1f000       209     3f17000          1f000          0           0         b  rootfs_data
UBI: 7fffefff              2          1         0   dynamic            1f000         2       3e000              2          0           0         d  layout volume
UBI volume [linux] size 307000 smaller than 3013000!
UBI error: do_ubi: available_pebs 18 < MIN_AVAILABLE_PEB 30

Latest UBI volumes layout.
UBI:   vol_id  reserved_pebs  alignment  data_pad  vol_type  usable_leb_size  used_ebs  used_bytes  last_eb_bytes  corrupted  upd_marker  name_len  name
UBI:        0              3          1         0    static            1f000         3       5d000          1f000          0           0         5  nvram
UBI:        1              1          1         0    static            1f000         1       1f000          1f000          0           0         7  Factory
UBI:        2              1          1         0    static            1f000         1       1f000          1f000          0           0         8  Factory2
UBI:        3             19          1         0   dynamic            1f000        19      307000          1f000          0           0         5  linux
UBI:        4            18d          1         0   dynamic            1f000       18d     3013000          1f000          0           0         6  linux2
UBI:        5             20          1         0   dynamic            1f000        20      3e0000          1f000          0           0         6  rootfs
UBI:        6            209          1         0   dynamic            1f000       209     3f17000          1f000          0           0         b  rootfs_data
UBI: 7fffefff              2          1         0   dynamic            1f000         2       3e000              2          0           0         d  layout volume
Read 0x1f000 bytes from volume [Factory] offset 0x0 to 86ec0ce0
EEPROM set 0: OK (version 15)
Read 0x1f000 bytes from volume [Factory2] offset 0x0 to 86ec0ce0
EEPROM set 1: OK (version 15)
Read 0x1f000 bytes from volume [Factory] offset 0x0 to 86ee2f58
Select EEPROM set 0 at offset 0x0.

Please choose the operation:
   1: Load System code to SDRAM via TFTP.
   2: Load System code then write to Flash via TFTP.
   3: Boot System code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial.
   9: Load Boot Loader code then write to Flash via TFTP.                                                                                                                                                                                  0
   3: Boot System code via Flash (default).

RT-AC58U bootloader version: 1.0.0.5
MAC Address: 04:D4:C4:61:2C:D8
Read 0x40 bytes from volume [linux] offset 0x0 to 84000000
   FIT/FDT format image found at 0x84000000, size 0x002f5e1c
Read 0x2f5e5c bytes from volume [linux] offset 0x0 to 84000000
## Booting kernel from FIT Image at 84000000 ...
   Using 'config@1' configuration
   Trying 'kernel-1' kernel subimage
     Description:  ARM OpenWrt Linux-5.15.137
     Type:         Kernel Image
     Compression:  lzma compressed
     Data Start:   0x840000e4
     Data Size:    3085176 Bytes = 2.9 MiB
     Architecture: ARM
     OS:           Linux
     Load Address: 0x80208000
     Entry Point:  0x80208000
     Hash algo:    crc32
     Hash value:   0c5da494
     Hash algo:    sha1
     Hash value:   8d8e97f1a7c574ec677874c540b73d8eb0e0f139
## Flattened Device Tree from FIT Image at 84000000
   Using 'config@1' configuration
   Trying 'fdt-1' FDT blob subimage
     Description:  ARM OpenWrt asus_rt-ac58u device tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x842f1594
     Data Size:    17288 Bytes = 16.9 KiB
     Architecture: ARM
     Hash algo:    crc32
     Hash value:   a498e538
     Hash algo:    sha1
     Hash value:   76497082b7352f1b3829b8eddb84197052d43d52
   Booting using the fdt blob at 0x842f1594
Read 0x28 bytes from volume [linux2] offset 0x0 to 86edfc38
Copy firmware from c009b000 to c30ae000, length 2f5e5c

0x2f5e5c bytes written to volume linux2
   Uncompressing Kernel Image ... OK
   Loading Device Tree to 86ed8000, end 86edf387 ... OK
ipq: fdt fixup unable to find compatible node
Using machid 0x8010100 from environment

Starting kernel ...
1 Like

but OpenWrt still has issues with bad LEBs and apparently is not able to recover them because the system boots only into a read only mode: boot log
Does anybody have an idea what I am missing here and why OpenWrt is not marking these blocks as bad? Can I manually mark them as bad? There appears to be nand markbad, but my u-boot environment does not have it

(IPQ40xx) # nand markbad
nand - NAND sub-system

Usage:
nand info - show available NAND devices
nand device [dev] - show or set current device
nand read - addr off|partition size
nand write - addr off|partition size
    read/write 'size' bytes starting at offset 'off'
    to/from memory address 'addr', skipping bad blocks.
nand read.raw - addr off|partition [count]
nand write.raw - addr off|partition [count]
    Use read.raw/write.raw to avoid ECC and access the flash as-is.
nand write.yaffs - addr off|partition size
    write 'size' bytes starting at offset 'off' with yaffs format
    from memory address 'addr', skipping bad blocks.
nand erase[.spread] [clean] off size - erase 'size' bytes from offset 'off'
    With '.spread', erase enough for given file size, otherwise,
    'size' includes skipped bad blocks.
nand erase.part [clean] partition - erase entire mtd partition'
nand erase.chip [clean] - erase entire chip'
nand bad - show bad blocks
nand dump[.oob] off - dump page
nand scrub [-y] off size | scrub.part partition | scrub.chip
    really clean NAND erasing bad blocks (UNSAFE)

Moved this to it´s own thread Debricking a RT-AC58U with corrupted flash