✏ Porting TWRP recovery

I am proud to present a TWRP build with working crypto! That means, that you can access your data partition even if it is encrypted from Android!

Decryption is confirmed to work with a 3x3 pattern and with a passcode.

Download link: https://private.z3ntu.xyz/fairphone/TWRP_3.0.3-1/

Take a look at the readme.txt file for info what file is what.

20 Likes

Here a short extract from my recovery.log:

Enabling support for allow_discards in dmcrypt.
load_crypto_mapping_table: target_type = crypt
load_crypto_mapping_table: real_blk_name = /dev/block/mmcblk0p20, extra_params = 1 allow_discards
Password matches
Data successfully decrypted

Fantastic!

Thank you so much! Very well done!

Cheers!

2 Likes

Same here, verified with a text-passphrase set with snooperstopper.

1 Like

Works great for me, too! You deserve a very prominent place for your work, here!

2 Likes

Great work, my phone is finally encryted and i can back up my system with TWRP. Incredible! I am so happy!

A new version of TWRP was released yesterday and here’s a build (with decryption support as the last build).

Download link: https://private.z3ntu.xyz/fairphone/TWRP_3.1.0-0/

Changelog: https://twrp.me/site/update/2017/03/10/twrp-3.1.0-0-released.html (a bit less as the previous builds were already with changes from 3.1.0-0)

Take a look at the readme.txt file for info what file is what.

7 Likes

Just in case that this is not known by everybody. If you’re using TWRP already, it’s possible to flash the newer TWRP recovery images straight out of TWRP without ADB. Just use the “flash img” instead of “flash zip” button and flash the recovery image only.

5 Likes

I couldn’t flash TWRP_3.1.0-0. Via fastboot I get this:
fastboot flash recovery TWRP_3.1.0-0.img
target reported max download size of 536870912 bytes
sending ‘recovery’ (12240 KB)…
OKAY [ 0.385s]
writing ‘recovery’…
OKAY [ 0.163s]
finished. total time: 0.549s
But it didn’t change anything.

Trying to flash out of TWRP 2.8.7.0 with the image on an external not encrypted sd card it fails saying unable to mount ‘/data’. So I suppose the second way only works for a crypto version of TWRP.

What exactly do you mean with that? What happens if you try to enter recovery mode after you’ve flashed it via fastboot?

I mean that afterwards there still is TWRP 2.8.7.0 instead of 3.1.0.

That’s weird. But if you just boot into TWRP 3.1.0 via
fastboot boot TWRP_3.1.0-0_signed.img
(the signed version) it starts it, right?

That’s extremely weird… Did you try the suggestion from @Volker ?

Not yet, but I’ll do this as soon as I have backed up my freshly installed system via TWRP. (I had some problems with a new opengapp pico version an the last OS update as well.) After this I’ll be here again.

1 Like

Ok ‘fastboot boot TWRP_3.1.0-0_signed.img’ works fine.

I found out that I don’t have any permissions via adb: ‘failed to copy ‘test’ to ‘/device’: Read-only file system’

Could this be the reason why I cannot flash? I haven’t got a clue how I can get those permissions back.

The root filesystem / comes the ramdisk embedded in the boot image. You cannot write that by default because it’s mounted read-only (ro). If you really want to write to that filesystem (you probably don’t want to), you can remount it as read-write with mount -o rw,remount /.

And you probably want to flash updates either with adb sideload (find the button in TWRP for that), just copying the zip to the phone storage and apply it from that or use fastboot.

Thanks for the explanations. This stuff is still quite new to me. I have just discovered the image installing button in TWRP and I successfully installed TWRP_3.1.0-0. Great, now I can encrypt my system and have backups as well.

As far as the adb permissions are concerned I have opened up a new thread here:

Reading the wiki post at the top, and other posts on this forum regarding TWRP, I have a few questions. I haven’t read this entire topic, so apologies if they were already answered (but if you answer them anyway, I’ll try to improve the wiki post). Here goes:

  1. Huh? I thought that FP Open OS did not preinstall Google Services? Did I understand this incorrectly? Am I reading this wrong?

  2. Also, it does not make sense to me that a recovery image is installed along with the OS it is protecting. Or is there another layer of protection underneath the recovery?

  3. If FP Open includes TWRP, what version is it? I presume some older version, so you would want to manually install it to get a newer version and/or encryption support?

  4. I see some changes being required to configuration files and Makefiles. Are these changes still needed, or have they been merged in the upstream TWRP sources already?

  5. I see a number of downloads with binary versions of TWRP by various people, but it doesn’t seem clear to me what source files were used for them. Just upstream TWRP sources with FP2 selected as the target, or are there modifications included? In particular the builds with support for encrypted data partitions, is that a feature that got released as part of upstream TWRP, or is that some FP2-specific code that only lives on some developers’ machines? Does the TWRP project perhaps have official builds of their own?

  1. Huh? What binary blobs?

Mind the double negative! Yes, Open OS comes without G%§$e, that’s what the text you quoted says.

The thing is that an OS can’t be modified (including the recovery) to have official G%§$e Support. But since TWRP is far superior FP decided to preinstall it with Open OS, where they don’t have to follow G%§$e’s stupid rules.

I don’t have the version number by hand, but yes it does not have encryption support.

FP Open does not preinstall Google services so either you live without them or flash them afterwards (eg opengapps)

FP Open ships with TWRP as the recovery image by default.

TWRP 2.8.7.0 without /data decryption support.

If you build from the FP Open sources probably yes but that’s not recommended actually because of various reasons.[quote=“matthijs, post:186, topic:12558”]
I see a number of downloads with binary versions of TWRP by various people, but it doesn’t seem clear to me what source files were used for them. Just upstream TWRP sources with FP2 selected as the target, or are there modifications included? In particular the builds with support for encrypted data partitions, is that a feature that got released as part of upstream TWRP, or is that some FP2-specific code that only lives on some developers’ machines? Does the TWRP project perhaps have official builds of their own?
[/quote]

For my downloads (from private.z3ntu.xyz) you can find all important details in the readme.txt file next to the .img files.

1 Like

Ah, fell for the famous double negative. I went ahead and reworded the phrase to be IMHO more clear.

Ah, that might be something worth mentioning in the wiki post?[quote=“z3ntu, post:188, topic:12558”]
TWRP 2.8.7.0 without /data decryption support.
[/quote]

Thanks, I added that to the wiki post.

Ah, should have looked there, thanks!

Looking at the wiki post again, I think I was slightly confused by all the patches being listed there. Now I understand that those were part of the original posting and process of porting a more recent TWRP version to the fairphone, and it seems that this is mostly historical, and no longer relevant for users wanting to learn about TWRP now. Would it makes sense to move this part (Everything from “Links” up to “Versions”, and probably also including the “first” and “newer” version, but not the latest version by @z3ntu) further down the post (and mark it as historical) so the latest version, flashing howto and upgrade howto are more obvious? This is a big change, so I’m not confident to go ahead and make this change directly.

3 Likes