R3 mini flash NAND ubidetach error

Maybe here is somebody willed for helping a noob. Thanks in advance!

I do have OpenWRT 24.10.1 installed on eMMC since a few days and tryed to flash NAND now, but I got stuck under ubidetach -m 1 --> ubidetach: error!: cannot detach mtd1 error 16 (Resource busy)
booted from eMMC, files copied to /tmp, connected by UART(same with ssh), followed the official OpenWRT manual

What can I do to continue? Now the NAND image is broken and won't boot, eMMC is still fine.

BusyBox v1.36.1 (2025-04-13 16:38:32 UTC) built-in shell (ash)


OpenWrt 24.10.1, r28597-0425664679

root@OpenWrt_R3mini:~# [ 68.391839] usb 1-1: new high-speed USB device number 2 >using xhci-mtk
[ 68.573227] usb-storage 1-1:1.0: USB Mass Storage device detected
[ 68.579600] scsi host0: usb-storage 1-1:1.0
[ 69.592685] scsi 0:0:0:0: Direct-Access USB SanDisk 3.2Gen1 1.00 PQ: 0 ANSI: 6
[ 69.607785] sd 0:0:0:0: [sda] 30031872 512-byte logical blocks: (15.4 GB/14.3 GiB)
[ 69.616460] sd 0:0:0:0: [sda] Write Protect is off
[ 69.621236] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
[ 69.626594] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support >DPO or FUA
[ 69.639038] sda: sda1
[ 69.641578] sd 0:0:0:0: [sda] Attached SCSI removable disk

root@OpenWrt_R3mini:~# cp /mnt/sda1/openwrt-24.10.1-mediatek-filogic-bananapi_bp
i-r3-mini-initramfs-recovery.itb /mnt/sda1/openwrt-24.10.1-mediatek-filogic-bana
napi_bpi-r3-mini-snand-bl31-uboot.fip /mnt/sda1/openwrt-24.10.1-mediatek-filogic
<-bananapi_bpi-r3-mini-snand-preloader.bin /mnt/sda1/openwrt-24.10.1-mediatek-fil
<ogic-bananapi_bpi-r3-mini-squashfs-sysupgrade.itb /tmp
root@OpenWrt_R3mini:~# insmod mtd-rw.ko i_want_a_brick=1
[ 175.860496] mtd-rw: mtd0: setting writeable flag
root@OpenWrt_R3mini:~# mtd write /tmp/openwrt-24.10.1-mediatek-filogic-bananapi_
bpi-r3-mini-snand-preloader.bin /dev/mtd0
Unlocking /dev/mtd0 ...

Writing from /tmp/openwrt-24.10.1-mediatek-filogic-bananapi_bpi-r3-mini-snand-preloader.bin to >/dev/mtd0 ...
root@OpenWrt_R3mini:~# ubidetach -m 1
ubidetach: error!: cannot detach mtd1
error 16 (Resource busy)
root@OpenWrt_R3mini:~#

Did you try ubiformat /dev/mtd1 directly without detach?

1 Like

Maybe a ubivolume is still mounted or busy?
Try checking mount output and unmount any UBI volume you see there.
Also release any fitblk mappings using fitblk /dev/fit0, which should then allow to remove ubiblock devices.
That should fix it.

1 Like

@Gix
I didn't try as first, because I was a bit scared about format. thanks anyway a lot for the hint.

edit: oh sorry, yes I did try but it didn't work. There came again a error saying something about not possible because still in use.

@daniel
I checked the mounted drives like you wrote and found /dev/ubi0_2 on /mnt/ubi0_2 type ubifs (rw,relatime,assert=read-only,ubi=0,vol=2) , unmounted it and tried to continue with the commands for the flash process, and everything did work from then on.

boot from NAND works :sweat_smile:

thank you so much for help!!!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.