Building LineageOS for FP4

So it’s encrypted but /metadata isn’t mounted, could this be a problem with the state the previous ROM left behind? :thinking:
The /e/ install guide specifically mentions:

fastboot erase userdata
fastboot erase metadata

Did you issue those commands after you flashed lineage?

Edit: It’s possible lineage doesn’t actually use metadata encryption, here is the documentation on that matter.

Edit 2: Just found this:

Devices launched with Android 11 or higher must have metadata encryption on internal storage enabled.

So it has to be enabled but it’s not mounted, our old nemesis AVB strikes again :roll_eyes:

1 Like

I most definitely did not, I don’t think it was on the lineage tutorial, or was it ?
Technically what will be the effect on my device ? Because I do not experience any issue… yet.
Been setting up my phone almost completely now and it’s pretty smooth

1 Like

Then I’d suggest just riding that lineage wave for some time until it breaks.
Those commands will only wipe userdata / encryption metadata completely in the best case and in the worst lead to a host of other issues.

Enjoy your artisinal homemade ROM for now :smiley:

1 Like

I most definitely will.
While you’re there could you please enlight me on some concepts I didn’t quite grasp ?

For a start, regarding localisation apps: so I managed to get google maps working though I can’t login (and it seems I won’t be able too), but I had to install location providers.
My understanding is that those location providers replace Google service’s ability to provide location information.


  • Just which ones should I use ?

  • Is there any point in installing several of them ?
    I currently installed: mozilla, applewifi, deja vu, GSMNetworkLocationProvider, Nominatim
    Can I assume that the more of them installed, the more precise the location will be ? Will it significantly drain my battery ?

  • What about sattelite localisation ? I still don’t understand why my phone would not be able to get location information when it has an integrated GPS ? Can’t it work on degoogled phones ?

GPS should still work without problems, those are used to get a faster fix or location information in places where GPS isn’t available.
More ≠ precise in this case, there’s sadly no real logic to which one takes precedence. IIRC the fastest one is used :thinking:

As for which one to choose, they all have their strengths and weaknesses, I think this wiki (a bit old) provides a great overview. As far as I can tell, the most up to date one is LocalGsmNlpBackend and that’s the one I usually use, mostly because it’s easy to contribute to with Tower Collector and the database is available offline.
Wifi based ones have been buggy for me in the past, sometimes the location would end up two towns over, cell towers rarely move :smirk:

Edit: Maybe this topic should be split now above this post and turned into a more general one discussing building lineage etc.? :thinking:

Edit 2: Thank you @robbert.f that was fast :smiley:
Would it be possible to move the first post back to the other topic, otherwise that one ends without the solution. Nevermind :slightly_smiling_face:


Don’t press the power button, but instead maintain one of the volume buttons and then connect the USB-C cable to your computer. Your FP4 will be in:

  • volume down + cable : fastboot mode,
  • volume up + cable : Android recovery

That’s a great way to do it :metal:

I generally keep it plugged in and release Power as soon as the screen turns black, then just keep holding up or down until you’re in the desired mode.
Bonus tip: Pressing Vol. Down during the boot animation (that blue dot) will boot you into Safe Mode, really useful if you messed up some Magisk configuration as this will disable all modules.


I’m currently looking into building LineageOS with microG and fdroid. As far as I understand, I need to enable signature spoofing using these patches and then include these packages while building LineageOS.

I was able to apply this patch but when I tried to apply this one I get an error saying

can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
|--- a/src/com/android/permissioncontroller/permission/utils/
|+++ b/src/com/android/permissioncontroller/permission/utils/

since the files it’s trying to patch don’t exist.

Do I only need to use the other patch or did I miss a step?

Very nice, you got a working build for the FP4! :smiley:
Are you able to contribute your work the the semi-official channels in this thread: FP4 and LineageOS - #70 ?

Seems dk1978 and the others would be happy to get help. :slight_smile: Then, even more users would benefit. Have a nice day!

1 Like

I would gladly contribute, but to be honnest this is my first ever custom ROM build - kind of a little event in my concern :smiley: - and I wouldn’t really know how to contribute.

I only but followed the procedure written by @Error so I didn’t really achieve anything I could take credit for ! I didn’t modify a single file from the repo in the process… (I’m just starting to mess with the manifest to create a gApps bundled version but that’s about it)


I just didn’t apply the second patch, only the first and continued. LineageOS built successfully, I checked the installed-files.txt file in the output directory and it says that /system/app/FDroid/FDroid.apk and /system/app/FDroid/FDroid.apk are installed, so I guess it worked.

I’ll write a post later on what exactly I did.

1 Like

There isn’t any work to be contributed per se, we just compiled the already existing code using the sources on the WeAreFairphone github account.

I’d be interrested to know more indeed.
I’m trying to bundle pico Gapps to the build, following this guide .
Well a lot of things didn’t go as planned and I was able to fix some of them but there’s still a bit of work ahead

1 Like

I managed to build version with pico Gapps bundled, I know this will make lot of you cry, anyway I’ll try to test my limits in my ability to use a fully degoogled system before I flash it :smiley:

1 Like

My FOSS :heart: is crying, but I love it that you have hacked your way to the system you want / need, nice job :metal:
Keep us posted! (And maybe throw in a short tutorial for others that want to take the dark route)

1 Like

Well don’t cry just wait I didnt give up on degoogled spirit as I didn’t flash the beast yet (I will post a tutorial if I get certain it actually works).

I really start to like and do want my phone to run as clean as possible its just… the maps thing :smiley:
I don’t know if there’s something wrong with the build or if it is the lot of degoogled roms but location is VERY inconsistent: when I’m at home (appartement in rather big building) and open OsmAnd, Waze or Gmaps location is sometimes 4-5km off, and then it goes gets my accurate position then off 5km again etc….

That sounds like UnifiedNLP acting up. Try disabling all location providers and see if the problem persists :thinking:
You can also use GPSTest to download time data and improve the time it takes to get a GPS fix.

1 Like

Againg, you were right, thank you ! I should never trust internet; I tried enabling/providers but always kept Mozilla one as there seemed to be some kind of consensus on the web according to it being mandatory. Turns out it was the one messing with my location.
That FOSS device is starting to be usable after all !


I’ve got LineageOS 18.1 running on my phone, together with microG and fdroid + FDroidPrivilegedExtension.

Before building I applied this patch with

patch -p1 -i /home/username/Documents/projects/FP4-lineageos/microgpatches/android_frameworks_base-R.patch

as described here.

Then I included these packages by adding

<project path="vendor/partner_gms" name="lineageos4microg/android_vendor_partner_gms" remote="github" revision="master" />

to my roomservice.xml file.

I also added two environment variables:

export WITH_GMS=true
export CUSTOM_PACKAGES="GmsCore GsfProxy FakeStore MozillaNlpBackend NominatimNlpBackend FDroid FDroidPrivilegedExtension"

Although I’m not sure if the latter is necessary for the build.

MicroG’s self-check reports that everything is fine.

The phone warns me about using test keys (duh).

The only thing that’s different is that the camera looks worse than before - 12MP instead of 48MP and no access to the wide-angle camera. I’m thinking about bundling their camera app as a system app and seeing if it works.