WeAreFairphone / flashable-zip_microG

Install microG or UnifiedNlp into an Android system, plus an OTA survival addon.d script
https://github.com/WeAreFairphone/flashable-zip_microG/releases
GNU General Public License v3.0
28 stars 6 forks source link

UnifiedNlp not working on LineageOS 17.0 Beta #11

Open oscaropenness opened 4 years ago

oscaropenness commented 4 years ago

Steps to reproduce: Flash UnifiedNlp_2018-08-17.img via TWRP 3.3.1 Long press on location icon in pulldown menu start osmand with Battery Saving location activated

Expected behaviour: In location setting should be a link into UnifiedNlp-App. Osmand~ should find location via Cell Network.

Actual behaviour: App does not show up. Osmand~ does not find location.

Does the UnifiedNlp work under LineageOS 17? What adjustments need to be made to make it work?

Roboe commented 4 years ago

Hi, thank you so much for bringing this up.

I currently don't have a device with LOS 17, and therefore I can't test this. I don't know neither if there've been any changes to the Android system that render this kind of installation obsolete for that Android version upwards.

I'm afraid I'm unable to do much more to help you than tagging this issue with [help wanted] and patiently wait for some other generous peep to help you.

dllud commented 4 years ago

@oscaropenness Does your device use an A/B system-as-root partition style? If so #14 should fix this for you, perhaps in conjugation with #13.

Roboe commented 4 years ago

I've prepared a pre-release with @dllud contributions. Could someone test them and report results, please? :pray:

https://github.com/WeAreFairphone/flashable-zip_microG/tree/2019-12-23

Thanks everyone!

snm247 commented 4 years ago

This doesn't work for LineageOS 17. /system is used instead of /system/system.

The reason seems to be that BOARD_BUILD_SYSTEM_ROOT_IMAGE isn't set to true for Android 10 (see here), so the following code in update_binary doesn't work as expected:

SYSTEM_AS_ROOT="$(getprop ro.build.system_root_image)"

The result of getprop ro.build.system_root_image is empty (using lineage_FP2-UNOFFICIAL-17.0-BETA0.zip):

(As a side note: The installation of the F-Droid Privileged Extension fails the same way.)

dllud commented 4 years ago

Thanks for the feedback @snm247 According to the Android documentation you linked, it should be safe to use /system/system for Android 10 and later, and bypass the ro.build.system_root_image check. @Roboe can you add that?

oscaropenness commented 4 years ago

As already mentioned the by @snm247, the unifiednlp_2019-12-23.test.zip-build does NOT work. However, the recommendation by @dllud to bypass the test (in my case by commenting it out, and setting SYSTEM_ROOT to /system/system) seemed to work. After installing my hacked unifiednlp_2020-01-03.zip via TWRP, I can now see the UnifiedNlp Settings under Location. However, this hack might only work for LineageOS 17.0 and is probably not a general solution.

But I want to thank you all very much already for your help and the quick response.

@Roboe Should I keep this open until there is a general fix?

snm247 commented 4 years ago

I can confirm that unifiednlp works when SYSTEM_ROOT is set to /system/system.

In case you want to use BUILD_VERSION_SDK to get the LineageOS version (as it is already used for older versions): The beta version of LineageOS 17 uses an outdated value here:

~ # getprop ro.build.version.sdk
23

So it may be best to wait until LineageOS 17 is out of beta.

Roboe commented 4 years ago

@dllud Ok, so all Android 10 devices don't set ro.build.system_root_image but behave like so. Ok, I'll rewrite the condition (read below).

@oscaropenness Yes, let's keep this open until we manage to get a working release.

@snm247 Hmm, it shouldn't output 23 on a live system, that's Android 6 (!). At least, it should spit 28 (Android 9 Pie). From a live system with Termux, my Oreo device outputs 27 and my Nougat device outputs 25. I guess you are checking from TWRP. However, the check in this installer is done by manually reading $SYSTEM_ROOT/build.prop to avoid ambiguity.

There's an issue. I can't properly read the build.prop to know the Android SDK version until I know where to find the system folder... which was the reason I wanted to read the build.prop in the first place, :sweat_smile:. I don't know right now if we could safely check for the build.prop in /system and /system/system and discard the failed one. We will need to test that or find another way to check the Android version or system root.

snm247 commented 4 years ago

I guess you are checking from TWRP.

You are right. Sorry for the confusion ...

After booting into LineageOS 17.0 Beta the result is:

getprop ro.build.version.sdk
29

And the result of getprop ro.build.system_root_image is still empty.

Just an idea: since the following line of code seems to work correctly in LineageOS 16, maybe the flashable zip gets the correct values when using getprop?:

SYSTEM_AS_ROOT="$(getprop ro.build.system_root_image)"

If so, you could still use getprop ro.build.version.sdk in a flashable zip.

Roboe commented 4 years ago

Hmmm, you're right, it worth checking with a little script

ghost commented 4 years ago

UnifiedNLP won't work on Android 10 until these PRs are merged:

https://github.com/microg/android_packages_apps_UnifiedNlp/pull/183 https://github.com/microg/IchnaeaNlpBackend/pull/53 https://github.com/microg/android_packages_apps_GmsCore/pull/1004

True for every installer. You can see if this is the issue or not by enabling and disabling a backend and then checking satsat (if this is the issue you should temporarily see a network location).

Diapolo commented 4 years ago

As we now have a working LOS 17.1 for our Fairphone 2, what are the next steps here :)?

@p4t44 Could this repo fork and implement the mentioned changes, as long as they are not merged?

pbhgl commented 4 years ago

I was able to reproduce the problem described by @p4t44 on the second preview version of LineageOS 17.1.

But with Lineage 17.1 nightly UnifiedNlp is working well on my device (with SYSTEM_ROOT set to /system/system).

Can others confirm this? If so, we will need to find a way to check if SYSTEM_ROOT is /system or /system/system.

Edit: I used "Local GSM Location" (Updated 1 year ago) from F-Droid for testing.

Roboe commented 4 years ago

@p4t44 Interesting info, thanks you for sharing it. As far as this installer concerns, we only need to get it installing right first. Once the MicroG apps update, we can roll a new release and that's it.

I got my hands on a phone supporting LOS17.1 and I'm testing a solution. I got it working with backwards compatibility with a non-elegant, but pretty simple check: [ -d "/system/system" ]. If the folder /system/system exists... well, the user screwed so bad their system or it should be an Android 10 phone! Better checking for /system/system/build.prop, just in case...

I'll roll a test ZIP in a minute!

Roboe commented 4 years ago

PR pushed and and pre-releases uploaded. Please, check them!

ghost commented 4 years ago

There's a fork of microG here with UnifiedNLP fixed - https://github.com/NoGooLag/android_packages_apps_GmsCore

Unfortunately the main microG project seems to have not been active at all since lastv year so I wouldn't expect it to be fixed any time soon.

Diapolo commented 4 years ago

The pre-release is working here. Systemless LOS17.1 on a FP2.

Thank you!

snm247 commented 4 years ago

Thank you for the fix!

The pre-release works with unifiednlp-minimal_2020-04-07.zip and "Local GSM Location" and "NominatimNlpBackend" from F-Droid.

I am not able to reproduce this problem, everything works as expected, including getting the location in background.

Edit: It seems I misunderstood what running in background means. The apps I tested seem to run as foreground service (they have a notification in the status bar when they are in the background).

Edit2: I installed UnifiedNlp with TWRP 3.2.3., but didn't test it with the new lineage recovery.

eplinux commented 4 years ago

Hey, thank you for your work! I'm using CrDroid 6.4 (Android 10) on Lavender and I get Error 1 when trying to install your zip (see the log below)

Installing ZIP file '/sdcard/microg_2020-04-07.zip'
Checking for Digest file...
Skipping Digest check: no Digest file found
I:Update binary zip
Bypassing Treble compatibility check ...
Detecting Current Package
I:Zip does not contain SELinux file_contexts file in its root.
I:Legacy property environment not used in updater.
Getting ready...Archive:  /sdcard/microg_2020-04-07.zip
  inflating: 70-microg.sh
  inflating: build-zip.sh
  inflating: LICENSE
   creating: META-INF/
   creating: META-INF/com/
   creating: META-INF/com/google/
   creating: META-INF/com/google/android/
  inflating: META-INF/com/google/android/update-binary
  inflating: META-INF/com/google/android/updater-script
  inflating: privapp-permissions-microg.xml
  inflating: README.md
   creating: system/
   creating: system/app/
   creating: system/app/FakeStore/
  inflating: system/app/FakeStore/FakeStore.apk
   creating: system/app/DroidGuardHelper/
  inflating: system/app/DroidGuardHelper/DroidGuardHelper.apk
   creating: system/app/MozillaNlpBackend/
  inflating: system/app/MozillaNlpBackend/MozillaNlpBackend.apk
   creating: system/app/NominatimNlpBackend/
  inflating: system/app/NominatimNlpBackend/NominatimNlpBackend.apk
   creating: system/priv-app/
   creating: system/priv-app/GmsFrameworkProxy/
  inflating: system/priv-app/GmsFrameworkProxy/GmsFrameworkProxy.apk
   creating: system/priv-app/GmsCore/
  inflating: system/priv-app/GmsCore/GmsCore.apk
mount: can't find /system in /etc/fstab
Installing apps...grep: /system/system/build.prop: No such file or directory
/tmp/updater: line 54: [: : integer expression expected
/tmp/updater: line 58: [: : integer expression expected
find: system/app/DroidGuardHelper: No such file or directory
find: system/app/FakeStore: No such file or directory
find: system/app/MozillaNlpBackend: No such file or directory
find: system/app/NominatimNlpBackend: No such file or directory
find: system/priv-app/GmsCore: No such file or directory
find: system/priv-app/GmsFrameworkProxy: No such file or directory
cp: can't create directory '/system/system/app': No such file or directory
cp: can't create directory '/system/system/priv-app': No such file or directory
chmod: /system/app/FakeStore.apk: No such file or directory
chmod: /system/app/DroidGuardHelper.apk: No such file or directory
chmod: /system/app/MozillaNlpBackend.apk: No such file or directory
chmod: /system/app/NominatimNlpBackend.apk: No such file or directory
chmod: /system/app/GmsFrameworkProxy.apk: No such file or directory
chmod: /system/app/GmsCore.apk: No such file or directory
BusyBox v1.22.1  (2020-03-14 17:39 +0000) multi-call binary.

Usage: chmod [-R] MODE[,MODE]... FILE...

Each MODE is one or more of the letters ugoa, one of the
symbols +-= and one or more of the letters rwxst

    -R  Recurse

Installing OTA survival script...cp: can't create '/system/system/addon.d/': No such file or directory
/tmp/updater: line 92: [: : integer expression expected
done
umount: can't umount /system: No such file or directory
Updater process ended with ERROR: 1
I:OrangeFox: installed standard zip: /sdcard/microg_2020-04-07.zip
I:flash_zip: installer code = 0
Error installing ZIP file '/sdcard/microg_2020-04-07.zip'
Roboe commented 4 years ago

@p4t44 Thanks for your inputs. Changing upstreams is a whole re-evaluation of trust chains. Such change would trigger a certificate change for our users, too, which is a non-trivial effort. We're not as rolling release or active to need more than a little patience.

@Diapolo @snm247 Thanks for your tests!

@eplinux Which recovery are you using?

eplinux commented 4 years ago

I'm using OrangeFox-R10.1_02-Stable-lavender and I even tried to mount system manually.

Roboe commented 4 years ago

Seems like that's a totally different issue. I didn't know about OrangeFox Recovery, so it's unsupported. From the log above, it seems like it's struggling with the mount /system command.

I don't have an OFR-compatible device, so we'd need someone how does to look at it. Please, open a new issue for OFR compatibility if you rely on it.

cherryband commented 4 years ago

I tried installing microg minimal zip on my Zenfone 6 with LOS 17.1. Successfully flashed it in TWRP but resulted in bootloop.

Edit: unifiednlp zip worked. could be a fluke because i flashed microg while rebooting after system upgrade

anonimno1 commented 4 years ago

I have just installed the unifiednlp_minimal on LOS17.1 Oneplus 3t. In self check all the tests are passed, but I am not getting a fix. Tried Mozilla, Radiocells and have Dejavu backend installed now. How can I debug, why the fix is not found. By the way I noticed that in Android 10 you can only turn on/off the location services. There is no battery saving aka only network based location available anymore?

Roboe commented 4 years ago

@anonimno1 microG is still having trouble with Android 10 (i.e. LOS 17). We should wait until a fix lands upstream.

@qtwyeuritoiy I'm sorry. Seems fine installing on other devices. Can you reproduce the error on your Zenphone 6 or give some more info? (A/B device, system-as-root system installation)

Thanks for your reports!

CameronNemo commented 3 years ago

Wanted to backlink a couple similar issues:

Roboe commented 3 years ago

Thank you, @CameronNemo, it'll be great to follow what other bigger projects solve the same issue. As far as it goes, it seems like installing issues on Android 10 were properly addressed already in #15

Nonetheless, testing the pre-release is still desired to be completely sure that no single device has installation issues.

To finally close this issue we need a microG/UnifiedNlp update supporting Android 10.

CameronNemo commented 3 years ago

FWIW I had to use /system_root/system with TWRP 3.4 as recovery, not /system/system.

Roboe commented 3 years ago

There's a new microG release today solving some Android 10 compatibility issues: https://github.com/microg/android_packages_apps_GmsCore/releases/tag/v0.2.11.202414

@CameronNemo Thank you very much, I don't think we were aware of that possiblity. That should improve #15. Does your device run Android 10?

CameronNemo commented 3 years ago

yes it does. LOS 17.1.

tillschaefer commented 3 years ago

the flashable zips of unifiednlp (minimal and normal) provided here https://github.com/WeAreFairphone/flashable-zip_microG/releases/tag/2020-04-07 fail with twrp 3.4.0-0 recovery. Error meesage is updater process ended with error: 1. downgrading twrp to 3.3.1-1 fixed the issue for me.

oscaropenness commented 3 years ago

the flashable zips of unifiednlp (minimal and normal) provided here https://github.com/WeAreFairphone/flashable-zip_microG/releases/tag/2020-04-07 fail with twrp 3.4.0-0 recovery. Error meesage is updater process ended with error: 1. downgrading twrp to 3.3.1-1 fixed the issue for me.

I get the same issue trying to install the flashable .zip under TWRP 3.5.0_9-0. Any ideas what the issue might be?

Saldef commented 2 years ago

the flashable zips of unifiednlp (minimal and normal) provided here https://github.com/WeAreFairphone/flashable-zip_microG/releases/tag/2020-04-07 fail with twrp 3.4.0-0 recovery. Error meesage is updater process ended with error: 1. downgrading twrp to 3.3.1-1 fixed the issue for me.

Having the same issue here as well, neither @oscaropenness' zip worked nor @tillschaefer's (unifiednlp_2020-04-07.zip and unifiednlp_2020-01-03.zip), they both yield updater process ended with error: 1. downgrading TWRP to 3.3.1-1 didn't work either,

any ideas so far?