5

I have an LG G2-D800 running 4.4.2 KitKat and it is rooted using an app called Stump Root. I have been trying to flash a new ROM onto it and every time it boots into recovery, it boots into the android recovery, even though I have flashed it using Clockwork Mod and TWRP Manager. Can anyone help with this and suggest good ROMs to flash to it?

  • How did you flash the recovery? – Matthew Read May 28 '15 at 14:25
  • 1
    I used an app called ROM Manager v5.5.3.7. When you first enter the app, the first option is called "Recovery Setup". And as of now, it says that the current Recovery is ClockworkMod 6.0.4.4 (which I believe is the latest version). But, if I use the "Reboot into Recovery" option under that, it just opens the Stock Recovery. – Hackaholic May 29 '15 at 2:06
  • I had similiar problem and explained everything here [en.miui.com/… – tom Jan 9 '17 at 1:15
  • I had same issue on a TAB4 10.1 SM-T535.. Anyway, to get it to boot into TWRP I just had to install the TWRP app from the play store, which has an option to boot into TWRP, the key combinations never worked for me. I also had flashed CF-Auto-Root to the device to install SuperSU, which might have allowed the TWRP app with Root access to boot into recovery mode straight from their app, bypassing the timing issues of having to press the keys in a certain order. – David d C e Freitas Mar 2 at 9:10
6

Some stock ROM's may replace the custom recovery with the stock recovery. To solve it you should install the custom recovery with fastboot and reboot to recovery and don't reboot to system. That will prevent the stock ROM from replacing the custom recovery.

  • Catch: That will prevent the stock ROM from replacing the custom recovery. -- not completely true. This answer will not work on CM 11 and CM12 that ships with OPO unless you explicitly uncheck Update CM recovery under Developer options. – Firelord May 28 '15 at 19:29
  • @Firelord The OPO's bootloader does recovery verification before entering fastboot mode? – Matthew Read May 29 '15 at 15:22
  • @MatthewRead This pdf on Linux Foundation says about an unlocked device in respect of bootloader states -- Unlocked devices do not verify boot or recovery images. Your comment held completely true for a locked bootloader of OPO. However, the answer involves fastboot flashing which assumes device is unlocked, and hence, my comment is still true for OPO. // Thanks for explicitly mentioning it. I learned some other good things from the pdf. :) – Firelord May 29 '15 at 16:31
  • If he reboots into the newly flashed recovery, when is the stock rom supposed to reset the recovery? does it check the recovery before the reboot? How is flashing with fastboot more permanent than flashing with a 3rd party app? – jiggunjer Nov 2 '15 at 20:44
  • I have the same issue but there is no "update cm recovery" option in "debug options" – ransh Nov 17 '16 at 23:00
3

Its because stock roms come with their own recovery. That will always replace custom recovery. To prevent this, whenever you download a rom, open its tar or zip or whatever format is there with winrar and delete the recovery image inside it (if its zip file, then open it and go to system/etc and delete "recovery.img" and if its tar file, again open it and delete the recovery.img or any file with similar name. Keyword here is recovery).

The next step is to edit out the scripts so it doesnt give error on missing recovery image. For zip file, the android flash script is inside META-INF/com/google/android/ and you need to edit the file "updater-script". Now various rom builders use various methods to flash recovery using script, so there isnt any specific way really, but look for any line that resembles something that means "copy/flash recovery.img" and delete that line. For ex in one of the roms I downloaded, recovery was flashed using this command->

package_extract_file("system/etc/recovery.img", "/dev/block/platform/msm_sdcc.1/by-name/recovery")

You can clearly see that its extracting recovery image to some location, so delete this line. Then save file inside zip and flash it. Your recovery wont be changed.

For roms in tar or any other format, it should normally be some batch file which carries flash instructions. Again, open it and remove line corresponding to flash recovery.

This may sound haphazard, but try it first before deciding difficulty, its relatively easy ;) All you need to do is just edit the script that controls flashing.

One more thing, if you have lost your recovery, you can flash it using fastboot. First, follow guide here to set up adb and fastboot. Next, connect phone to pc with usb debugging enabled. Then open command prompt and enter these commands->

fastboot erase recovery
fastboot flash recovery PathToRecoveryFileAndItsName.img

For ex if my recovery file lies in D:/Recovery folder, then I would use->

fastboot flash recovery D:/Recovery/TWRPblabla.img

Good luck and hope this helps.

Here's more detail on how to deal with this in case of stock roms:

HOW TO PREVENT STOCK ROM FROM OVERWRITING RECOVERY:

In stock roms, the general procedure used is to put in a recovery image file. For ex if you open a stock rom archive in winrar, you will see some image file with name and extension similar to "recovery.img". This is stock recovery, you delete this file. Now similarly, we need to edit flash scripts so it doesnt go berserk on not finding recovery image. It actually depends how stock rom is flashed (or rather what method it uses). Some need individual parts flashing (system is flashed separately and recovery is flashed separately and boot or kernel separately, like in samsungs). In this case you can simply skip step for flashing recovery and no script editing is needed. But if its using some script (like nexus stock roms have a batch file script), you will have to edit that script. Its usually batchfile. Open the file in notepad and remove the lines that lead to recovery flashing. To help you identify these lines, look for words like recovery or recovery.img since it actually depends on how stock rom flash script is made. For ex in my nexus 4. the stock rom I downloaded flashed recovery using fastboot as->

fastboot erase recovery
fastboot flash recovery recovery.img

Here, as you can see its actually first erasing my recovery, we dont want that either. So I remove these two lines. First, to prevent it from erasing my already inserted recovery, second to prevent it from flashing and over-riding my recovery with a new one. So you must also look out for such lines that may overwrite the recovery. As I said, you can simply search for keyword recovery in script if you are having difficulty in finding such line.

  • Now, when I try to reboot into Recovery, it reboots into fastboot and all it says it " [D800] Fastboot mode started" on a black screen. – Hackaholic May 29 '15 at 12:20
  • Are you sure your button combination is right? Because the method I told simply causes no recovery flashing. Nothing changes for existing recovery. On side note, if you have set up fastboot and adb in PC, you can force phone into recovery using this method-> go to fastboot mode (as you are now). Connect to PC. Open cmd or terminal whatever os you have set up adb and fastboot in. Enter the command "fastboot reboot recovery" without quotes. This should get you into recovery. – Jaskaranbir Singh May 29 '15 at 12:27
  • @Hackaholic I think that is behavior of a locked bootloader...You stopped it from re-flashing the stock recovery, but it still won't boot into a a recovery that doesn't have the correct digital signature... – jiggunjer Nov 4 '15 at 13:35
  • Also, Jaskaranbir, you might mention at the start of your answer that your trick requires root. – jiggunjer Nov 4 '15 at 13:37
  • Worked like charm in Nexus 7 2012. Previously even after flashing, default recovery with android icon was appearing. fastboot erase recovery worked! – sud007 Sep 23 '16 at 8:20
2

There is an easy step... I used it to boot in to rec on my N910g (note4) 1 .flash the custom rec using odin (it was TWRP 2.8.7.0 for me)

  1. As soon as the device restarts after flashing press and hold menue button and volume up button (this should be so quick, u have to press buttons as quick as the screen get Black screen) repeat the steps it will work.(remember to flash the rec again and again when u repeat steps

:D

  • LG devices has a different way of flashing recovery and another key combination (some even unable to enter recovery via key combo). Nice try anyway. – Andy Yan Oct 8 '16 at 10:07
  • That quick pressing worked ... I was breaking my head trying to figure out how since the past 4 hours... Thanks You! – AndroidMechanic - Viral Patel Dec 14 '16 at 22:05
0

Hello i just had a personal experience with my Asus zenfone selfie Z00T Stock recovery kept replacing TWRP. (Boot loader already unlocked)

This is how i got around it i downloaded the latest TWRP for my device and placed directly in minimal adb and fastboot app folder then i renamed it to recovery .

then i put my device in fastboot mode using the buttons on the phone and After i ran minimal adb and fastboot app as admin then i typed fastboot flash recovery recovery.img

once done i then i typed fastboot boot recovery.img. and my phone booted to twrp recovery then i selected reboot recovery directly on my phone and to finish reboot system (still in twrp) that's it.

(OEM commands to boot from fastboot to recovery do not work on some devices )

it only worked for me eventually because i downloaded the latest TWRP from the official TWRP website.

The idea is to flash the custom recovery and then booting from the custom recovery.img that you just used to flash (the one still on the pc) using minimal adb and fastboot app.

IT may not work on all devices as the commands may change from one device to another but the idea stays the same. (example for nexus fastboot -c "lge.kcal=0|0|0|x" boot recovery.img)

I hope this will help some people out.

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