8

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.

0

1 Answer 1

13

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.

Sources:

2
  • 2
    Thank you so much, I had no idea.
    – Simkoo
    Apr 2, 2019 at 5:32
  • In layman terms: first flash TWRP image into your phone via fastboot and this command fastboot boot twrp.img, once you booted on recovery mode (TWRP), use it to install TWRP permanently via the zip for your phone Mar 8, 2021 at 21:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .