newbit1 / rootAVD

Script to root AVDs running with QEMU Emulator from Android Studio
GNU General Public License v3.0
1.45k stars 186 forks source link

Ran successfully but no root #47

Closed Oreeeee closed 1 year ago

Oreeeee commented 1 year ago

Hello, I'm trying to root API 29 x86_64 AVD. Magisk app gets installed, but there is no root access. After rebooting the AVD for the first time there was a "Magisk needs to restart your device", but it didn't matter did I click Yes or No, the root disappeared right after.

Log:

$ ./rootAVD.sh ~/Android/Sdk/system-images/android-29/google_apis/x86_64/ramdisk.img
[!] and we are NOT in an emulator shell
[*] Set Directorys
[-] Test if ADB SHELL is working
[-] In any AVD via ADB, you can execute code without root in /data/data/com.android.shell
[*] Cleaning up the ADB working space
[*] Creating the ADB working space
[-] Magisk installer Zip exists already
[*] Push Magisk.zip into /data/data/com.android.shell/Magisk
[-] ./Magisk.zip: 1 file pushed, 0 skipped. 16.1 MB/s (11278270 bytes in 0.668s)
[-] ramdisk.img Backup exists already
[*] Push ramdisk.img into /data/data/com.android.shell/Magisk
[-] /home/krystian/Android/Sdk/system-images/android-29/google_apis/x86_64/ramdisk.img: 1 file pushed, 0 skipped. 209.4 MB/s (1358995 bytes in 0.006s)
[*] Push rootAVD.sh into /data/data/com.android.shell/Magisk
[-] rootAVD.sh: 1 file pushed, 0 skipped. 47.2 MB/s (7855302 bytes in 0.159s)
[-] run the actually Boot/Ramdisk/Kernel Image Patch Script
[*] from Magisk by topjohnwu and modded by NewBit XDA
[!] We are in a ranchu emulator shell
[-] Api Level Arch Detect
[-] Device Platform: x64
[-] ARCH32 x86
[-] Device SDK API: 29
[-] First API Level: 28
[-] The AVD runs on Android 10
[-] Switch to the location of the script file
[*] Extracting busybox and Magisk.zip ...
[-] Checking AVDs Internet connection...
[!] AVD is offline
[*] Re-Run rootAVD in Magisk Busybox STANDALONE (D)ASH
[-] We are now in Magisk Busybox STANDALONE (D)ASH
[*] rootAVD with Magisk '25.2' Installer
[-] Get Flags
[*] System-as-root, keep dm/avb-verity
[-] Encrypted data, keep forceencrypt
[*] RECOVERYMODE=false
[-] KEEPVERITY=true
[*] KEEPFORCEENCRYPT=true
[*] copy x86 files to /data/data/com.android.shell/Magisk/lib/x86_64
[-] copy all x86_64 files from /data/data/com.android.shell/Magisk/lib/x86_64 to /data/data/com.android.shell/Magisk
[*] Detecting ramdisk.img compression
[!] Ramdisk.img uses gzip compression
[-] taken from shakalaca's MagiskOnEmulator/process.sh
[*] executing ramdisk splitting / extraction / repacking
[*] After decompressing ramdisk.img, magiskboot will work
Detected format: [gzip]
[-] Checking ramdisk STATUS=1
[-] Magisk patched boot image detected
[*] repacking back to ramdisk.img format
[!] Rename Magisk.zip to Magisk.apk
[*] Pull ramdiskpatched4AVD.img into ramdisk.img
[-] /data/data/com.android.shell/Magisk/ramdiskpatched4AVD.img: 1 file pulled, 0 skipped. 23.0 MB/s (1358995 bytes in 0.056s)
[*] Pull Magisk.apk into
[-] /data/data/com.android.shell/Magisk/Magisk.apk: 1 file pulled, 0 skipped. 51.4 MB/s (11278270 bytes in 0.209s)
[-] Clean up the ADB working space
[-] Install all APKs placed in the Apps folder
[*] Trying to install Apps/Magisk.apk
[*] Performing Streamed Install
[*] Success
[-] Shut-Down & Reboot (Cold Boot Now) the AVD and see if it worked
[-] Root and Su with Magisk for Android Studio AVDs
[-] Trying to shut down the AVD
[!] If the AVD doesn't shut down, try it manually!
[-] Modded by NewBit XDA - Jan. 2021
[!] Huge Credits and big Thanks to topjohnwu, shakalaca, vvb2060 and HuskyDG

Screenshot_1669234005

Oreeeee commented 1 year ago

I fixed it (for now at least). I forgot to disable mitmproxy and this virtual device lacked the SSL certificates.