TWRP for Fairphone 5

I think the summary for now is:
someone is planning to root the FP5 using Magisk. But no one up to now has confirmed that it really works.

My FP5 is rooted. Fairphone’s instructions for unlocking work. The Magisk instructions for installing Magisk also work. :person_raising_hand:

4 Likes

Nice ! So same procedure as FP4, patching the boot.img using magisk, booting on patched boot.img then installing Magisk on the system?

We will open a topic once confirmed, could we keep that seperated from the TWRP topic please?

Is there a way to install a GSI system through TWRP on the SUPER partition system of the Fairphone?
Thanks in advance.

Will support for “Encrypted userdata” be available soon? Because without this function, twrp is relatively useless.

1 Like

Hopefully soon, but I can’t promise anything yet :slight_smile:

6 Likes

I’m happy to announce that you can now find TWRP builds directly on twrp.me! Currently there’s no change in supported features or known issues but userdata decryption is nearly ready if everything goes well!

Initial post has been update to point there :slight_smile:

9 Likes

That would be awesome :smiley:
Could you tell us a little more about your strategy to make it working? Is it similar to FP4 decryption or not?

This is the patchset that seems to work but I need to test it in-depth again because it was depending on a patchset which was only semi-recently merged into TWRP.

https://gerrit.twrp.me/c/android_device_fairphone_FP5/+/6952

The general approach would be the same for FP4 but I couldn’t make it work last time I tried.

3 Likes

Thanks for all your efforts into bringing TWRP to the FP5, Luca!

I’m currently trying to get a working build of LineageOS and wanted to use TWRP to do some backups beforehand.

Unfortunately I haven’t managed to disable AVB using fastboot yet and couldn’t boot the TWRP image file. Both fastboot commands seem to be stuck at “Sending xyz.img”. I’ve already tried to use different USB cables. I do not get an error message, it just seems to be somehow stuck. “fastboot devices” correctly lists my FP5 when connected.

Do I have to sign the TWRP image before booting?

EDIT:
The solution was to put an old USB hub between the pc and the phone… That’s so stupid. Found here: https://xdaforums.com/t/yet-again-fastboot-is-stuck-on-sending-boot-img.4166479/
TWRP is booting fine using “fastboot boot” now.

2 Likes

Hi llluuuzzziii,
did you manage to install TWRP permanently ? Or did you just boot from it ? Or did you do something else ?

@All : I did not manage to install TWRP permanently on my FP5 but I managed to fastboot boot into TWRP . Is this sufficient for me to install Magisk or to do a backup of my phone from TWRP ?

Thanks Luca and everyone for their efforts. I spent a long time getting this recovery to work – after the unlocked bootloader warning, the phone remained on the Fairphone logo. The issue was that my A/B boot slot was set to ‘b’. One fastboot set_active other later, the recovery booted right up! Sadly, I bricked my phone shortly after, so I cannot test any further for now…

I managed to fastboot boot into TWRP . Is this sufficient for me to install Magisk or to do a backup of my phone from TWRP ?

I’d also be interested in the answer. If I unlock the bootloader, can I use “fastboot boot twrp.img” to create a backup (as it used to work with my FP2) ?

Hey.

the compiled version of TWRP is only 12.0 which is quite useless at least to me. There is however a uncompiled version of TWRP based on 12.1 in the device repository, which points to behing able to decrypt userdata. Is there a compiled img of that version or do we have to compile it ourself.

You can use the installer to install TWRP like a module in magisk. This will unroot your phone so do not restart your phone. Instead just reinstall magisk and then restart. This will keep TWRP and Magisk.

I am as curious as you, and I tried to compile it this weekend on my linux laptop. I added the additional flags (*) and started the compilation, but it failed because I have too low RAM memory (I have 8Gig) :frowning:

Killed 19:13:57 soong bootstrap failed with: exit status 1
[ 4084.844609] Out of memory: Killed process 20950 (soong_build)

I started again with -j1 as advised, but it didn’t solve anything…

(*) I added the following flags as suggested here:

BOARD_USES_QCOM_FBE_DECRYPTION := true

in /home/oli/twrp-fp5/device/fairphone/FP5/BoardConfig.mk
and

setprop prepdecrypt.loglevel 2 
setprop prepdecrypt.setpatch true 

“on init” in /home/oli/twrp-fp5/device/fairphone/FP5/recovery/root/init.recovery.qcom.rc

My laptop has 64 Gigs of ram but my technical knowhow isnt sufficent. :pensive:

Let’s collaborate then! I give you step-by step instructions (maybe in private msg to not overflow this topic?) and you share the resulting file :smiley:

EDIT: do you have already a Linux OS installed on your computer? Ubuntu will be ideal so we can copy and paste the instructions from my own computer :wink:

1 Like

I dont have ubuntu on this pc. I tried it on my Ubuntu laptop with 16 gigs of ram. Its a trivial task to swap hard drives however so yeah why not.

Ok so here are the instructions step by step. (clic to expand)
  1. Install repo from Google
mkdir -p ~/.bin

PATH="${HOME}/.bin:${PATH}"

curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo

chmod a+rx ~/.bin/repo
  1. create a new directory
mkdir twrp-fp5

cd ~/twrp-fp5
  1. initialize your local repository

repo init --depth=1 -u https://github.com/minimal-manifest-twrp/platform_manifest_twrp_aosp.git -b twrp-12.1

If you have an error message go to step 5 then try step 3 again

  1. Add this device repository to a new local manifest
cd .repo

mkdir local_manifests

cd local_manifests

touch roomservice.xml

nano ~/.repo/local_manifests/roomservice.xml

and paste this inside:
(right clic + Paste to paste; Ctrl+O to save the file; Ctrl+X to leave nano text editor)

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <project name="Fairphone/android_device_fairphone_FP5" path="device/fairphone/FP5" remote="github" revision="android-12.1" />
</manifest>
  1. fix the git identity
nano ~/.repo/manifests.git/config

and write this inside:
(right clic + Paste to paste; Ctrl+O to save the file; Ctrl+X to leave nano text editor)

[user]
        email = user@yourdomain.com
        name = User Name
  1. to sync up:
cd  ~/twrp-fp5/

repo sync
  1. edit the first of the two files I mentioned above
nano ~/twrp-fp5/device/fairphone/FP5/BoardConfig.mk

Paste this inside:

BOARD_USES_QCOM_FBE_DECRYPTION := true
  1. edit the second file
nano ~/twrp-fp5/device/fairphone/FP5/recovery/root/init.recovery.qcom.rc

And paste this in the “on init” section

setprop prepdecrypt.loglevel 2 
setprop prepdecrypt.setpatch true 
  1. and finally compile it:
export ALLOW_MISSING_DEPENDENCIES=true

. build/envsetup.sh

lunch twrp_FP5-eng

m bootimage
  1. have a look if there is a generated twrp file (send it to me so I can test it :slight_smile: )

It should be in ~/twrp-fp5/out/target/product/FP5/boot.img

If you have specific questions send me a private message, and I’ll update this tutorial instead of posting it again and again :slight_smile:

1 Like