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.65k stars 157 forks source link

MicroG support (as an alternative to GAPPS) #18

Open osering opened 2 years ago

osering commented 2 years ago

Great fundamental additions for Waydroid. Nevertheless MicroG as alternative to GAPPS would make this project more complete and fit for wider range of users!

casualsnek commented 2 years ago

I will add it as soon as i get some free time ! Thanks for feedback :)

Joecowboy commented 2 years ago

Hello casualsnek,

I am running waydroid on UBports. I have been working with your script. I have managed to get Magisk V23.0 installed. I had to update your init-magisk.sh script. If you download the the update of Magisk it's an apk so you have to open it as a zip file to extract the files you need (as you probably already know). Anyway, the comment I have is how can we get Magisk Modules to load on boot so we can install MicroG module (as per this threads request), or others, I have gotten them to show up as installed but now they don't for some reason might be how magiskinit "aka libmagiskinit.so renamed" handles modules now? For example, you want to install Ruri-Core module, and EdXposed or LSposed modules. Except their managers do not see the modules once loaded. Still some work to get Magisk v23.0 to fully work like it's suppose to.

Not sure if the magisk32.xz and magisk64.xz compressed files are required but they are in the boot.img when Magisk v23.0 is installed on a device. So I included them too.

Just the tweaks from init-magisk.sh script so far:

!/system/bin/sh

mount -o remount,rw / rm /sbin/magisk /sbin/magiskpolicy /sbin/magiskinit /sbin/magisk32.xz /sbin/magisk64.xz /sbin/magisk32 /sbin/magisk64

rm -r /sbin/.magisk/

cp /magiskinit /sbin/magiskinit ln -s /sbin/magiskinit /sbin/magisk ln -s /sbin/magiskinit /sbin/magiskpolicy cp /magisk32.xz /sbin/magisk32.xz cp /magisk64.xz /sbin/magisk64.xz cp /magisk32 /sbin/magisk32 cp /magisk64 /sbin/magisk64 rest of script not shown....

Also a list of the files in the magisk directory for Magisk v23.0: root@ubuntu-phablet:/tmp/waydroidimage# ls -lisa /userdata/user-data/phablet/.local/share/waydroid/data/adb/magisk total 2288 7349261 4 drwxr-xr-x 3 root root 4096 Dec 3 21:45 . 7292332 4 drwx------ 8 root root 4096 Dec 7 13:00 .. 7349509 4 -rw-r--r-- 1 root root 3530 Dec 10 02:20 addon.d.sh 7349567 8 -rw-r--r-- 1 root root 5429 Dec 10 02:20 boot_patch.sh 7349628 1392 -rw-r--r-- 1 root root 1419112 Dec 10 02:20 busybox 7349632 4 drwxr-xr-x 2 root root 4096 Dec 3 21:45 chromeos 7349766 104 -rw-r--r-- 1 root root 104204 Dec 3 21:45 magisk32 7349767 168 -rw-r--r-- 1 root root 170176 Dec 3 21:45 magisk64 7349768 272 -rw-r--r-- 1 root root 278512 Dec 3 21:45 magiskboot 7349769 304 -rw-r--r-- 1 root root 308916 Dec 3 21:45 magiskinit 7349770 24 -rw-r--r-- 1 root root 22289 Dec 10 02:20 util_functions.sh

Here is an example to where waydroid installed the Magisk Manager apk v23.0 to and you might need to copy the following files too into the arm directory if you are doing all this manually, not real sure but I did anyway for testing:

ls -lisa /userdata/user-data/phablet/.local/share/waydroid/data/app/com.topjohnwu.magisk-7iYZfpLicNd10XHPIcxYHg==/lib/arm/ total 2248 7350235 4 drwxr-xr-x 2 system system 4096 Dec 3 23:05 . 7350234 4 drwxr-xr-x 4 system system 4096 Dec 3 23:05 .. 7350236 1392 -rwxr-xr-x 1 system system 1419112 Dec 10 12:56 libbusybox.so 7350239 104 -rwxr-xr-x 1 system system 104204 Dec 10 12:56 libmagisk32.so 7350240 168 -rwxr-xr-x 1 system system 170176 Dec 10 12:56 libmagisk64.so 7350238 272 -rwxr-xr-x 1 system system 278512 Dec 10 12:56 libmagiskboot.so 7350237 304 -rwxr-xr-x 1 system system 308916 Dec 10 12:56 libmagiskinit.so

casualsnek commented 2 years ago

Hello casualsnek,

I am running waydroid on UBports. I have been working with your script. I have managed to get Magisk V23.0 installed. I had to update your init-magisk.sh script. If you download the the update of Magisk it's an apk so you have to open it as a zip file to extract the files you need (as you probably already know). Anyway, the comment I have is how can we get Magisk Modules to load on boot so we can install MicroG module (as per this threads request), or others, I have gotten them to show up as installed but now they don't for some reason might be how magiskinit "aka libmagiskinit.so renamed" handles modules now? For example, you want to install Ruri-Core module, and EdXposed or LSposed modules. Except their managers do not see the modules once loaded. Still some work to get Magisk v23.0 to fully work like it's suppose to.

Not sure if the magisk32.xz and magisk64.xz compressed files are required but they are in the boot.img when Magisk v23.0 is installed on a device. So I included them too.

Just the tweaks from init-magisk.sh script so far: #!/system/bin/sh mount -o remount,rw / rm /sbin/magisk /sbin/magiskpolicy /sbin/magiskinit /sbin/magisk32.xz /sbin/magisk64.xz /sbin/magisk32 /sbin/magisk64 #rm -r /sbin/.magisk/ cp /magiskinit /sbin/magiskinit ln -s /sbin/magiskinit /sbin/magisk ln -s /sbin/magiskinit /sbin/magiskpolicy cp /magisk32.xz /sbin/magisk32.xz cp /magisk64.xz /sbin/magisk64.xz cp /magisk32 /sbin/magisk32 cp /magisk64 /sbin/magisk64 rest of script not shown....

Also a list of the files in the magisk directory for Magisk v23.0: root@ubuntu-phablet:/tmp/waydroidimage# ls -lisa /userdata/user-data/phablet/.local/share/waydroid/data/adb/magisk total 2288 7349261 4 drwxr-xr-x 3 root root 4096 Dec 3 21:45 . 7292332 4 drwx------ 8 root root 4096 Dec 7 13:00 .. 7349509 4 -rw-r--r-- 1 root root 3530 Dec 10 02:20 addon.d.sh 7349567 8 -rw-r--r-- 1 root root 5429 Dec 10 02:20 boot_patch.sh 7349628 1392 -rw-r--r-- 1 root root 1419112 Dec 10 02:20 busybox 7349632 4 drwxr-xr-x 2 root root 4096 Dec 3 21:45 chromeos 7349766 104 -rw-r--r-- 1 root root 104204 Dec 3 21:45 magisk32 7349767 168 -rw-r--r-- 1 root root 170176 Dec 3 21:45 magisk64 7349768 272 -rw-r--r-- 1 root root 278512 Dec 3 21:45 magiskboot 7349769 304 -rw-r--r-- 1 root root 308916 Dec 3 21:45 magiskinit 7349770 24 -rw-r--r-- 1 root root 22289 Dec 10 02:20 util_functions.sh

Here is an example to where waydroid installed the Magisk Manager apk v23.0 to and you might need to copy the following files too into the arm directory if you are doing all this manually, not real sure but I did anyway for testing:

ls -lisa /userdata/user-data/phablet/.local/share/waydroid/data/app/com.topjohnwu.magisk-7iYZfpLicNd10XHPIcxYHg==/lib/arm/ total 2248 7350235 4 drwxr-xr-x 2 system system 4096 Dec 3 23:05 . 7350234 4 drwxr-xr-x 4 system system 4096 Dec 3 23:05 .. 7350236 1392 -rwxr-xr-x 1 system system 1419112 Dec 10 12:56 libbusybox.so 7350239 104 -rwxr-xr-x 1 system system 104204 Dec 10 12:56 libmagisk32.so 7350240 168 -rwxr-xr-x 1 system system 170176 Dec 10 12:56 libmagisk64.so 7350238 272 -rwxr-xr-x 1 system system 278512 Dec 10 12:56 libmagiskboot.so 7350237 304 -rwxr-xr-x 1 system system 308916 Dec 10 12:56 libmagiskinit.so

can you share full init script ?, and what are the other steps you took to get it working ? On my system magisk either does not gets started properly ( improper symlinks or file locations maybe ) or waydroid ends up in bootloop !

Joecowboy commented 2 years ago

Magisk_23.zip

I have been testing this on Ubuntu Touch (Ubports) 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. Not sure if Waydroid issue or Props issue. If you install Microg module it will cause Waydroid to say rebooting pone. It will install modules and load them "all" on Waydroid boot. So still some issues to work through.

First install your your 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. Should work on Droidian, ect... Just mod the following lines if using a different OS with Waydroid.

sudo mkdir /tmp/waydroidimage

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/

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 ;)

casualsnek commented 2 years ago

Magisk_23.zip

I have been testing this on Ubuntu Touch (Ubports) 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. Not sure if Waydroid issue or Props issue. If you install Microg module it will cause Waydroid to say rebooting pone. It will install modules and load them "all" on Waydroid boot. So still some issues to work through.

First install your your 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. Should work on Droidian, ect... Just mod the following lines if using a different OS with Waydroid.

sudo mkdir /tmp/waydroidimage

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/

sudo umount /tmp/waydroidimage

Now launch Waydroid and profit.... I hope ;)

Thanks ! But still did not work for me, what android version did you tried this on ?

Joecowboy commented 2 years ago

I am using the latest build Waydroid and it says Android version 10 under about phone. I am running Waydroid in UBports which is over Android 9. I just reloaded the entire phone, started from scratch last night and it still is loading Magisk v23.0 without any issues. The hardware is a Sprint Oneplus 7 Pro 5G. What are you testing it on?

I will load Droidian with Waydroid on my phone and report back to you. I have UBports on slot_B and load Droidian on slot_A so I can dual boot between them to test. You have to set up UBports first on slot_B and then load Droidian on slot_A.

Here is the Discord channel: https://discord.com/channels/817478014073045022/817478014073045025

Joecowboy commented 2 years ago

Okay, I tested it under droidian and it loads fine. Follow the directions from above. Extract the files from Magisk_23.zip into /home/droidian/Downloads directory:

sudo mkdir /tmp/waydroidimage

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

casualsnek commented 2 years ago

Okay, I tested it under droidian and it loads fine. Follow the directions from above. Extract the files from Magisk_23.zip into /home/droidian/Downloads directory:

sudo mkdir /tmp/waydroidimage

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

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 ! 🤔

darkdragon-001 commented 2 years ago

Would love to see MicroG addition to your awesome scripts! Have used it for years on many different LineageOS phones without problems!

jhay06 commented 1 year ago

Magisk_23.zip

hello can you add the latest version or atleast version 24.2 patch file of magisk ? i need it to run zygisk

ayasa520 commented 1 year ago

https://github.com/ayasa520/waydroid_script I recently added microg to the script, will make a PR when I improve it further

westurner commented 1 year ago

https://github.com/ayasa520/waydroid_script I recently added microg to the script, will make a PR when I improve it further