How to install F-Droid with Privileged Extension on LineageOS?

Hi, apparently I’m having troubles to understand this process properly and couldn’t find sufficient instruction anywhere, hope someone will be able to give me some orientation.

Device: Moto E (2nd Gen, 2015) 4G/LTE - Surnia
OS: LineageOS 17.1-20210430-NIGHTLY-surnia (Android 10)
Host machine: Debian (Testing) with adb and fastboot, from updated official repositories.

After reading this: https://gitlab.com/fdroid/privileged-extension/#f-droid-privileged-extension
I went there: https://f-droid.org/packages/org.fdroid.fdroid.privileged.ota/
Downloaded the last ZIP: https://f-droid.org/repo/org.fdroid.fdroid.privileged.ota_2120.zip
And then following this: https://wiki.lineageos.org/devices/surnia/install#installing-lineageos-from-recovery
I rebooted the device in Recovery mode (with Lineage custom Recovery, already installed) and followed:

On the device, select “Apply Update”, then “Apply from ADB” to begin sideload.
On the host machine, sideload the package using: adb sideload path-and-filename.zip
Once you have installed everything successfully, click the back arrow in the top left of the screen, then “Reboot system now”.

Apparently everything went fine. Now, once rebooted I don’t see nothing F-Droid nowhere. Is this correct? I did everything fine?
I then downloaded in the smartphone: https://f-droid.org/F-Droid.apk
But when trying to install it the system (LOS) tells me that, “For your security, your phone is not allowed to install unknown apps from this source.”, and if I go to Settings it offers me to “Allow from this source”. Is this the idea? Should I allow and that’s it, or this is not working right at the moment?

Please, let me know if I’m not being clear enough or should add any other data.
Any clarification would be most welcomed.

Thanks a lot in advance.

All seems usual. In android settings, apps, show system, you should see f-droid privileged extension, after installing the zip. To install a downloaded apk, you do need to “allow unknown” for f-droid app to work. If you installed a ROM like DivestOS, it comes with f-droid and extension, so you can avoid some extra steps.

1 Like

Thanks a lot for your reply, @justsomeguy!

When I go Settings > Apps > See all > Show system, and try searches with, ‘privi’, ‘ext’, ‘f-’ and ‘fd’, nothing appears. Does this means that the ZIP (Privileged Extension) didn’t get installed/flashed? I’m under that impression. Anyone know if there’s another way to check it? Or maybe this is kind of a bug?

Thanks a lot.

No, it actually did. I tried flashing the zip but I didn’t see the app called F-Droid Privileged Extension just like you. Then, after some reading from the ota site:

The standalone APK is called
org.fdroid.fdroid.privileged, and that provides updates after this
OTA package is installed.

I installed the apk as a user app and now F-Droid has a new setting called Privileged Extension, I checked that box and now the system installer doesn’t prompt to install anymore, then it’s working.

1 Like

Also, I checked the zip and the Privileged Extension apk was in there too, but for some reason it didn’t install when flashing the zip. I think that’s why we don’t see the app. Then the solution is to install as a user app.

1 Like

Thanks a lot, @JohnFai!

So, at least at the moment, this is kind of a three-steps process?

  1. Flashing the OTA-ZIP in Recovery mode
  2. Installing F-Droid’s app (APK) as an “unknown app”
  3. From inside F-Droid’s app install the Privileged Extension (APK) as a user app

Then the Privileged Extension setting should be added and appear enabled in F-Droid and that would be all?

I’m trying to have this very clear so this serves also to other users.

Thanks again!

1 Like

By the way, if you have Magisk installed, maybe the easist way to installed the extension is to installed the Magisk modular.

I checked on the magisk module, I think you are talking about this by Ryaniskira

It is quite oudated though, even though the release date was 6 March, it’s still on the 0.2.11 (released on 2019-11-22) version.

Hi, I have just followed those steps and the setting from Privileged Extension appears and it’s enabled, but when I try to install any app I get:

Error installing NameOfTheApp
The privileged permissions have not been granted to the extension! Please create a bug report!

If I go to Settings and disable the Privileged Extension then I get the usual:

AppName
Do you want to install this application?

, from the system, and after choosing Install, everything goes fine, so, seems like the OTA-ZIP is not working? Any idea or suggestion?

Thanks a lot.

Have you tried flashing the zip again? Which recovery are you using? What does the log say when you’re sideloading?

Ah, yes, you are right. But it works well for me when I tested it.

Actually, the priv-app permissions xml file is also needed, which allows the priv extension to run. that should be in /system/etc/permissions with proper permissions. I am attaching the XML here, unzip and see. org.fdroid.fdroid.privileged.xml.zip (354 Bytes).

Ohh and the easiest way to install (if rooted),place the priv extension in /system/priv-app/FDroidPriveleged & the F-Droid app itself in /system/app/FDroid folder, while placing the XML file in /system/etc/permissions. Provide correct permissions 0644 & 0755, and then reboot once. If for any reason still face issue, install as user app and reboot/soft reboot. Done. :slight_smile:

The recovery I’m using is the official one from LOS, which I installed just a couple of weeks ago as explained here: https://wiki.lineageos.org/devices/surnia/install#installing-a-custom-recovery-using-fastboot
The file was: lineage-17.1-20210409-recovery-surnia.img (I still have it on my machine.)
And I already had two system updates without issues. Don’t know if those updates also update the recovery image.

I’ve just tried to flash the zip again.
On the smartphone, in Recovery mode, after “Apply Update” and “Apply from ADB”, I connect the USB-cable and get:

Now send the package you want to apply to the device with "adb sideload <filename>"...

On the host machine (Debian-testing laptop):

$ adb devices 
List of devices attached
T03970LI5J	sideload
$ adb sideload org.fdroid.fdroid.privileged.ota_2120.zip 
serving: 'org.fdroid.fdroid.privileged.ota_2120.zip'  (~47%)    adb: failed to read command: Success

In the middle I had to accept in the smartphone:

Signature verification failed
Install anyway?
Yes

And it shows:

Finding update package...
Opening update package...
Verifying update package...
E:footer is wrong
Update package verification took 0.1 s (result 1).
E:Signature verification failed
E:error: 21
Finding update package...
Opening update package...
Installing update...
Installing F-DroidPrivilegedExtension...
done

Installing F-Droid...
done

Note: for some reason (I don’t know) if I try at this point adb devices I get nothing (on host machine):

$ adb devices 
List of devices attached

Then I go back (up-left-arrow) in the smartphone and before choosing “Reboot system now” I see:

Install completed with status 0.
E:Failed to clear BCB message: failed to find /misc partition

Don’t know if relevant.

Then I unplug the USB-cable from the smartphone and choose “Reboot system now” (didn’t check if immediately after unplugging any other message appeared in the screen, sorry).

Then system (LOS) reboot fine, I go to F-Droid Settings and check/enable “Privileged Extension”. Then I try to install, let’s say, “Share to Computer” app, it downloads, and then I have:

Error installing Share To Computer
The privileged permissions have not been granted to the extension! Please create a bug report!

Then I disable “Privileged Extension” in F-Droid Settings and now, after choosing “Install” when prompted (“Do you want to install this application?”), application gets properly installed.

That’s all I’ve found until now.

Thanks a lot for any help or recommendation.

Signature verification failed
Install anyway?

Try checking the zip download integrity, or maybe you are being affected by the recent f-droid key issue, IDK.

I think that comes from this: https://wiki.lineageos.org/devices/surnia/install#installing-lineageos-from-recovery

(Optionally): If you want to install any add-ons, repeat the sideload steps above for those packages in sequence.
Note: Add-ons aren’t signed with LineageOS’s official key, and therefore when they are sideloaded, Lineage Recovery will present a screen that says Signature verification failed, this is expected, please click Continue.

Just in case I will try again in some time when that issue is solved. Thanks a lot, @justsomeguy.

BTW, you do know you can just install the f-droid app apk, and run it without the privileged extension? It just means you have to say “OK” a little more often to slightly less automatically install apps and updates from the store. Personally, I prefer without the extension anyway.

1 Like