TWRP for Fairphone 3

EDIT: TWRP 3.4.0 has just been released and with its release FP3 is now officially supported:
https://twrp.me/fairphone/fairphone3.html

Unofficial releases for bug-fixes or feature tests may still pop up now and then on my github.

You can now find TWRP for the Fairphone 3 at my github:

You can boot into twrp using fastboot boot <twrp.img>
I have also included a twrp-installer zip-file that can be used to install TWRP to your device.

If you get a message, that your phone is corrupted and will shut down after 30 seconds,
you need to press the power button and the boot will continue.

You can reset the message using
adb reboot "dm-verity enforcing"

If fastboot boot fails, it is likely, because your current slot is marked as unbootable.
To reset the retry-counter, you need to set it active again using fastboot.
fastboot getvar current-slot
fastboot --set-active=<slot>

Note: When flashing full stock images, that include sbl1 or aboot, make sure both slots have a working fastboot before flashing.
And never flash both slots without first testing on one.

Thanks to @basxto for entrusting me to use his FP3 for development
Thanks to @z3ntu for his initial work on the kernel and for testing.
Thanks to @corvuscorax and @pigpig for their further investigation
Thanks to @michlx for confirming the location of UART
Thanks to @Claymore1297 for relaying my messages :wink:

Full stock installable ZIPs available here:

Full dump of 105 for flashing via fastboot is available here:
Fairphone_FP3_8901.2.A.0105.20191217_12171325_user_release-keys_dump.zip
(8c0475eae9bae8c7ea2f09aae42d3e35)

Disclaimer ~~*I do not (yet) own an FP3 myself.*~~ Thanks to everyone who donated to help me get an FP3 :slight_smile: *If you like my work and want to help me to continue working on the FP3, please consider donating to me, to help me buy one:* *https://paypal.me/steinjoel*
61 Likes

Welcome to the forum. Great work!!!

4 Likes

Impressive! Thank you so much!

Here is a general question. If one uses TWRP in order to create a backup and one selects “System Image”, will one get a perfect stock image that one can trust, in case of device bricking? I went through the FAQ here: https://twrp.me/faq/whattobackup.html, a “Vendor image” seems to be proposed for some devices (obviously not for FP3, at least not yet), but nowhere can I find precise information on what exactly is backed up.

3 Likes

You should generally use the respective “Image” for every partition that gives you that option.
Image will create a direct one-to-one copy of the underlying block-device.
TWRP typically doesn’t include backup-options for all possible partitions.
I have included the ones that are most likely to be modified when the device is rooted.
I have also included some partitions that contain device-specific information such as IMEI (EFS).
It is probably a good idea to backup EFS once and store it somewhere safe, but you typically should not restore it every time.
For a normal ROM Backup/Restore cycle the following partitions should suffice:

  • Boot
  • System Image
  • Vendor Image
  • Data

There is a full stock dump available here:

Installable ZIPs for restoring stock is available here:

11 Likes

@k4y0z Excuse the “stupid” question, but can you point me at a good tutorial/doc/howto for compiling your TWRP from source? I’m having trouble setting up the build environment (lunch gives me errors with non-existing paths)

Start here:

Add this to .repo/local_manifests/fp3.xml

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="chaosmaster/android_device_fairphone_fp3" path="device/fairphone/FP3" remote="github" revision="android-9.0" />
<project name="chaosmaster/android_kernel_fairphone_sdm632" path="kernel/fairphone/sdm632" remote="github" revision="twrp-9.0" />
</manifest>

run repo sync

run repopick -g https://gerrit.twrp.me 1807

11 Likes

Excellent work by all the people involved, doing my first proper fp3 backup right now :heart:

4 Likes

Hm I’m having trouble to backup the data partition:

Backing up Data (excl. storage)…
Backups of Data do not include any files in internal storage such as pictures and downloads.
createTarFork() process ended with ERROR: 255
Backup failed. Cleaning Backup Folder.

The recovery.log file contains the following at the end:

I:addFile ‘/data/misc_ce’ including root: 1
==> set selinux context: u:object_r:system_data_file:s0
I:addFile ‘/data/misc_ce/10’ including root: 1
==> set selinux context: u:object_r:system_data_file:s0
failed to lookup tar policy for ‘/data/misc_ce/10’ - ‘ced9be5f13b1f6aa’
I:Error adding file ‘/data/misc_ce/10’ to ‘/external_sd/TWRP/BACKUPS/A209G7PH0202/2020-01-25–04-25-27_89012A010520191217/data.ext4.win000’
Error creating backup.
I:ERROR tarList for thread ID 0
Error creating backup.
I:InfoManager saving ‘/external_sd/TWRP/BACKUPS/A209G7PH0202/2020-01-25–04-25-27_89012A010520191217/data.info’
createTarFork() process ended with ERROR: 255
Backup Failed. Cleaning Backup Folder.

Did you decrypt data, when you started TWRP?

yes and I can see the internal storage properly. My guess it’s because of my work profile -> https://github.com/TeamWin/Team-Win-Recovery-Project/issues/1373

A huge Thank you! to everybody having made this available.
It’s so good to have this on the phone. And it even can decrypt Android 9 encryption :partying_face: (which is not a given and not required to work).

3 Likes

Looks like that is the issue.
Found this patch: https://gerrit.twrp.me/c/android_bootable_recovery/+/1724
I have built a test-version with this patch included, give that a try:
https://github.com/chaosmaster/android_device_fairphone_fp3/releases/tag/20200124-02-MU

4 Likes

Also please, if anyone has tried the installer, please give some feedback AFAIK it is yet untested.

How to backup/restore the original recovery, if needed, as there’s no complete installing from scratch method available from Fairphone yet?

Does unlocking the bootloader format userdata?

I don’t know whether it formats, technically speaking, but you will lose your data.

4 Likes

Thanks I’ve given it a shot. Still the same problem. My guess from looking into the /data/misc_ce folder is that it’s not properly decrypting the second user:

fp3:/ # ls -R /data/misc_ce*                                                                                                                                                                                      
/data/misc_ce:
0 10 

/data/misc_ce/0:
storaged vold wifi 

/data/misc_ce/0/storaged:
storaged.proto

/data/misc_ce/0/vold:

/data/misc_ce/0/wifi:
WifiConfigStore.xml

/data/misc_ce/10:
dCWPZOjFa6F,kxCfb0uTrC j,0e4+6LXBDhdhqV7hZNbA 

/data/misc_ce/10/dCWPZOjFa6F,kxCfb0uTrC:

/data/misc_ce/10/j,0e4+6LXBDhdhqV7hZNbA:
1 Like

I’ve noticed the “decrypt user” option in the advanced tab. It fails to decrypt with my PIN though.

After deleting the work profile, backup up the data partition works fine.

4 Likes

Wow! Managed to root using magisk, instead of using the installer cant we just do:
fastboot flash recovery twrp.img

2 Likes