English

Flashing TRWP (or any recovery) fails

Hi,
my original intention was just to move as much as possible from my old phone to my new FP2 with Android 6, but Helium Backup always complains that USB debugging is not in PTP mode. True, and I can switch this to PTP, but once I go back to Helium, it bounces back to MTP :frowning:

So I felt I should root the phone to circumvent this, and I tried to follow this Howto. I used the latest Minimal ADB & Fastboot, version 1.4.3, and got a message that the ADB server verions (31) does not match the client version (36). Googling this message did not reveal anythin that helped me really.

The only other ADB I could locate on my computer was from Helium, so I deinstalled Helium, and the message disappeared. Flashing TWRP showed

> fastboot flash recovery c:\boot-fairphone-FP2-gms-17.10.2-su-eng-r318.img
target reported max download size of 536870912 bytes
sending 'recovery' (14655 KB)...
OKAY [  0.463s]
writing 'recovery'...
OKAY [  0.181s]
finished. total time: 0.648s

but the recovery is now destroyed, i.e. I can boot to recovery but just a small Android figure with a German message like “Invalid operation” appears. The same with Minimal ADB & Fastboot, version 1.4.1 and/or the original recovery images that comes with TWRP - a too short flash duration and the same error when booting to recovery. Lucky enough, I can boot the normal FP OS yet.

Any idea how I can circumvent this and still install TWRP? What file versions should I use today, and what do I need to clean from my computer to make sure I work with a correct setup? Or am I completely on the wrong track here? Thank you all in advance…

Download the current TWRP image from twrp.me and follow the instructions there.

Current Minimal ADB and Fastboot version

2 Likes

You flashed a (rooted) boot image to the recovery partition. That ain’t gonna work…
The correct command is:
fastboot flash recovery twrp-3.1.1-1-fp2.img

Btw, I always recommend to use the official SDK Platform Tools. It’s a small download, doesn’t require installation and has the latest ADB and fastboot.

2 Likes

You flashed (a rooted) /boot to /recovery. That doesn’t make much sense and does obviously not work. :wink:

As @AnotherElk said, flash the latest TWRP and everything should work again.

I personally think you messed up the ways to root FPOS with a rooted boot.img and with magisk. Please do not mix them, I don’t think it’s good. :wink:

2 Likes

Thank you guys, that shed some light on the issue… Yes I mixed up boot and recovery :flushed: It is some years a go that I tried this on a Samsung the last time, and with Samsung tools, so everything felt new to me again…

Nevertheless, flashing still did not work (and feels too quick);

C:\Program Files (x86)\Minimal ADB and Fastboot>fastboot flash recovery c:\twrp-3.1.1-1-fp2.img
target reported max download size of 536870912 bytes
sending 'recovery' (12296 KB)...
OKAY [  0.390s]
writing 'recovery'...
OKAY [  0.148s]
finished. total time: 0.541s

As for an alternative to Minimal ADB, I installed the SDK platform tools as suggested, started sdkmanager, looked at the list of modules and figured it would be the build-tools;27.0.0.0 that might contain adb, but no success here either:

F:\AndroidSdk\tools\bin>sdkmanager build-tools;27.0.0.0
Warning: File C:\Users\myname\.android\repositories.cfg could not be loaded.
Warning: Failed to find package build-tools;27.0.0.0

I really feel stupid today and appreciate your help…

According to your fastboot output flashing TWRP worked fine. What happens when you boot into recovery?

It seems you installed the full SDK Manager. You only need the SDK Platform Tools which don’t require installation. Please read the linked page again, especially the section saying:

:slight_smile:

2 Likes

Thank you @ChuckMorris. I also thought flashing looks good, but booting into recovery showed the little green android with a warning sign and “Kein Befehl” = “no command”. I know a (textual) recovery from my Samsung, but nothing like this.

I now took the platform tools and get the following message:

F:\platform-tools>adb  reboot bootloader
adb server version (36) doesn't match this client (39); killing...
* daemon started successfully *
error: no devices/emulators found

(Trying to make every possible error I guess.) Do I need an older version? There seem to be no links to older versions, and the version history shows that the latest is 26.0.2, so I can’t find a reference to 36 or 39 anywhere.

Some other test that I tried:

F:\platform-tools>adb shell
error: no devices/emulators found

F:\platform-tools>fastboot devices
f8ef69f fastboot

So I think there might be an ADB version mismatch (see the post before) and/or a mssing driver on Windows (although the other SDB seems to work), but my phone is correctly connected. I have still no clue what is going wrong here.

The dead No command Android is the stock recovery, so obviously something went wrong when flashing TWRP.

You don’t need adb for flashing TWRP. Let’s do this step by step:

  • Turn off the phone.
  • Hold Vol- and push the power button. Keep holding Vol- for a few more seconds. Phone boots into bootloader / fastboot mode (shows only Fairphone logo).
  • Connect phone to PC and run fastboot flash recovery twrp-3.1.1-1-fp2.img. It is completely normal that this takes less than a second.
  • Disconnect phone from PC.
  • Hold Vol+. Hold power button until phone vibrates. Keep holding Vol+. Phone should boot into TWRP.
3 Likes

That’s great, @ChuckMorris, it worked!

Here is what I think has happened: I read in some other place that the OS might replace TWRP with the stock recovery, but did not understand that “no command” is the stock recovery (an no error). I relied on this TWRP thread which recommends booting the phone normally first, which might have overridden TWRP again.

I managed to start TWRP now and swiped along the bottom to allow TWRP modifications (which, as I understand it, modifies the OS to not override recovery). Rebooting into the system and then into TWRP again shows it is now installed permanently.

I think this is worth editing the TWRP wiki thread cited above, but this seems to be locked. Or it is worth adding to your own Howto on Magisk, which I will now follow further. Thank you again! :sunglasses:

Glad that it finally worked. The TWRP wiki post actually says that you have to boot right into recovery after flashing TWRP (in section 6.b) so no need to edit it. :slight_smile:

Also, you should not allow TWRP to modify the system partition. This could / will prevent future OTA updates.

Re-reading the TWRP wiki entry, I still understand it as booting into the normal OS first:

  1. Next we will flash the image to the FP2 by typing:
fastboot flash recovery c:\recovery.img

The flashing only takes some seconds and should not produce any errors.

  1. At last we will restart our FP2 by typing:
fastboot reboot

Your phone should start normally and flashing is complete.

6.b Verify that TWRP was permanently installed:

The reboot in step 6 (the second 1 above - citation messes this up) runs the normal OS, and I think this is what might have reinstalled the original recovery for me. But it may of course be just my way of reading it.

Oh well, and I misundertood the TWRP instructions in the other place that I can’t find anymore (not the FP community) in the way that I allowed TWRP to modify the system partition so that it could actually avoid the reinstallation of the original recovery. Not my day obviously. Is there any way to reverse the changes or revoke this decision otherwise?

Thank you again for your help - this is a great experience and for sure a big plus for the Fairphone!

Hi guys!

I m sorry, my english is bad…

I have some problemes with flashing the last TRWP version (twrp-3.2.1-0-FP2.img -> https://eu.dl.twrp.me/FP2/)

I followed the advice of ChuckMorris:

But when I run the command fastboot flash recovery twrp-3.2.1-0-FP2.img the terminal say < waiting for device > and nothing happens…

First question: where should I file the file twrp-3.2.1-0-FP2.img?

My phone is on Debugg mod (? right in english?).

Thanx for your help!

First things first … make sure your phone is being recognized at all.

When your phone is in fastboot mode, then the command “fastboot devices” (Linux: perhaps better as root or using sudo) should output something.
Here’s a generic screenshot.

If the phone isn’t recognized, there will only be an empty line and you’ll be back on the command line.

If you don’t give an additional path to the file, then it has to be in the path where you execute the command from, but that doesn’t seem to be the issue here (would be “file not found” or something similar then).

Hi AnotherElk, tank you for your help!

Return of the order

fastboot devices
no permissions fastboot

But for

sudo fastboot devices
563147b9 fastboot

So yes, my phone is recognized. Right for you?

the ultimate goal is the installation of LineageOS (https://wiki.lineageos.org/devices/FP2/install)

So what does the flashing command say when you sudo fastboot flash … ?

It even says there: “Tip: If you see no permissions fastboot while on Linux or macOS, try running fastboot as root.”

fastboot flash recovery recovery.img
< waiting for device >

sudo fastboot flash recovery recovery.img
error: cannot load ‘recovery.img’

(I just tried to rename the file twrp …img)