yashsingh1/xdaforums huggingface dataset:
[Fire HD 6 and 7 General] hawkazn:
TWRP help

So I downloaded the zip file for 5.0 and it flashed and asked to install super user. I had to download the apk for supersu and then update it.

But the problem is that I lost my twrp. I push the volume + and power and it just reboots. I also lost my play store. Any thoughts how to get twrp back on?
[Fire HD 6 and 7 General] DoLooper:
Flashing 5.0 may have been a bad idea. Same with using apk and not flashing the supersu zip. First, any chance you still have root? (Use root checker/whatever). If yes, you've performed a miracle. Don't touch anything and let us know.

If no, you probably also have no recovery, but first try power-off fire. Then hold down power and vol+ until you see "Amazon" and let go. If it reboots, you've lost recovery and someone more knowledgeable than I may have to help. Anyway, post back.
[Fire HD 6 and 7 General] hawkazn:
twrp　help p.2

I tried to do the recovery and all it does is just reboot the system.

Somehow, i do have root access. Es file was asking for it when i was deleting some programs. I have no clue how, but i do.
[Fire HD 6 and 7 General] DoLooper:
hawkazn: What does root checker say?
[MENTION=6680544]bibikalka[/MENTION], hawkazn is on 5.0 with no recovery, but apparently has root. Can you help? Possible for him to get recovery and preserve root? thanks!
[Fire HD 6 and 7 General] hawkazn:
TWRP help p.2

Here is what root checker says
[Fire HD 6 and 7 General] DoLooper:
Cool (I think) :)

I read some older posts that said you needed play store for TWRP to work. idk, might not still be true. Also, I think folks were able to get into recovery, but TWRP crashed. Anyway . . .

Please don't change anything until you hear from bibikalka, but could you post this info? (1) What OS version were you on when you flashed 5.0? (2) Have you tried installing play store? (3) Do you have /cache/recovery/last_log file? (4) When you search / for "twrp" do you find a bunch of twrp dirs, files, apk? Thanks!
[Fire HD 6 and 7 General] hawkazn:
I have not tied to install play store.

The system I was on was 4.5.4 but the rooted version.

I dont have the crashlogs and I haven't tried to search for twrp. I figured since I'm on the 5.0,and rooted, I'm happy.
[Fire HD 6 and 7 General] DoLooper:
Would you mind doing the twrp search? It will be useful info even if you don't care about getting recovery. Thx!
[Fire HD 6 and 7 General] bibikalka:
OK, this is an intriguing result, 5.2.0 with root - the only other known attempt failed to get into 5.2.0 and caused a soft brick. Perhaps, going via supersu apk did the trick? Anyway, lucky strike !!!

Right now your situation is a bit fragile, if were to mess up your /system, you may end up with a soft brick. So, as DoLooper already mentioned, move ahead very slowly :D

At this moment, your /recovery contains TWRP, which is not signed, and therefore Amazon will not boot it (specifically, TEE1 -> UBOOT v5.2.0 sequence needs a signed recovery). That's why "Pwr" and "Vol+" don't do anything. Your first order of business is to figure out how to unblock Amazon recovery update. Please check if you have a script like this : /system/etc/install-recovery.sh I suspect TWRP renamed it to something else, to prevent itself from being overwritten. If you manage to enable this update (perhaps by renaming the script back), on next boot FireOS should overwrite TWRP with 5.2.0 recovery. This would be huge, because 5.2.0 recovery would allow you to adb sideload 4.5.3, so you can recover after a screw up as per this post :

http://xdaforums.com/fire-hd/general/how-to-downgrade-to-4-5-3-root-device-t3139351

Please do come back here with any questions regarding recovery update to stock Amazon 5.2.0, this is a huge failsafe if you manage to get this done!!!

If you manage to get Amazon recovery installed, you should back up everything. The key partitions you care about are TEE1, UBOOT, and recovery.

...
[PART] 3: 00002800 00002800 'TEE1'
[PART] 4: 00002800 00005000 'TEE2'
[PART] 5: 00000400 00007800 'UBOOT'
[PART] 6: 00004000 00007C00 'boot'
[PART] 7: 00004000 0000BC00 'recovery'
...

Therefore, after getting into "adb shell", "su", you backup all 3 like this :

dd if=/dev/block/mmcblk0p3 of=/sdcard/tee1-5.2.0.img
dd if=/dev/block/mmcblk0p5 of=/sdcard/uboot-5.2.0.img
dd if=/dev/block/mmcblk0p7 of=/sdcard/stockrecovery-5.2.0.img

Double check that you can boot into 5.2.0 recovery via "Pwr" "vol+". And post all 3 images to XDA !!!

After this, a couple of options are available. The 1st involves manually installing GAPPS, just like in the good old times pre-4.5.4.

The 2nd option is more exciting. Basically, when booted into 5.2.0 with root, you overwrite all 3 key partitions with these versions (tee1-4.5.3, uboot-4.5.3, and TWRP).

Then you can reboot into TWRP, and install standard GAPPS from a zip file. Right after (before a reboot!!!), you flash back (tee1-5.2.0, uboot-5.2.0, and stockrecovery-5.2.0). I wonder if TWRP can be overwritten via a "dd" command while in TWRP, perhaps we should ask jmz. Again, if you could boot into stockrecovery, you have an option to downgrade from 5.2.0, so if you screw up, there is an escape hatch available.

We may bug jmz to get a TWRP version which allows easy overwrites of itself with other recoveries.
[Fire HD 6 and 7 General] hawkazn:
So I guess I already have the file, but still no way to get into a recovery system
[Fire HD 6 and 7 General] :
I have a similar problem, and am wondering if there's a way to fix it?

I had 4.5.4 with twrp and root, as described here, http://xdaforums.com/fire-hd/general/how-to-upgrade-to-4-5-4-twrp-root-t3141648

but I didn't need it, so I reverted to stock 4.5.4 (I figured I could always do the upgrade to 5 and back again if I did need it). It seemed to work, except I can't get into recovery. And I have no root to reflash recovery.

I did say install supersu when I left twrp for the last time, just incase something went wrong and I needed to recover.

I now think that was what went wrong, as I had a /etc/install-recovery.sh that didn't install recovery, somehow I managed to get root very early on in the boot process, so I copied install-recovery_original.sh to install-recovery.sh, but it still hasn't installed the stock recovery.

Since then, I've not been able to get back to root, no matter what I try su gives exit code 1.

And now there's an update for 5.20 pending, so every so often the fire will reboot, try to get into recovery to install it, fail to do so, and reboot back into fireos.

I can reboot to fastboot, but I can't flash the stock rom from there, something about missing android-product.txt or android-info.txt, and I can't flash recovery as I get an error about locked hardware.

I can adb shell, but it's useless without root.

Any ideas on how to get recovery back?
[Fire HD 6 and 7 General] bibikalka:
No worry yet. And don't rush anything!!!

Can you post that file here? I want to see what's in it. Can you check that you have another file, /system/recovery-from-boot.p ?

---------- Post added at 01:45 PM ---------- Previous post was at 01:38 PM ----------

I wonder what was the point to reflash stock 4.5.4 on top of rooted 4.5.4 ? They were identical, except for root and a couple of early bootloaders which disappear by the time the kernel is executed!!!

But anyway, to write recovery you need root, if you don't have it - then no go. I am a little fuzzy on what TWRP does to disable stock recovery, I'll look this up.
[Fire HD 6 and 7 General] :
I couldn't watch amazon videos, so I figured I'd go back to stock, and make sure it was nothing I'd done. Turns out it didn't help, and now it's much worse off. ah well, amazon can have it back anyway, since videos don't work
[Fire HD 6 and 7 General] hawkazn:
So I have the recovery file, except it's labeled "recovery-from-boot.bak"
[Fire HD 6 and 7 General] hawkazn:
Here is the recovery file you were asking for. Let me know if something looks off
[Fire HD 6 and 7 General] junglistknot:
Thanks for your help but I need an img file not a zip. I am trying to push the image with fastboot and the zip will not work.
[Fire HD 6 and 7 General] hawkazn:
Unzip the file. The install-recovery.sh is in the zip. The only way it let me upload it was to zip it.
[Fire HD 6 and 7 General] Remolten:
This file isn't for you bro, the devs trying to discover how hawkazn's device is rooted on the dev preview. He's giving them some files that they want to look at, so that isn't the .img file you would flash.
[Fire HD 6 and 7 General] hawkazn:
Yes, this is for the devs. Hopefully they will be bale to help me out and then we will be able to help out everyone. So everyone keep your fingers crossed that something works here.
[Fire HD 6 and 7 General] bibikalka:
Yep, this file came from TWRP. So we need to track down the original one. Are there any other similar scripts in there? Sort by date, see what's the most recent.
[Fire HD 6 and 7 General] hawkazn:
Here are the files that are in there. I figure that this might be better to do. Hope it helps.
[Fire HD 6 and 7 General] bibikalka:
I managed to convert 5.2.0 *dat file into a set of files. Please check that you have all of the following:

/system/bin/install-recovery.sh

/system/etc/recovery-resource.dat

/system/recovery-from-boot.p

I think your last one is named "recovery-from-boot.bak", so if you were to rename it back to "recovery-from-boot.p", that could work. But make sure that the other above files are in there before you proceed. My hunch is if you were to rename the file, and reboot, it should update TWRP to the stock recovery.

But before you do, check that you /system/bin/install-recovery.sh says this :

#!/system/bin/sh
if ! applypatch -c EMMC:/dev/block/platform/mtk-msdc.0/by-name/recovery:6258688:4774403b18b87fbb36c4ffe85ad777e35b555555; then
applypatch -b /system/etc/recovery-resource.dat EMMC:/dev/block/platform/mtk-msdc.0/by-name/boot:5804032:d4370af3c5a61cce73ff9e802967837a94bd631f EMMC:/dev/block/platform/mtk-msdc.0/by-name/recovery 4774403b18b87fbb36c4ffe85ad777e35b555555 6258688 d4370af3c5a61cce73ff9e802967837a94bd631f:/system/recovery-from-boot.p && log -t recovery "Installing new recovery image: succeeded" || log -t recovery "Installing new recovery image: failed"
else
log -t recovery "Recovery image already installed"
fi

First, eyeball all these files, and report back! It's good to double check.
[Fire HD 6 and 7 General] hawkazn:
How do I do that? I am on my Kindle and using ES File Explorer. Do I just open it as a text document. Cause I did that, and none of this was in it.
[Fire HD 6 and 7 General] bibikalka:
Perhaps, copy/paste it to Downloads or something, rename to *txt, and try to open again. See what it has inside! I wonder if TWRP emptied it too.
[Fire HD 6 and 7 General] hawkazn:
#!/system/bin/sh

# If you're implementing this in a custom kernel/firmware,

# I suggest you use a different script name, and add a service

# to launch it from init.rc

# Launches SuperSU in daemon mode only on Android 4.3+.

# Nothing will happen on 4.2.x or older, unless SELinux+Enforcing.

# If you want to force loading the daemon, use "--daemon" instead

/system/xbin/daemonsu --auto-daemon &

# Some apps like to run stuff from this script as well, that will

# obviously break root - in your code, just search this file

# for "install-recovery-2.sh", and if present, write there instead.

/system/etc/install-recovery-2.sh

That is what it says, now in the bin folder, the file is labeled as "install-recovery_original.sh"
[Fire HD 6 and 7 General] bibikalka:
Do you have /system/etc/install-recovery-2.sh in there too? It looks like TWRP replaced both!

Please see the attached file, it'd go into /system/etc/ , and you'll need to make sure that it has executable permissions. So check whatever permissions install-recovery.sh has, and make this one the same (all in ES explorer).
[Fire HD 6 and 7 General] hawkazn:
So I should just replace the files then and change permissions and delete the old one or leave it?
[Fire HD 6 and 7 General] bibikalka:
Let's make an inventory of what you have now, in /system/etc, and /system/bin regarding recovery. Please list all the "install-recovery*" files in both directories. Ideally, you'd just add that single file "install-recovery-2.sh" to /system/etc (unless another one already exists with that name), and it should all work (after you adjust permissions).
[Fire HD 6 and 7 General] hawkazn:
/system/etc - install-recovery.sh and install-recovery-2.sh

/system/bin - install-recovery_original.sh and install-recovery.sh

however, both install-recovery.sh say the same thing as I posted about

#!/system/bin/sh

# If you're implementing this in a custom kernel/firmware,

# I suggest you use a different script name, and add a service

# to launch it from init.rc

# Launches SuperSU in daemon mode only on Android 4.3+.

# Nothing will happen on 4.2.x or older, unless SELinux+Enforcing.

# If you want to force loading the daemon, use "--daemon" instead

/system/xbin/daemonsu --auto-daemon &

# Some apps like to run stuff from this script as well, that will

# obviously break root - in your code, just search this file

# for "install-recovery-2.sh", and if present, write there instead.

/system/etc/install-recovery-2.sh
[Fire HD 6 and 7 General] bibikalka:
OK, if /system/etc/install-recovery-2.sh is empty as you indicated, replace it with my attachment. Change permissions to whatever install-recovery.sh has. Also, rename that *bak file to *p :

/system/recovery-from-boot.p

Upon reboot, it should update your recovery to stock, if install-recovery-2.sh runs correctly!
[Fire HD 6 and 7 General] hawkazn:
I have replaced mine with yours and changed the *bak to *p

I have the permission set to rwx, rwx, rwx, and root, root

I tried to reboot and hold down the volume + and pwr and nothing happens. It doesn't ask or say it's rebooting to factory. Should I hook it into a computer and ask it to do a adb reboot bootloader?
[Fire HD 6 and 7 General] bibikalka:
Well, you should reboot into FireOS at least once, to let this thing run! Then you can try to get into recovery. You probably want permissions such as "-rwxr-xr-x" or whatever the other install-recovery.sh has!

I looked at my 4.5.4, it has the same stuff, it's SuperSu installing itself into install-recovery.sh . So nothing unusual here.

Actually, you could just go to adb, and try to run the proper script manually: "adb shell; su; cd /etc; ./install-recovery-2.sh" or something like this. See if it runs, and what it says.
[Fire HD 6 and 7 General] junglistknot:
Wow you guys are getting somewhere it looks like. I also have the dev preview installed but I did lose root unfortunately. I hope you guys find an exploit in your tinkering. Fingers crossed
[Fire HD 6 and 7 General] hawkazn:
I will have to try that later. I have linux at home and it's much easier for adb. I did try yesterday to do adb reboot bootloader and all I got was just a black screen.
[Fire HD 6 and 7 General] Remolten:
"adb reboot bootloader" will always return a black screen, because there is no custom bootloader installed. Instead, you would run the command "adb reboot recovery" to reboot into the (hopefully) stock recovery. Hope it works!
[Fire HD 6 and 7 General] :
`adb reboot bootloader` puts you in fastboot mode, where you can do very little as the hardware is locked. the screen is off just ot be difficult i think, something amazon are very adept at
[Fire HD 6 and 7 General] DoLooper:
Yes, as Remolten said, black screen with boot to bootloader is normal, so no worries. But . . .

Please don't boot into bootloader or recovery. Bibikalka 1st paragraph is saying to just reboot the tablet--"adb reboot" if you want--which should run the install recovery script. Or (2nd paragraph) run the script manually. If you're going to do it manually, please post for bibikalka if you have any questions (since "something like this" may be a little vague ;) )
[Fire HD 6 and 7 General] hawkazn:
So once I do everything, if the recovery script installs, what should I do at that point other than reboot?:victory:
[Fire HD 6 and 7 General] DoLooper:
Something you can do right now in Windows is confirm you're still rooted: adb shell, su, ls /system (then exit, exit). If you "adb reboot" make note of anything in CMD window and confirm you go back to Fire OS. After reboot, then you want to see about recovery: adb reboot recovery (not reboot-recovery). Post what you see.

EDIT: I say not "reboot-recovery" because for me on 4.5.4 adb is not recognizing that as legitimate. Maybe OK on OS 5.

EDIT2: [MENTION=5927934]hawkazn[/MENTION] back up a minute. bibikalka said, "You probably want permissions such as "-rwxr-xr-x" or whatever the other install-recovery.sh has!" so confirm again that perms match the "other" install-recovery. (Just odd to me that you used rwx rwx rwx and bibi suggests maybe they should be rwx r-x r-x)

and to clarify: If you "adb reboot" and are in OS, then "adb reboot recovery" to see if script installed. If you manually install, I assume you should reboot OS before reboot recovery, but my knowledge is limited. Bibikalka is our expert.

(I'm on the edge of my seat awaiting the outcome! Good luck! :fingers-crossed: )
[Fire HD 6 and 7 General] hawkazn:
ALRIGHTY!!!!! So I did the ./install-recovery-2.sh and IT INSTALLED!!! Next, I did a adb reboot recovery and as you can see from the pictures...IT WORKED!!!!! STOCK RECOVERY SYSTEM IS BACK ON!!!!:laugh::highfive::D
[Fire HD 6 and 7 General] DoLooper:
:good::good::good::laugh::laugh::D:D

---------- Post added at 01:25 PM ---------- Previous post was at 12:31 PM ----------

LOL! So let's start to nail this down! I for one am willing to try it if we have the steps.

You flashed OS 5.n with TWRP and said yes when it asked to install superuser. Is that right?

Then what? Did you boot to OS and then try to get back into recovery and couldn't? (Sounds like it.) And you had no supersuer so then installed supersu apk?

EDIT: (Sorry, this is just me trying to wrap my brain around what just happened. :) ) If above is correct:

1. Boot to TWRP

2. Install 5.n zip and say yes at prompt to install superuser

3. (still in TWRP) Boot to OS. (This is where I'm confused. If recovery gets killed at time of flashing 5.n were you still in TWRP and able to use it to get to OS or did it reboot or what? Do you remember? thx)

4. install supersu apk and update it

5. do all the stuff you and bibikalka did

Please confirm (or not). Thanks!

EDIT2:

- First, replace Updater-script in OS 5 zip with bibikalka's updater-script_5.2.0 and delete /images, yes? Did you also flash 4.5.3 bootloader separately? Oh, heck, could you just tell us more exactly what you did until you couldn't boot recovery, (lol)?
[Fire HD 6 and 7 General] siegesoldier:
I'd also probably through in a factory reset between 1 and 2 since that was likely my issue, but we shall see what the official results are. Lots of changes between kitkat and lolipop that mess **** up.
[Fire HD 6 and 7 General] DoLooper:
Root survives a factory reset?
[Fire HD 6 and 7 General] siegesoldier:
prior to rooting to clear out your previous kitkat junk! and yes it should anyway since root is installed as a system app. but I meant before rooting

edit again: I am talking about factory reset while in TWRP.

ie

1. Boot to TWRP

1a. Factory reset.

2. Install 5.n zip and say yes at prompt to install superuser

etc
[Fire HD 6 and 7 General] hawkazn:
Alright, in case everyone wanted to know, here is what I did.

1. I had it rooted with Fire OS 4.5.4

2. I downloaded the 5.0 zip file from post #1 and flashed it with twrp

3. When asked about installing superuser I said yes.

4. Wait for it to do it Lollipop upgrade

5. I logged in and then downloaded the supersu apk from online and installed it. The binaries were installed, but no apk. So I downloaded it.

Now, with doing that, it knocks out both the playstore and twrp. It will also knock out factory recovery

1. Look at post #41

2. Look at post #45

Make sure that both install-recovery.sh and install-recovery-2.sh have the permissions set to rwx, rx,rx, root, root

3. Then follow post #51

I did all those and got my Amazon stock recovery back by doing "adb reboot recovery"

BIG THANKS TO DOLOOPER AND BIBIKALkA FOR ALL YOUR WORK AND GETTING THIS DONE!!!:good::fingers-crossed::laugh::D
[Fire HD 6 and 7 General] bibikalka:
Dude, excellent effort! That's a big step forward!!!

Now, back up the key partitions, zip each image, and post zips here!!! We need them as back up !!! If you are missing "dd", install busybox.

adb shell

su

dd if=/dev/block/mmcblk0p3 of=/sdcard/tee1-5.2.0.img

dd if=/dev/block/mmcblk0p5 of=/sdcard/uboot-5.2.0.img

dd if=/dev/block/mmcblk0p7 of=/sdcard/stockrecovery-5.2.0.img

For GAPPS, what I think one could do is this :

1) In 5.2.0, flash TEE1 v4.5.3, UBOOT v4.5.3, TWRP. Upon reboot to recovery, TWRP will be running.

2) In TWRP one can flash GAPPS from a zip file. While in TWRP, one flashes back TEE1 v5.2.0, UBOOT v5.2.0, and Stock_recovery v5.2.0 .

3) After reboot back into 5.2.0, GAPPS are there.

Now, the steps are delicate, one cannot make mistakes !!! Let me test this, and perhaps put together the proper update files.

Update: I tested flashing recovery on top of running TWRP, everything seems to work fine. So I can make a zip file for 2), where one flashes 5.2.0 stuff, but I need 5.2.0 recovery img obtained via "dd" !!!

Step 1) will be very important to execute correctly, no margin for error. But effectively, one gets a chance to swap between working TWRP, and 5.2.0

Update2: As a public service announcement, don't mess around with install-recovery-2.sh as hawkazn did!!! The sole purpose of that was to create and extract an image for 5.2.0 recovery. Once we get the image, we can just flash that directly, without any other steps.
[Fire HD 6 and 7 General] siegesoldier:
Could one not just manually copy gapps into the system apps directory with a file manager and reboot, since we have root instead of all this back and forth?
[Fire HD 6 and 7 General] bibikalka:
Indeed, you can try to do it via manual copying, like we used to do it with 4.5.3. The trick is to enable 5.2.0 recovery first, in case you screw up and want to fix it by downgrading. If you do choose to mess with bootloaders, the upside is that flashing GAPPS may turn out to be slightly simpler.

But to proceed, one still needs a working image of 5.2.0 recovery.
[Fire HD 6 and 7 General] KindleEthan:
Bibikalka can u explain how to install twerp for us nooks thanks
[Fire HD 6 and 7 General] KindleEthan:
Ok so I did the first part in shell but now where do I get the things to flash
[Fire HD 6 and 7 General] siegesoldier:
Paging [MENTION=5927934]hawkazn[/MENTION] to run these as mentioned above so the rest of us can getting to where he is without bricking our kindles (again)
[Fire HD 6 and 7 General] KindleEthan:
I have installed google play on my kindle and it is working correctly. All up have to do is download wonder share on your pc and connect your kindle then download the latest google play and services and install them from there and you will then have the latest working version of google play and services
[Fire HD 6 and 7 General] bibikalka:
Well, if you are in 5.2.0, can you get the stock recovery back, and dd the image out using the script in here:

http://xdaforums.com/showpost.php?p=61961037&postcount=45
[Fire HD 6 and 7 General] hawkazn:
Sorry everyone, I am house sitting for a relative and they don't have a computer. Strange, I know. I will try to have all those for everyone tonight
[Fire HD 6 and 7 General] siegesoldier:
if you have the kindle with you, you can also run those commands from terminal emulator from the playstore and upload them if you're not too busy. Leave out the adb shell command though and start from su
[Fire HD 6 and 7 General] hawkazn:
Alrighty, sory it's taken awhile. But here are the files of course in the zip lol
[Fire HD 6 and 7 General] KindleEthan:
How am I supposed to flash it