casualsnek / waydroid_script

Python Script to add OpenGapps, Magisk, libhoudini translation library and libndk translation library to waydroid !
GNU General Public License v3.0
1.52k stars 147 forks source link

Installing Magisk v23.0 and Loading Magisk Modules #24

Open Joecowboy opened 2 years ago

Joecowboy commented 2 years ago

I have been testing this on Ubuntu Touch (Ubports) and Droidiain with Waydroid. It will now load the modules but still have issues with it locking up Magsik Manager on some. Example Riru-Core and if this happens you will need to go into the /userdata/user-data/phablet/.local/share/waydroid/data/adb/modules directory and delete the module (this directory path is for UBports). It will install Props Module but in system/xbin/gunzip, gzip and zcat apps missing from their folders and so you need to install the Magisk Module for Busybox. If you install Microg module it will cause Waydroid to say rebooting phone. Magisk will install modules and load them "all" on Waydroid boot. So still some issues to work through.

The hardware that I have been testing on is a Sprint Oneplus 7 Pro 5G. I have installed first on slot_B Ubports and then installed Droidian on slot_A so the user data would not be wiped. So I switch between slots to test. The link to the Discord Cannel.

First install the waydroid_script:

To unmount waydroid system.img: waydroid session stop sudo waydroid container stop

sudo apt install python-pip -y sudo apt install python3-pip -y sudo apt install git -y

git clone https://github.com/casualsnek/waydroid_script cd waydroid_script sudo python3 -m pip install -r requirements.txt

sudo python3 waydroid_extras.py -m

Reboot phone and then launch waydroid, download and install Magisk Manager v23.0 next. Then kill Waydroid again:

To unmount waydroid system.img: waydroid session stop sudo waydroid container stop

Extract the attached Magisk_23.zip file to your downloads directory. This is all assuming you are using Ubports or Droidian. Should work on other OS that support Waydroid... Just mod the following lines if using a different OS with Waydroid.

sudo mkdir /tmp/waydroidimage

This section is for copying the extracted files in UBports:

sudo mount -o rw /userdata/system-data/var/lib/waydroid/images/system.img /tmp/waydroidimage sudo cp -R /home/phablet/Downloads/Magisk-system/. /tmp/waydroidimage sudo rm -r /userdata/user-data/phablet/.local/share/waydroid/data/adb/magisk sudo cp -R /home/phablet/Downloads/magisk /userdata/user-data/phablet/.local/share/waydroid/data/adb/magisk sudo cp /home/phablet/Downloads/init-magisk.sh /tmp/waydroidimage/system/bin/

This section is for copying the extracted files in Droidian:

sudo mount -o rw /var/lib/waydroid/images/system.img /tmp/waydroidimage sudo cp -R /home/droidian/Downloads/Magisk-system/. /tmp/waydroidimage sudo rm -r /home/droidian/.local/share/waydroid/data/adb/magisk sudo cp -R /home/droidian/Downloads/magisk /home/droidian/.local/share/waydroid/data/adb/magisk sudo cp /home/droidian/Downloads/init-magisk.sh /tmp/waydroidimage/system/bin/

sudo umount /tmp/waydroidimage

Now launch Waydroid, then kill it and load it again so Magisk v23.0 init sets everything up properly and profit.... I hope ;)

Download: Magisk_23.zip

Joecowboy commented 2 years ago

did the same, magisk manager shows magisk is not installed, maybe issue with android 11 image i will try doing that on a10 image and report back. Also can you create a issue for discussing magisk, this one seems to be for MicroG support and current discussion seems out of place ! 🤔

In the init-magisk.sh script you might might try and comment out and uncomment the following lines: (I had to keep your original line of code because I couldn't get the other way to work. And the other way is from a device running Android 11)

The way it's in the script now: ln -s /sbin/magiskinit /sbin/magisk

ln -s /sbin/magisk64 /sbin/magisk

And try this to see if it works:

ln -s /sbin/magiskinit /sbin/magisk

ln -s /sbin/magisk64 /sbin/magisk

casualsnek commented 2 years ago

Hello there, can you mention from which build did you get the files in your Magisk_23.zip ? Since the files in your archive are arm binaries i cant directly test them !

I have tried 23-stable and canary build but nothing seems to work !

Joecowboy commented 2 years ago

I apologize for not getting back with you sooner because I have been out of pocket working on another project for work.

I just downloaded the apk from here: https://github.com/topjohnwu/Magisk/releases/tag/v23.0

And extracted the files from the apk. To see how it all worked I installed it on a phone that was running android 11 and built the script from there to make it work with your script and ideas.

I just noticed v24.1 is out... I might see what I can do with it. (But probably wait and help you with this version looks like too many issues with v24.1 at the moment)

Joecowboy commented 2 years ago

When I said I installed it on the phone. I forgot to tell you I dumped the boot.img to see how Magisk v23.0 was setup in ramdisk. Also, Android 11 may not have a sbin and Magisk generates a random folder name in /dev to install into. You might look in this folder to see what binaries you need to use instead of the files I included for your device.

BlurryFlurry commented 1 year ago

magisk manager stopped detecting magisk after following those steps, any clue? magisk

Joecowboy commented 1 year ago

I apologize again for not getting back with you sooner. I haven't worked on this idea in a while. I am not running Ubuntu Touch (Ubports) and Droidiain with Waydroid on my Oneplus 7 Pro at the moment until they get the VoLTE fixed because of AT&T forcing it. Right now Running YAAP 12 Vanilla that's as close to a deGoogled phone I can get to on this phone at the moment.