[Debrick] Ubi0 warning: ubi_io_read: error -30 while reading 64 bytes from PEB 0:0, read only 0 bytes, retry (Netgear WAX220)

Hi guys,

i just ordered a (used) second Netgear WAX220 since i am running a first one with OpenWRT just fine.

When I power it up the power LED stays orange. I used UART to see what is going on:

F0: 102B 0000
FA: 1040 0000
FA: 1040 0000 [0200]
F9: 0000 0000
V0: 0000 0000 [0001]
00: 0000 0000
BP: 2400 0041 [0000]
G0: 1190 0000
EC: 0000 0000 [1000]
T0: 0000 021E [010F]
Jump to BL

NOTICE:  BL2: v2.6(release):660fb615
NOTICE:  BL2: Built : 18:31:23, Jun 10 2022
NOTICE:  WDT: disabled
NOTICE:  CPU: MT7986 (2000MHz)
NOTICE:  EMI: Using DDR4 settings
NOTICE:  EMI: Detected DRAM size: 1024MB
NOTICE:  EMI: complex R/W mem test passed
NOTICE:  SPI_NAND parses attributes from parameter page.
NOTICE:  SPI_NAND Detected ID 0xef
NOTICE:  Page size 2048, Block size 131072, size 134217728
NOTICE:  Initializing NMBM ...
NOTICE:  Signature found at block 1023 [0x07fe0000]
NOTICE:  First info table with writecount 132 found in block 960
NOTICE:  Second info table with writecount 132 found in block 963
NOTICE:  NMBM has been successfully attached in read-only mode
NOTICE:  BL2: Booting BL31
NOTICE:  BL31: v2.6(release):64c0c710d-dirty
NOTICE:  BL31: Built : 11:38:50, Sep  7 2022


U-Boot 2022.01-rc4 (Sep 07 2022 - 11:38:20 +0800)

CPU:   MediaTek MT7986
Model: mt7986-rfb
DRAM:  1 GiB

Initializing NMBM ...
spi-nand: spi_nand spi_nand@1: Winbond SPI NAND was found.
spi-nand: spi_nand spi_nand@1: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 64
Could not find a valid device for nmbm0
Signature found at block 1023 [0x07fe0000]
First info table with writecount 132 found in block 960
Second info table with writecount 132 found in block 963
No spare unmapped blocks. Device is now read-only
NMBM has been successfully attached 

MMC:   mmc@11230000: 0
Loading Environment from MTD... Failure while reading at offset 0x100000
*** Warning - bad CRC, using default environment

In:    serial@11002000
Out:   serial@11002000
Err:   serial@11002000
Net:   
Warning: ethernet@15100000 (eth0) using random MAC address - d2:ee:6e:2b:f2:48
eth0: ethernet@15100000
nmrp activated
nmrp listen timeout.
nmrp Nmrp_cleanup.
  *** U-Boot Boot Menu ***  Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit     1. Startup system (Default)     2. Upgrade firmware     3. Upgrade ATF BL2     4. Upgrade ATF FIP     5. Upgrade single image     6. Load image     0. U-Boot console  Hit any key to stop autoboot:  0 ubi0: attaching mtd6
ubi0 warning: ubi_io_read: error -30 while reading 64 bytes from PEB 0:0, read only 0 bytes, retry
ubi0 warning: ubi_io_read: error -30 while reading 64 bytes from PEB 0:0, read only 0 bytes, retry
ubi0 warning: ubi_io_read: error -30 while reading 64 bytes from PEB 0:0, read only 0 bytes, retry
ubi0 error: ubi_io_read: error -30 while reading 64 bytes from PEB 0:0, read 0 bytes
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd6, error -30
UBI error: cannot attach mtd6
UBI error: cannot initialize UBI, error -30
*** Failed to attach UBI ***
*** Rebuilding UBI ***
Erasing from 0x0 to 0x513ffff, size 0x5140000 ... Fail

Note the diverence according to OEM Bootlog:

[..]
ubi0: attaching mtd6
ubi0: scanning is finished
ubi0: attached mtd6 (name "ubi", size 81 MiB)
[..]

I used the tool NMRP to flash the latest stock oem firmware, older firmware, latest stable openwrt:

./nmrpflash -v -i eth2 -f WAX220-V1.0.3.4.img

I tried:

WAX220-V1.0.3.4.img
WAX220-V1.0.3.0.img
WAX220-V1.0.2.8.img
openwrt-23.05.3-mediatek-filogic-netgear_wax220-squashfs-factory.img

While uploading works with NMRP (TFTP) flashing does not work as i can see in UART:

[..]
nmrp configing
option ip[10.164.183.253] subnet:255.255.255.0
Recv FW-UP option
No ST-UP option
Using ethernet@15100000 device
Listening for TFTP transfer on 10.164.183.253
Load address: 0x46000000
Loading: 

[..]
	 
2.2 MiB/s
done
Bytes transferred = 24290648 (172a558 hex)
nmrp tftp upload complete.
write firmware...

*** Upgrading Firmware ***

*** Loaded 24290648 (0x172a558) bytes at 0x46000000 ***

Image is encrypted
model: WAX220
region: US
version: V1.0.3.4
dateTime: Tue May  7 01:00:50 2024
size: 0x172a33f
block size: 0x80
checksum: 0xa5b64f2
Decrypt image...
Decrypt finish
ubi0: attaching mtd6
ubi0 warning: ubi_io_read: error -30 while reading 64 bytes from PEB 0:0, read only 0 bytes, retry
ubi0 warning: ubi_io_read: error -30 while reading 64 bytes from PEB 0:0, read only 0 bytes, retry
ubi0 warning: ubi_io_read: error -30 while reading 64 bytes from PEB 0:0, read only 0 bytes, retry
ubi0 error: ubi_io_read: error -30 while reading 64 bytes from PEB 0:0, read 0 bytes
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd6, error -30
UBI error: cannot attach mtd6
UBI error: cannot initialize UBI, error -30
*** Failed to attach UBI ***
*** Rebuilding UBI ***
Erasing from 0x0 to 0x513ffff, size 0x5140000 ... Fail
*** Image not supported! ***
write flash fail.
nmrp write image error tftp up request again.

Instructions tell me to:

# ubirmvol /dev/ubi0 -N kernel_backup
# ubirmvol /dev/ubi0 -N rootfs_backup
# ubirename /dev/ubi0 rootfs_data rootfs_backup

But these commands are not even available in the (U-boot) shell that the device boots in:

help
?         - alias for 'help'
base      - print or set address offset
bdinfo    - print Board Info structure
blkcache  - block cache diagnostics and control
boot      - boot default, i.e., run 'bootcmd'
bootd     - boot default, i.e., run 'bootcmd'
booti     - boot Linux kernel 'Image' format from memory
bootm     - boot application image from memory
bootmenu  - ANSI terminal bootmenu
bootp     - boot image via network using BOOTP/TFTP protocol
cmp       - memory compare
coninfo   - print console devices and information
cp        - memory copy
crc32     - checksum calculation
dm        - Driver model low level access
echo      - echo args to console
editenv   - edit environment variable
env       - environment handling commands
fdt       - flattened device tree utility commands
go        - start application at address 'addr'
gpio      - query and control gpio pins
gzwrite   - unzip and write memory to block device
help      - print command description/usage
iminfo    - print header information for application image
imxtract  - extract a part of a multi-image
itest     - return true/false on integer compare
led       - manage LEDs
loadb     - load binary file over serial line (kermit mode)
loads     - load S-Record file over serial line
loadx     - load binary file over serial line (xmodem mode)
loady     - load binary file over serial line (ymodem mode)
loop      - infinite loop on address range
lzmadec   - lzma uncompress a memory region
md        - memory display
mm        - memory modify (auto-incrementing address)
mmc       - MMC sub system
mmcinfo   - display MMC info
mtd       - MTD utils
mtest     - simple RAM read/write test
mtkautoboot- Display MediaTek bootmenu
mtkboardboot- Boot MTK firmware
mtkload   - MTK image loading utility
mtkupgrade- MTK firmware/bootloader upgrading utility
mw        - memory write (fill)
nand      - NAND utility
net       - NET sub-system
nfs       - boot image via network using NFS protocol
nm        - memory modify (constant address)
nmbm      - NMBM utility commands
nmrp      - netgear nmrp tools
panic     - Panic with optional message
pci       - list and access PCI Configuration Space
ping      - send ICMP ECHO_REQUEST to network host
pinmux    - show pin-controller muxing
printenv  - print environment variables
pwm       - control pwm channels
random    - fill memory with random pattern
reset     - Perform RESET of the CPU
run       - run commands in an environment variable
saveenv   - save environment variables to persistent storage
setenv    - set environment variables
setexpr   - set environment variable as the result of eval expression
sleep     - delay execution for some time
smc       - Issue a Secure Monitor Call
source    - run script from memory
tftpboot  - boot image via network using TFTP protocol
tftpsrv   - act as a TFTP server and boot the first received file
ubi       - ubi commands
ubifsload - load file from an UBIFS filesystem
ubifsls   - list files in a directory
ubifsmount- mount UBIFS volume
ubifsumount- unmount UBIFS volume
unlz4     - lz4 uncompress a memory region
unzip     - unzip a memory region
version   - print monitor, compiler and linker version
MT7986>

What am i doing wrong?
Is this a hardware defect that i am seeing with ubi0?

With best regards,
Sebastian

ubi - ubi commands

Usage:
ubi part [part] [offset]
 - Show or set current partition (with optional VID header offset)
ubi info [l[ayout]] - Display volume and ubi layout information
ubi create[vol] volume [size] [type] - create volume name with size
ubi write[vol] address volume size - Write volume from address with size
ubi write.part address volume size [fullsize]
 - Write part of a volume from address
ubi read[vol] address volume [size] - Read volume to address with size
ubi remove[vol] volume - Remove volume
[Legends]
 volume: character name
 size: specified in bytes
 type: s[tatic] or d[ynamic] (default=dynamic)