Skip to content

pagkly/MagiskOnWaydroid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gapps + Magisk on Waydroid 11

Screenshot from 2022-05-31 21-33-25 image

Follow installation to init modified images.

Unable to test latest build in Arch due to recent waydroid update showing this issue, hoping somebody can provide feedback if 25.2 is working in Ubuntu or Arch.

Forked MagiskOnWSA and modified to install Magisk and OpenGapps (pico) replacing FOSS apps in BlissOS/LineageOS 18.1 dev image (Android 11)

Most OpenGApps variants works except for aroma (aroma does not support x86_64, please use super instead)

Tested in ArchLinux, Fedora.

More in Waydroid Telegram

Bugs

  1. Zygisk not yet working (No ETA).

    Currently, this script is using MagiskonWSA method in patching initrc so that it would load magisk su binaries close to the end of initrc, before ui started. However zygote is usually loaded at the start of initrc, meaning it would be too late to replace zygote with zygisk zygote by the time su from magisk is loaded.

    In LSPosed's MagiskonWSA implementation, there is a patched WSA kernel with su binaries just like in Android devices where Magisk patch recovery/boot image to have su binaries. Waydroid, on the other hand, uses lxc containers utilizing linux host kernel without su binaries needed to patch zygote.

    There might be a way to load su binaries as kernel module when lxc session is starting with one caveat that this solution might introduce security issues to linux host. Anybody who is well-versed in lxc can contact me/create issue to explain to me how to make it work.

    Thus, modules requiring zygote/zygisk like Riru, LSPosed (pre-zygisk) or Shamiko (module to hide magisk root utilizing zygisk) unfortunately wont work for now unless someone figures out a workaround.

    In the meantime, here is some examples of modules that work:

    Also, not all Magisk version guaranteed to work.

    Versions that work are build 24001 < x < 24102 and 24301. This is due to a change in how Magisk load the binaries during booting somewhere in commit between build v24102 to v24103 and present in v24.2, 2420x builds; and a change in magiskpolicy applet in 24301. I added stable magisk versions to choose from in workflow so that they can be tested. If you run the workflow and install the img properly and magisk icon not shown when booting the first time, that means Magisk is not setup properly.

    For now, latest working is 24.1 and 24.3 and thus, do not update magisk apk.

  2. Restart waydroid container twice after additional setup in Magisk.

    First restart usually have a bug where the ethernet connection would fail to connect to the internet. Second restart should fix them.

    See Installation Guide

Cleaning Previous Image

Run this command below to clean previous image such as Waydroid 10 or before installing new Waydroid 11 image or when updating to new Magisk.

Warning: You will lose all your data, apps, settings of previous Android installation.

Kindly backup everything in your Android before you proceed

waydroid session stop
sudo waydroid container stop
sudo systemctl stop waydroid-container.service
sudo umount -l /var/lib/waydroid/{data,rootfs}
sudo umount /usr/share/waydroid-extra/images/{system,vendor}.img
sudo rm -rf /var/lib/waydroid /home/.waydroid ~/waydroid ~/.share/waydroid ~/.local/share/applications/*aydroid* ~/.local/share/waydroid
sudo rm -rf /usr/share/waydroid-extra/images/*

Installation Guide

  1. Install waydroid dev image on your Linux Distro.

    • e.g. In Arch Linux with AUR + yay

      # install one of the kernel that supports ashmem,binder
      # sudo pacman -S linux-mainline-anbox #(5.17-rc)
      # sudo pacman -S linux-zen #(tested on 5.16 - 5.17rc; 5.17.1 not working)
      # sudo pacman -S linux-xanmod-anbox #(5.17.12>; the one Im using right now)
      sudo pacman -Syuu
      yay -S waydroid-image-dev
  2. Go to the Action tab in your forked repo Action Tab

  3. In the left sidebar, click the Build WSA workflow. Workflow

  4. Above the list of workflow runs, select Run workflow Run Workflow

  5. Input the download link of Magisk and select the OpenGApps variant (none is no OpenGApps) you like, select the root solution (none means no root) and click Run workflow Run Workflow

  6. Wait for the action to complete and download the artifact Download

  7. Unzip the artifact

    • The size shown in the webpage is uncompressed size and the zip you download will be compressed. So the size of the zip will be much less than the size shown in the webpage.
  8. Copy system.img and vendor.img to /usr/share/waydroid-extras/images /var/lib/waydroid/images and init the new img.

    # Remove original img and copy magisk img
    sudo rm -rf /var/lib/waydroid/images/system.img
    sudo rm -rf /var/lib/waydroid/images/vendor.img
    sudo cp system.img /var/lib/waydroid/images/system.img
    sudo cp vendor.img /var/lib/waydroid/images/vendor.img
    
    # Initialize new images
    sudo waydroid init
    # Restart waydroid lxc container
    sudo systemctl restart waydroid-container.service
    waydroid session start &
    # Start Waydroid UI
    waydroid show-full-ui
  9. After additional setup in magisk, reboot and restart container twice (refer to Bugs as to why)

    waydroid stop session
    
    # First container restart
    sudo systemctl restart waydroid-container.service
    waydroid session start #(wait until successfully booted)
    waydroid session stop
    
    # Second container restart
    sudo systemctl restart waydroid-container.service
    waydroid session start #(wait until successfully booted)
    waydroid show-full-ui

Additional FAQ

  • Why the size of the zip does not match the one shown?

    The zip you downloaded is compressed and Github is showing the uncompressed size.

  • How can I update System.img to new version?

    Rerun the Github action, download the new artifact, replace the content of your previous installation.

  • How can I update Magisk to new version?

    Do the same as updating System.img

  • How to pass safetynet?

    Like all the other emulators, no way.

  • Magisk online module list is empty?

    Install manually by

    adb push module.zip /data/local/tmp
    adb shell su -c magisk --install-module /data/local/tmp/module.zip
  • Can I use Magisk 23.0 stable or lower version?

    No. Magisk has bugs preventing itself running on WSA. Magisk 24+ has fixed them. So you must use Magisk 24 or higher version.

  • Github Action script is updated, how can I synchronize it?

    1. In your fork repository, click fetch upstream fetch
    2. Then and click fetch and merge merge

Credits

Notes

About

Waydroid 11 with Magisk v26.1

Resources

License

Stars

Watchers

Forks