Help "failed to write partition" error Redmi 5A (riva)

Search This thread

TheMagicWafer

Member
Jan 15, 2023
7
0
I had installed in this phone a custom rom a few months back for my friend. Yesterday he told me that the device froze when he was browsing the phone gallery app, and a few minutes later the phone rebooted and couldn't pass the mi logo (so the system wasn't loading I guessed, because the logo of the ROM wasn't showing). I tried to enter TWRP, but even there the phone would get stuck on the TWRP splash page and rebooted back to the MI logo. So I tried to reinstall TWRP (I have still access to fastboot mode) and, after, a newer version, but the problem was the same. I tried booting a recovery image without installing it (fastboot boot twrp.img) and the problem was similar, but instead of rebooting to the MI logo, the phone would get stuck on the TWRP logo. I tried with OrangeFox recovery too, but same problem. I read in another post that it may be a problem with the /data partition, so I (fastboot erase userdata) and tried again the above recovery installation, but it didn't work. I, then, tried to wipe all partion via fastboot, and tried the command "fastboot erase system -w", but it didn't work either. So I tried the way to restore the phone with MiFlash tool, I found the firmware I needed, I flashed it, and after ~4s it gave me the error "failed to write partiton" (see image).
error miflash.jpg
I tried with another firmware (this time based on Oreo instead of Nougat), same error. I searched a solution for this error, but I found nothing helpful. Now I have the phone working (=it can power on) and can access to fastboot, but don't know what to do. Can someone out there, with maybe a clearer idea of what's going on, help me? Thanks in advance
 

TheMagicWafer

Member
Jan 15, 2023
7
0
Update:
I found out that the problem is flashing this file "gpt_both0.bin" (which is the partition table). Every firmware that I tried failed to flash when trying to fastboot this file. So I tried to remove the line (
Code:
fastboot %* flash partition "%~dp0images\gpt_both0.bin" || @echo "Flash tz error" && exit /B 1
) from the flash_all.bat and everything was flashed without errors, but the phone won't start, so this file is necessary. Flashing it separately gave me the same error (failed to write partition). So, I ask again for help, hoping that someone will come to save me
 

TheMagicWafer

Member
Jan 15, 2023
7
0
Does your phone go in fastboot? Mine doesn't, but is recognised as QHSBULK 9008, also it's not recognised in adb devices or mi tool
Yes, my phone goes into fastboot. The name QHSBULK 9008 sounds like the phone goes in edl mode. I'm not sure, but searching around I found out it's the name of the phone when it's recognised as by it's qualcomm drivers, or something similar