sfX-android / android_vendor_extendrom

modifying / extending the Android build process
Apache License 2.0
18 stars 8 forks source link

Magisk not installing correctly - Unable to fully deploy modules (Requires Additional Setup) #46

Open Whiskerc opened 6 days ago

Whiskerc commented 6 days ago

Description

I have a aosp build which I want to use magisk to install gapps (Using https://github.com/chickendrop89/systemless-gapps to build the app package)

On my base build without extendrom, I am able to install magisk, modify the boot.img and install my module fully. - apps & google play are installed.

I have added extendrom to my tree and build a new image, as far as I can see everything is built successfully, and after rebooting I see magisk.

However, every time I launch the app I see the 'Requires Additional Setup' message (I have seen the wiki that states that is normal once or twice, but for me it is every time the app launches. - even after additional reboots. I have tried updating with the direct install command, but get the Unsupported/Unkown image format message.

When I try to install my module, magisk performs the install, however after rebooting only some of the apps and services are there (google play store and apps dependent on it are missing)

...

Required(!) information

Here is also the output from patch.sh when it patches the boot img: patch.sh output

steadfasterX commented 6 days ago

thx for the logs, especially the path.sh one. while this is not the solution for your problem (at least afair) please install dos2unix in your OS.

for the rest well yea I havent found a quick solution for the "Requires additional setup" yet (last time I looked into it is a while ago already) and yes I get that for some devices EVERY time when starting magisk. while on others it appears once and when letting it boot it went away. also never looked into it as it had no impact on the rooting part.

the modules might be affected by that issue though - so I guess I need to solve that and when that msg is fixed your module problems should be fixed as well. do you have any logs from Magisk itself (Logs -> disk icon -> get them)?

also if you can: pls build with the debug variant instead: replace Magisk with Magisk_DEBUG (ensure you sync extendrom before) unfortunately they remove older debug builds so we have to use the current "next" one for testing which might work different/better/worse than the current stable one. but at least it should get way more log output

Whiskerc commented 6 days ago

Thanks for the quick reply!

In terms of Magisk Logs there are no errors that jump out at me. Here is a gist with the module working Working Magisk and with Magisk built into the Rom Not Working Magisk. The only difference is that thr service.d line is missing for the gapps uninstall.

I made a start at deploying the Magisk_DEBUG build:

  1. I had to update line 175 in er.sh to include the Magisk_DEBUG in the regex or it wouldn't find the apk
  2. In the debug build there is now only libmagisk and not libmagisk32 or libmagisk64? - This fails the builds

I've tried a couple of changes with libmagisk but keep on getting open magisk failed with 2: No such file or directory messages when I get to the boot.img patching stage. Example logs

I'll keep reading through the code to try and work out what changes need integrating for the debug build to work

steadfasterX commented 6 days ago

ah well ok ,sorry I haven't thought it through. will look into this as I just added the debug one and not trying to build it yet (as I thought it would just work). will let u know when its ready

Whiskerc commented 3 days ago

I managed to get the debug version installed - I updated er.sh to copy libmagisk.so correctly, and also included a new file lininit-ld.so:

 echo "[MAGISK] ... MAGISK_TARGET_ARCH specified as $MAGISK_TARGET_ARCH"

    if [ $MAGISK_TARGET_ARCH == "arm64" ];then
    cp $MAGISKOUT/src/lib/arm64-v8a/libmagisk.so $MAGISKOUT/magisk
    cp $MAGISKOUT/src/lib/arm64-v8a/libmagiskinit.so $MAGISKOUT/magiskinit
    cp $MAGISKOUT/src/lib/arm64-v8a/libinit-ld.so $MAGISKOUT/init-ld

The debug logs from Magisk are here: Logs

Interestingly, with the debug app, I am able to do the boot update now when Magisk asks, but as expected, this causes the phone no longer boot as it the boot image signatures have changed.

steadfasterX commented 2 days ago

hm

dlopen failed: library "libmagtsync.so" not found

is that something else we need to add for the debug build?

Whiskerc commented 2 days ago

When I looked into the library it seems to commonly used for reporting GPS positions,

I have managed to cobble together a build that works for installing my modules... After building with extendrom, I then allowed magisk to modify the boot.img - then I resigned all the images and flashed the device. - It is a bad work around, but allowed me to do some debugging.

When it is all installed and working the logs from magisk look like this: Logs

As you can see "libmagtsync.so" is still not present

steadfasterX commented 2 days ago

oh nice.. but hm. for the second log I assume you have hidden magisk right (that would explain the diff pkg name)?

I cant see anything obvious reason, the log is not very useful (for me): https://www.diffchecker.com/gkq2Q2GM/

maybe topjohnwu can help you in that regard when sharing these logs?!