TWRP for Fairphone 4

I downloaded the e/os zip, patched the boot.img and then just followed the regular installation instructions with the patched boot.img. I also didn’t locked the bootloader after that

Edit: Meaning I just did this

  • Boot your FP4 in bootloader mode, and plug it to your computer
  • On your computer, download the zip file from the link provided above. Unzip the folder and browse into it
  • Flash /e/ with the following commands:

with the patched boot.img instead of the regular one

Interesting. Did you unlock your bootloader (again) before the install?
As my phone was already unlocked, I skipped it and only unlocked the critical part.

I didn’t unlock anything specifically for e/os, I’d already unlocked everything I needed to flash a rooted stock image about a week ago. I didn’t change anything since then

OK, so do I understand correctly that I can back up and restore my FP4 with this, but not my data folder? What folders would I have to additionally copy via USB to have a full backup of my phone?

Or asked differently: Does this guide work with this TWRP version on FP4?

Funktioniert das nicht mehr?

adb backup -all
adb restore backup.ab


adb backup -apk -shared -all -f <filepath>/backup.ab
adb restore <filepath>/backup.ab

Also ganz ohne TWRP und root…

All user data is on the so-called userdata partition which is always encrypted on FP4, and TWRP currently cannot decrypt it and see the data to back it up. So you can only “back up” system partitions that contain the Android system but that’s probably not what you’re looking for.


That guide won’t work for a full backup, all the interesting parts of the system (apart from the A/B partitions) are inside the super partition. Without access to encrypted data in TWRP you can’t back up that partition. Edit 2: super isn’t encrypted :man_facepalming:
I backed up all the partitions I could on a running phone using dd, but that won’t produce a complete set of partitions you can use to flash your phone back to normal, since you can’t completely back up those special partitions from userspace.

Edit: Too slow :smiley:

1 Like

Can we back up the super partition in TWRP? :thinking:
/data doesn’t work, sure, but the super partition would be more interesting. The amount of partitions I can choose from in TWRP doesn’t really match the partitons actually on device…

Not so. It’s good to see two consecutive posts saying the same.

It has been said many times, elsewhere, and clearly can do with repeating / emphasising :slight_smile:

1 Like

With no local data, like I have, a backup does no really makes sense.
The only backup I use is app setting backups.

If I have to recover my phone, I have to install the apps, recover the settings, that’s it.

It’s my kind of using dates. My security. I know… :wink:
I hope I get no shitstorm yet… :wink:

super is not encrypted so sure. Not 100% sure how well the backup from TWRP itself is but you can definitely just use dd from the command line to just make a 1:1 image of the partition that you should be able to flash back via fastboot.
The dd image will also be the full size of the partition, and not just the system data it contains, maybe it’s possible to use the img2simg tool to shrink it down and convert it into a sparse image.

So do I understand it correctly that the guide I linked to doesn’t work for FP4? If that is the case, it should be mentioned in the guide.

Do I also understand correctly that a full backup and restore is not possible at all?

Backing up super in TWRP fails, I just tried.
I do have backups of the super partition and all the others, but from a running system. I don’t know if I can flash those back to my device safely, since we have had problems with AVB in other topics before. At around 100 partitions (with duplicates, full storage device backups…) the chance for failure seems pretty high to me. Are you sure this works? :thinking:

Well maybe I’ll just have to flash /e/ and try to go back to vanilla :slightly_smiling_face:

@Discostu36 You can’t backup /data and super from TWRP at this point.
I wouldn’t suggest flashing /e/ if you are not sure you want to stay there, if that’s what you’re asking :smirk:

My use case is that I can do a factory reset / lose my phone / wreck my mainboard / whatever and then have a backup that I can restore and have everything in place like nothing ever happened.

That won’t be possible, no.
Your best bet is setting up something like Syncthing for your important data or trust Google with your stuff and activate their cloud backup (that will backup app settings for compatible apps as well) :see_no_evil:

I followed build instructions and I was able to build the recovery image :partying_face:

[100% 8355/8355] build out/target/product/FP4/recovery.img
#### build completed successfully (43:03 (mm:ss)) ####

Image is booting correctly in TWRP 3.6.0_11-0 :smiley:
however the file differs from yours:

SHA256 hash di recovery.img:

SHA256 hash di .\twrp-3.6.0_FP4-UNOFFICIAL-20211216.img:

Is accessing encrypted data a general-TWRP function that is still a work-in-progress, or is this somehow already available and needs to be ported specifically to FP4?

Having this function will help a lot making backups and resolving some stupid mistakes :wink:

1 Like

Accessing encrypted /data through TWRP is possible on other devices, this has to be ported specifically for the FP4.



I don’t think TWRP images can be built reproducibly (so the file is really identical) and even if, your sources are very likely newer than the ones I built it with.

Should work in theory, it’s even relatively well documented at GitHub - TeamWin/android_device_qcom_twrp-common: TWRP standard device files for Qualcomm SoCs but last time I tried I couldn’t get it to work.


Is FP4 a FBE (File-based encryption) or a FDE (full-disk encryption) device?

On the “Troubleshooting/Debugging” section, they advice to add a line or two (setprop prepdecrypt.loglevel 2 and setprop prepdecrypt.setpatch true) to have debug logs, did you try that already? :slight_smile:

It seems to be FBE:

$ adb shell getprop ro.crypto.type