TWRP for Fairphone 3

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

I don’t see recovery on offer in TWRP at least.
(Was thinking about installing the TWRP IMG file with the fastboot booted TWRP, but where to?)

From the description of the patch:

  • Add CLI support using the command “twrp decrypt [USER ID]”
  • Add GUI support using the menu Advanced → Decrypt User

I would assume, the secondary user requires a different password.