I'm trying to flash TWRP Recovery into my Mi A2 recovery. However I get the error when flashing:

~$ fastboot flash recovery twrp.img
FAILED (remote: '(recovery_a) No such partition')

Does anyone know how to fix this error? I did test flashing it to boot_b, and that did work. but that's not the recovery slot.

| improve this question | | | | |

That's expected. Devices with A/B partition scheme don't have a recovery partition. You can only boot in recovery mode with fastboot boot twrp.img. But to permanently flash recovery to device which can be booted into by proper key combination, you need to unpack both of your boot.imgs (A/B) from device and replace the ramdisk with the one extracted from twrp.img. Then repack and flash boot.imgs back to device.

On TWRP this has been previously achieved by flashing a special ZIP file, or one could do manually. Now the official TWRP release includes the option Install Recovery Ramdisk:

Use magiskboot to allow repacking boot images for installing TWRP

Traditionally boot.img and recovery.img had two major components; kernel and ramdisk. On A/B devices, no ramdisk is required for normal boot because system.img is mounted as rootfs when processing Device Tree (dtb) which is appended to kernel image usually. So the ramdisk.cpio in boot.img is that of recovery. Since kernel is same for a device (other than build configurations), so only ramdisk needs to be replaced.


| improve this answer | | | | |
  • 1
    Thank you so much, I had no idea. – Simkoo Apr 2 '19 at 5:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.