Sideloading f-droid privileged extension fails on 17.1
Context
- Reported on F-droid's side
- Forum thread the issue was initially debugged in
- Device: Samsung Galaxy S4 with LineageOS 17.1 and same recovery version
Expected Behavior
adb reboot recovery- "Apply update"
adb sideload org.fdroid.fdroid.privileged.ota_2110-mod.zip- Confirm despite the signature verification
- Reboot
Current Behavior
Works up to 5. Upon rebooting, the privileged extension doesn't work. Additionally, ADB ceases to work after sideloading.
Possible Solution
I investigated this quite thoroughly. There are a few inconsistencies regarding how things are handled:
- Inside the recovery,
$PATHis/system/bin - F-droid's OTA mounts
/system, relying on the recovery'sfstab. - The recovery itself mounts the system partition at
/mnt/systemwhen prompted. - Binaries are in
/system/system/binafter mounting the/system partition, so they are not found in$PATH, which breaks everything. Additionally, symlinks aren't working TODO - F-droid relies on
getprop ro.build.system_root_imagereturningtrueto detect the system path as/system/system. It isn't set to true.
Based on those, even though I am unfamiliar with lineage's build system, I'm wondering if the recovery shouldn't be built with ro.build.system_root_image = true. I think it should at least have /system/system/bin set as the $PATH, or as a secondary one, to keep working after mounting system.
As an additionnal note, adding /system/system/bin to the $PATH doesn't work, nor does copying the /system/bin binaries somewhere else beforehand. I don't know why this happens, could be due to a different $LD_LIBRARY_PATH, though I tried setting that to /system/system/lib:
jflte:/ # mount /system
jflte:/ # ls
/system/bin/sh: ls: inaccessible or not found
jflte:/ # echo $PATH
/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin
jflte:/ # export PATH=$PATH:/system/system/bin
jflte:/ # echo $PATH
/sbin:/system/sbin:/product/bin:/apex/com.android.runtime/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin:/system/system/bin
jflte:/ # ls
/system/bin/sh: /system/system/bin/ls: Too many symbolic links encountered
Steps to Reproduce
- Download the latest f-droid OTA zip
- Follow instructions from the expected behaviour.
Alternatively:
computer ~ % adb reboot recovery
computer ~ % adb shell
jflte:/ # mount /system
jflte:/ # ls
Additional info:
- Build number:
lineage_jfltexx-userdebug 10 QQ2A.200405.005 e1e00a455b
/device jfltexx /version lineage-17.1 /date 2020-04-20 /kernel 3.4.112-g8c8593f /baseband I9505XXUHPK2 /mods F-Droid
I have read the directions.