Mir3g - unable to install OpenWrt/LEDE with ubi bad blocks
Username: Gérald Gatesoupe
Origin: https://bugs.openwrt.org/index.php?do=details&task_id=1710
We are some users unable to complete the installation of OpenWrt/LEDE because erasing bad blocks on ubi partition fail :
[ 2.516128] # MTK NAND # : Use HW ECC [ 2.519787] Device not found, ID: c8d1 [ 2.523528] Not Support this Device! [ 2.527257] chip_mode=00000001 [ 2.530305] Support this Device in MTK table! c8d1 [ 2.535261] [NAND]select ecc bit:4, sparesize :64 spare_per_sector=16 [ 2.541736] nand: device found, Manufacturer ID: 0xc8, Chip ID: 0xd1 [ 2.548056] nand: ESMT NAND 128MiB 3,3V 8-bit [ 2.552406] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64 [ 2.559951] Scanning device for bad blocks [ 2.662018] Bad eraseblock 692 at 0x000005680000 [ 2.667177] Bad eraseblock 696 at 0x000005700000 [ 2.672347] Bad eraseblock 700 at 0x000005780000 [ 2.684032] Bad eraseblock 750 at 0x000005dc0000 [ 2.720853] Bad eraseblock 978 at 0x000007a40000 [ 2.731898] 10 fixed-partitions partitions found on MTD device MT7621-NAND [ 2.738737] Creating 10 MTD partitions on "MT7621-NAND": [ 2.744047] 0x000000000000-0x000000080000 : "Bootloader" [ 2.750271] 0x000000080000-0x0000000c0000 : "Config" [ 2.756079] 0x0000000c0000-0x000000100000 : "Bdata" [ 2.761844] 0x000000100000-0x000000140000 : "Factory" [ 2.767685] 0x000000140000-0x000000180000 : "crash" [ 2.773394] 0x000000180000-0x0000001c0000 : "crash_syslog" [ 2.779670] 0x0000001c0000-0x000000200000 : "reserved0" [ 2.785801] 0x000000200000-0x000000600000 : "kernel_stock" [ 2.792164] 0x000000600000-0x000000a00000 : "kernel" [ 2.797981] 0x000000a00000-0x000007f80000 : "ubi" [ 2.804498] [mtk_nand] probe successfully! [ 2.809315] Signature matched and data read! [ 2.813583] load_fact_bbt success 1023 [ 2.817914] libphy: Fixed MDIO Bus: probed [ 2.893154] libphy: mdio: probed [ 4.296704] mtk_soc_eth 1e100000.ethernet: loaded mt7530 driver [ 4.303312] mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 20 [ 4.314072] NET: Registered protocol family 10 [ 4.320075] Segment Routing with IPv6 [ 4.323876] NET: Registered protocol family 17 [ 4.328373] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this. [ 4.341284] 8021q: 802.1Q VLAN Support v1.8 [ 4.348309] UBI: auto-attach mtd9 [ 4.351691] ubi0: attaching mtd9 [ 4.377159] UBI: EOF marker found, PEBs from 19 will be erased [ 4.384201] ubi0: scanning is finished [ 4.403913] ubi0 warning: do_sync_erase.part.4: error -5 while erasing PEB 939, retry [ 4.411789] ubi0 warning: do_sync_erase.part.4: error -5 while erasing PEB 939, retry [ 4.419622] ubi0 warning: do_sync_erase.part.4: error -5 while erasing PEB 939, retry [ 4.427504] ubi0 error: do_sync_erase.part.4: cannot erase PEB 939, error -5 [ 4.434543] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.14.50 #0 [ 4.440520] Stack : 00000000 00000000 00000000 00000000 80607ad2 00000034 00000000 00000000 [ 4.448864] 8fc40374 8059c947 805275ac 00000001 00000001 00000001 8fc35838 1cc282d2 [ 4.457197] 00000000 00000000 80600000 00003d80 00000000 000000cd 00000007 00000000 [ 4.465531] 00000000 805a0000 0006a16f 00000000 00000000 00000000 805c0000 802edc20 [ 4.473865] 80550000 80600000 fffffffb 8f44c780 00000003 80299e30 00000004 80600004 [ 4.482200] ... [ 4.484638] Call Trace: [ 4.487093] [<80010558>] show_stack+0x58/0x100 [ 4.491533] [<804685ac>] dump_stack+0x9c/0xe0 [ 4.495871] [<802ef678>] do_sync_erase.part.4+0x118/0x2ac [ 4.501250] [<802efb58>] ubi_io_sync_erase+0x2ac/0x2e4 [ 4.506365] [<802f0418>] sync_erase.isra.4+0x150/0x25c [ 4.511482] [<802f0a4c>] __erase_worker+0x4c/0x4b0 [ 4.516250] [<802f0f14>] erase_worker+0x64/0x8c [ 4.520765] [<802eff70>] do_work+0xf8/0x13c [ 4.524930] [<802f280c>] ubi_wl_get_peb+0xcc/0x260 [ 4.529697] [<802eb2d8>] try_write_vid_and_data+0x54/0x200 [ 4.535160] [<802ecb54>] ubi_eba_atomic_leb_change+0x208/0x314 [ 4.541000] [<802e3120>] ubi_update_layout_vol+0x40/0x74 [ 4.546287] [<802e37dc>] ubi_change_vtbl_record+0xb0/0x104 [ 4.551747] [<802e5714>] ubi_resize_volume+0x254/0x4c4 [ 4.556860] [<802e6ae0>] autoresize+0x144/0x1cc [ 4.561375] [<802e7c88>] ubi_attach_mtd_dev+0x730/0xbe8 [ 4.566599] [<805dd428>] ubi_init+0x2a8/0x360 [ 4.570939] [<80005650>] do_one_initcall+0xd0/0x1a0 [ 4.575813] [<805c5d80>] kernel_init_freeable+0x168/0x228 [ 4.581209] [<8047f6bc>] kernel_init+0x10/0x10c [ 4.585719] [<8000b098>] ret_from_kernel_thread+0x14/0x1c [ 4.591175] ubi0 error: __erase_worker: failed to erase PEB 939, error -5 [ 4.597931] ubi0: mark PEB 939 as bad
A user (@Tanonn, thanks to him) successful installed LEDE by shrinking the ubi partition (85% of the original size) then made a custom build.
Could you handle the erasing of bad blocks for next builds ?