Privileged Extension OTA package broken for Android 10 / LineageOS 17.1?

So, I have upgraded my system from LineageOS 16 to 17.1 (Android 9 to 10) and it seems that the Privileged Extension OTA package is no longer working properly. I flashed the package directly aftter the upgrade via ADB sideload. The TWRP log shows that the Privileged Extension has been installed but after booting up the system it is nowhere to be found. Apps have to be installed manually. F-Droid itself is working fine though. The Magisk OTA package installed just fine. Installing the Privileged Extension as Magisk module works fine too.

Maybe the install script has to be revised for Android 10/LineageOS 17.1?

1 Like

Hi,
this seems me right. :slight_smile:
Maybe
– source code:

android:minSdkVersion="8"       
android:targetSdkVersion="25" (aka: Android 7.0)

This is probably similar to this issue: https://github.com/WeAreFairphone/flashable-zip_microG/issues/11

1 Like

Try with the Magisk module instead, if Magisk works on LOS that is.

I’m using LOS 17.1 and I’ve installed the Privileged Extension OTA package using the LOS recovery as well as the F-Droid Privileged Extension Magisk Module and F-Droid package. Afterward F-Droid installs still require manual approval. Both package and module install without error. App info for the F-Droid Privileged Extension shows it only using 86.02 kB of storage on LOS 17.1 which seems low. My LOS 16 device shows F-Droid Privileged Extension using 217 kB.

Have seen glitches with the Magisk module too.

Try to remove the module, leave F-Droid installed, then reboot, install module, reboot, retry

Not sure if the order of install has an issue.

Eg. I had it not work before, had to reinstall whole system and now works fine.

There seems to be an on-going issue: https://gitlab.com/fdroid/privileged-extension/issues/47

I’m now building Los17.1 for SonyXZ1 and have F-DroidPrivilegedExtension working fine:
@CryptOwl can you check via twrp for (/system) /system/priv-app/F-DroidPrivilegedExtension and etc/permissions/permissions_org.fdroid.fdroid.privileged.xml ?

jic, I’ve myself also added some redundant, in etc/sysconfig/*.xml

<config>
  <system-user-whitelisted-app package="org.fdroid.fdroid.privileged"/>
  <hidden-api-whitelisted-app package="org.fdroid.fdroid.privileged"/>
</config>

(As for F-Droid apk, it came in /system/product/app/)

I second this. I attempted to reinstall the ota, without succeeding at first (lineage recovery).
Installing unifiednlp by pushing to /system-priv worked, so I am tempted to perform the same thing. (I don’t recall the exact procedure, could have been an OTA).

@oF2pks I do not have these files on my system after sideloading the ota.

I dug a bit more. Attached is a full log: recovery-log.zip (6.6 KB) .
The blame might be on lineage side this time: after mounting /system, /system/bin isn’t a folder anymore, and that’s the one used in the $PATH As such, no command can be executed as soon as /system is mounted. Moreover, I cannot use /system/bin/ as it then complains of “too many symbolic links encountered”. I also tried copying /system/bin into /tmp to have the executables (these didn’t seem to be symlinks), but I get the same issue (if anybody has an explanation, I’d be glad to hear it):
/system/bin/sh: /tmp/bin/ls: Too many symbolic links encountered.
I’m tired now, but it nows appear ls is a symlink to toybox, like busybox would be. Unsure why it didn’t show up previously.

I don’t know whether my device uses /system as root, getprop ro.build.system_root_image returns nothing.

I will try to ask the lineage devs if I can. There seems to be something funky going on with the recovery, or something else. I previously tried with the 16.0 recovery, this was with the 17.1. The recovery mounts the system partition under /mnt/system when asked. So I remounted it rw with mount -o remount,rw /mnt/system, and changed the SYSTEM variable in the f-droid install script to SYSTEM="/mnt/system/system", as well as commenting the mount /system line. That worked. But it is far from optimal, so it remains to be investigated. It might just be the lineage recovery putting its binaries in /system/bin instead of /system/system/bin, thereby causing all these issues.

It’s 2 am, I’m going to bed :slight_smile:

edit: I tried to attach the updated zip, but it’s 2BM too big.

Takeaway: a lot more tests are needed in the install script, with better error messages. I might contribute them.

For both F-DroidPrivilegedExtension & MicroG/UnifiedNlp you should never change system/bin that can lead to softbrick(s). Only accessible standard /system locations

/system/priv-app
/etc/sysconfig
/etc/permissions

Yeah, of course. But to cp files, I need to use $PATH/cp, and when $PATH is /system/bin instead of /system/system/bin, and the symlinks are wrong, the OTA script cannot use cp, mv, grep, chmod, getprop, rm, or anything else really, after mounting /system:confused:

I assume this might be device-specificc, but that was at least the case on mine.

I try to ask about this on lineage’s reddit, but haven’t received an answer for now. I’ll try with their freenode, when matrix.org lets me join…

Basically either you use risky TWRP/Advanced/FileManager, either you use reversible systemlessly Magisk module to perform /system modifications…

If TWRP/Advanced/ FileManager doesn’t mount well, you should report in your device twrp thread.

Well, in the worst case you can just reflash /system, but it’s kind of off-topic here: The issue is that the OTA package is broken.
I found the root cause, at least on my device: the OTA mounts /system, which shadows the aforementioned binaries, and therefore prevents the rest of the script form working.

I don’t even use TWRP (Lineage Recovery 17.1 instead) or a file manager that comes with the recovery, though I get you point. I poked around using adb, and changed the OTA script accordingly.

Okay, I’ve got what you mean, you should find safe answers here : https://github.com/topjohnwu/Magisk/commit/f2d2f28e23af00db4a776a6ded8b0c34f8129f62#diff-c83afb1d8d0b95609e4c0b46e0542664R217

and here https://github.com/topjohnwu/Magisk/commit/ab9442d4ae81c0707615f6ba7dd1cbc999b390ca#diff-c83afb1d8d0b95609e4c0b46e0542664

Check also openGapps: https://github.com/opengapps/opengapps/blob/0bfe62576a57fb68974b8136da19bfba086bacf2/scripts/inc.installer.sh#L980

1 Like

Linking here the not-so-elegant-but-working solution we rolled at WeAreFairphone/flashable-zip_microG: