Coder Social home page Coder Social logo

ARM64 busybox support about rootavd HOT 16 CLOSED

newbit1 avatar newbit1 commented on September 26, 2024
ARM64 busybox support

from rootavd.

Comments (16)

newbit1 avatar newbit1 commented on September 26, 2024 1

My apologies for this late response. I didn't get any notice of an opened Issue.
Sadly, even with x64 Busybox Version, it is not enough to run the script without an x64 Version of Magisk.
There was an attempt, from shakalaca / MagiskOnEmulator, to build a x64 Version from Magisk, and it kinda worked.
See for your self. Doesn't work for api30 on M1 Mac OSX

Which is also related to scripts/emulator.sh cannot mount overlay on /system/bin

Also, I don't have a M1 Device, which makes it difficult for me test it proper. If you
can provide me one, I am happy to add these Options into the script.

I am sorry for this inconvenience.

from rootavd.

kolbasa avatar kolbasa commented on September 26, 2024 1

Hi. Thank you so much for doing the work. I saw the notification a bit too late.

Here are the AVDs that I have tested. Both were downloaded directly from the Apple Silicon version of Android Studio.

API Level 30 - Revision 11 - Google APIs ARM 64 v8a System Image
API Level 31 - Revision 8  - Google APIs ARM 64 v8a System Image

Unfortunately, I had no success.


./rootAVD.sh ListAllAVDs ↩ī¸

rootAVD A Script to root AVD by NewBit XDA

Usage:	rootAVD [DIR/ramdisk.img] [OPTIONS] | [EXTRA_CMDS]
or:	rootAVD [ARGUMENTS]

Arguments:
	ListAllAVDs			Lists Command Examples for ALL installed AVDs

	EnvFixTask			Requires Additional Setup fix
					- construct Magisk Environment manual
					- only works with an already Magisk patched ramdisk.img
					- without [DIR/ramdisk.img] [OPTIONS] [PATCHFSTAB]
					- needed since Android 12 (S) rev.1
					- not needed anymore since Android 12 (S) API 31 and Magisk Alpha
					- Grant Shell Su Permissions will pop up a few times
					- the AVD will reboot automatically

	InstallApps			Just install all APKs placed in the Apps folder

Main operation mode:
	DIR				a path to an AVD system-image
					- must always be the 1st Argument after rootAVD

ADB Path | Ramdisk DIR:
	[M]ac/Darwin:			export PATH=~/Library/Android/sdk/platform-tools:$PATH
					~/Library/Android/sdk/system-images/android-$API/google_apis_playstore/x86_64/

	[L]inux:			export PATH=~/Android/Sdk/platform-tools:$PATH
					~/Android/Sdk/system-images/android-$API/google_apis_playstore/x86_64/

	[W]indows:			set PATH=%LOCALAPPDATA%\Android\Sdk\platform-tools;%PATH%
					%LOCALAPPDATA%\Android\Sdk\system-images\android-$API\google_apis_playstore\x86_64\

	$API:				25,29,30,S,etc.

Except for EnvFixTask, ramdisk.img must be untouched (stock).

Options:
	restore				restore all existing .backup files, but doesn't delete them
					- the AVD doesn't need to be running
					- no other Argument after will be processed

	InstallKernelModules		install custom build kernel and its modules into ramdisk.img
					- kernel (bzImage) and its modules (initramfs.img) are inside rootAVD
					- both files will be deleted after installation

	InstallPrebuiltKernelModules	download and install an AOSP prebuilt kernel and its modules into ramdisk.img
					- similar to InstallKernelModules, but the AVD needs to be online

	AddRCscripts			install all custom *.rc scripts, placed in the rootAVD folder, into ramdisk.img/overlay.d/sbin

Options are exclusive, only one at the time will be processed.

Extra Commands:
	DEBUG				Debugging Mode, prevents rootAVD to pull back any patched file

	PATCHFSTAB			fstab.ranchu will get patched to automount Block Devices like /dev/block/sda1
					- other entries can be added in the script as well
					- a custom build Kernel might be necessary

	GetUSBHPmodZ			The USB HOST Permissions Module Zip will be downloaded into /sdcard/Download

Extra Commands can be combined, there is no particular order.

Notes: rootAVD will
- always create .backup files of ramdisk.img and kernel-ranchu
- replace both when done patching
- show a Menu, to choose the Magisk Version (Stable || Canary || Alpha), if the AVD is online
- make the choosen Magisk Version to its local
- install all APKs placed in the Apps folder

Command Examples:
./rootAVD.sh
./rootAVD.sh ListAllAVDs
./rootAVD.sh EnvFixTask
./rootAVD.sh InstallApps

./rootAVD.sh ~/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a/ramdisk.img
./rootAVD.sh ~/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a/ramdisk.img DEBUG PATCHFSTAB GetUSBHPmodZ
./rootAVD.sh ~/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a/ramdisk.img restore
./rootAVD.sh ~/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a/ramdisk.img InstallKernelModules
./rootAVD.sh ~/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a/ramdisk.img InstallPrebuiltKernelModules
./rootAVD.sh ~/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a/ramdisk.img InstallPrebuiltKernelModules GetUSBHPmodZ PATCHFSTAB DEBUG
./rootAVD.sh ~/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a/ramdisk.img AddRCscripts

./rootAVD.sh ~/Library/Android/sdk/system-images/android-30/google_apis/arm64-v8a/ramdisk.img
./rootAVD.sh ~/Library/Android/sdk/system-images/android-30/google_apis/arm64-v8a/ramdisk.img DEBUG PATCHFSTAB GetUSBHPmodZ
./rootAVD.sh ~/Library/Android/sdk/system-images/android-30/google_apis/arm64-v8a/ramdisk.img restore
./rootAVD.sh ~/Library/Android/sdk/system-images/android-30/google_apis/arm64-v8a/ramdisk.img InstallKernelModules
./rootAVD.sh ~/Library/Android/sdk/system-images/android-30/google_apis/arm64-v8a/ramdisk.img InstallPrebuiltKernelModules
./rootAVD.sh ~/Library/Android/sdk/system-images/android-30/google_apis/arm64-v8a/ramdisk.img InstallPrebuiltKernelModules GetUSBHPmodZ PATCHFSTAB DEBUG
./rootAVD.sh ~/Library/Android/sdk/system-images/android-30/google_apis/arm64-v8a/ramdisk.img AddRCscripts

./rootAVD.sh ~/Library/Android/sdk/system-images/android-30/google_apis/arm64-v8a/ramdisk↩ī¸

[!] 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
[-] Magisk installer Zip exists already
[*] Cleaning up the ADB working space
[*] Creating the ADB working space
[*] Push Magisk.zip into /data/data/com.android.shell/Magisk
[-] ./Magisk.zip: 1 file pushed, 0 skipped. 204.3 MB/s (7513409 bytes in 0.035s)
[-] ramdisk.img Backup exists already
[*] Push ramdisk.img into /data/data/com.android.shell/Magisk
[-] /Users/michael/Library/Android/sdk/system-images/android-30/google_apis/arm64-v8a/ramdisk.img: 1 file pushed, 0 skipped. 176.0 MB/s (1557267 bytes in 0.008s)
[*] Push rootAVD.sh into /data/data/com.android.shell/Magisk
[-] rootAVD.sh: 1 file pushed, 0 skipped. 152.2 MB/s (7824446 bytes in 0.049s)
[-] run the actually Boot/Ramdisk/Kernel Image Patch Script
[*] from Magisk by topjohnwu and modded by NewBit XDA
[!] We are in an emulator shell
[-] Api Level Arch Detect
[-] Device Platform is arm64 only
[-] Device SDK API: 30
[-] First API Level: 30
[-] Switch to the location of the script file
[*] Extracting busybox and Magisk.zip ...
/data/data/com.android.shell/Magisk/rootAVD.sh[1503]: /data/data/com.android.shell/Magisk/busybox: not executable: 32-bit ELF file
/data/data/com.android.shell/Magisk/rootAVD.sh[1503]: /data/data/com.android.shell/Magisk/busybox: not executable: 32-bit ELF file
/data/data/com.android.shell/Magisk/rootAVD.sh[1503]: /data/data/com.android.shell/Magisk/busybox: not executable: 32-bit ELF file
[-] Checking AVDs Internet connection...
[!] AVD is offline
[*] Re-Run rootAVD in Magisk Busybox STANDALONE (D)ASH
/data/data/com.android.shell/Magisk/rootAVD.sh[1503]: /data/data/com.android.shell/Magisk/busybox: not executable: 32-bit ELF file
[-] We are now in Magisk Busybox STANDALONE (D)ASH
[*] rootAVD with Magisk () Installer
[-] Get Flags
(Stuck here without terminating.)

It looks the same with Android 12 AVD.

from rootavd.

newbit1 avatar newbit1 commented on September 26, 2024 1

Thanks, you must choose 4 Alpha Version. Stable and Canary don't work.
it seems the busybox arm64 binary could not work as it should.
Not sure why. You can try to download the Alpha Version directly
rename it to Magisk.zip and replace it manually. Then try again.

I've updated the Busybox Extraction Routine. Check it out without replacing the Magisk.zip manually.

from rootavd.

kolbasa avatar kolbasa commented on September 26, 2024 1

I have tried it now. Worked wonderfully. Android 12 has successfully started with root access.
Great job, you are the best! 😀 👍

from rootavd.

iamironz avatar iamironz commented on September 26, 2024

After the attempt to flash the arm image I've got the following log output:

iamironz:rootAVD/ (master) $ ./rootAVD.sh /opt/homebrew/Caskroom/android-sdk/4333796/system-images/android-S/google_apis_playstore/arm64-v8a/ramdisk.img                                                                                                                                                                                                         [17:44:41]
[!] 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
[-] Magisk installer Zip exists already
[*] Cleaning up the ADB working space
[*] Creating the ADB working space
[*] Push Magisk.zip into /data/data/com.android.shell/Magisk
[-] ./Magisk.zip: 1 file pushed, 0 skipped. 254.5 MB/s (6874374 bytes in 0.026s)
[*] create Backup File of ramdisk.img
[*] Push ramdisk.img into /data/data/com.android.shell/Magisk
[-] /opt/homebrew/Caskroom/android-sdk/4333796/system-images/android-S/google_apis_playstore/arm64-v8a/ramdisk.img: 1 file pushed, 0 skipped. 320.3 MB/s (2593556 bytes in 0.008s)
[*] Push rootAVD.sh into /data/data/com.android.shell/Magisk
[-] rootAVD.sh: 1 file pushed, 0 skipped. 180.7 MB/s (1996068 bytes in 0.011s)
[-] run the actually Boot/Ramdisk/Kernel Image Patch Script
[*] from Magisk by topjohnwu and modded by NewBit XDA
[!] We are in an emulator shell
[-] Switch to the location of the script file
[*] Extracting busybox and Magisk.zip ...
/data/data/com.android.shell/Magisk/rootAVD.sh[1379]: /data/data/com.android.shell/Magisk/busybox: not executable: 32-bit ELF file
/data/data/com.android.shell/Magisk/rootAVD.sh[1379]: /data/data/com.android.shell/Magisk/busybox: not executable: 32-bit ELF file
/data/data/com.android.shell/Magisk/rootAVD.sh[1379]: /data/data/com.android.shell/Magisk/busybox: not executable: 32-bit ELF file
[-] 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 () Installer
[-] Get Flags
/data/data/com.android.shell/Magisk/rootAVD.sh[1379]: /data/data/com.android.shell/Magisk/busybox: not executable: 32-bit ELF file

from rootavd.

kolbasa avatar kolbasa commented on September 26, 2024

I support this request. That would be great.

from rootavd.

iamironz avatar iamironz commented on September 26, 2024

Also, busybox for arm64 is available. https://github.com/Magisk-Modules-Repo/busybox-ndk

from rootavd.

kolbasa avatar kolbasa commented on September 26, 2024

The link to MagiskOnEmulator helped me, thanks :)

from rootavd.

newbit1 avatar newbit1 commented on September 26, 2024

Dear @iamironz and @kolbasa,

I've added some 64-Bit Only support. Please check again with the Magisk Alpha Version from @vvb2060
and report back.
Please provide the Download link to the Image and Input & Output from the terminal.
Thanks
NewBit

from rootavd.

kolbasa avatar kolbasa commented on September 26, 2024

Thanks for the help. I was able to fix the problem. I had to reset my AVD (wipe data). Then suddenly it worked. Even without downloading Magisk.apk manually.

# Restoring backup ramdisk
./rootAVD.sh ~/Library/Android/sdk/system-images/android-30/google_apis/arm64-v8a/ramdisk.img restore

# Starting a clean AVD
$ANDROID_SDK_ROOT/emulator/emulator -avd Android_11 -wipe-data

./rootAVD.sh ~/Library/Android/sdk/system-images/android-30/google_apis/arm64-v8a/ramdisk.img↩ī¸

Log
[!] 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
[-] Magisk installer Zip exists already
[*] Cleaning up the ADB working space
[*] Creating the ADB working space
[*] Push Magisk.zip into /data/data/com.android.shell/Magisk
[-] ./Magisk.zip: 1 file pushed, 0 skipped. 361.1 MB/s (6874374 bytes in 0.018s)
[-] ramdisk.img Backup exists already
[*] Push ramdisk.img into /data/data/com.android.shell/Magisk
[-] /Users/michael/Library/Android/sdk/system-images/android-30/google_apis/arm64-v8a/ramdisk.img: 1 file pushed, 0 skipped. 392.0 MB/s (1557267 bytes in 0.004s)
[*] Push rootAVD.sh into /data/data/com.android.shell/Magisk
[-] rootAVD.sh: 1 file pushed, 0 skipped. 219.3 MB/s (7824512 bytes in 0.034s)
[-] run the actually Boot/Ramdisk/Kernel Image Patch Script
[*] from Magisk by topjohnwu and modded by NewBit XDA
[!] We are in an emulator shell
[-] Api Level Arch Detect
[-] Device Platform is arm64 only
[-] Device SDK API: 30
[-] First API Level: 30
[-] Switch to the location of the script file
[*] Extracting busybox and Magisk.zip ...
[*] Extracting busybox from script ...
[!] Found a working busybox Binary:
[!] BusyBox v1.33.1-Magisk (2021-05-08 15:20:41 PDT) multi-call binary.
[-] Checking AVDs Internet connection...
[!] AVD is online
[!] Checking available Magisk Versions
[?] Choose a Magisk Version to install and make it local
[1] Local '23.0' (ENTER)
[2] Canary d7e7df3b(23010)
[3] Stable 23.0
[4] Alpha b6298f86-alpha(23001)
4
[4] You choose Magisk Alpha Version b6298f86-alpha(23001)
[*] Deleting local Magisk '23.0'
[*] Downloading Magisk b6298f86-alpha(23001)
[!] Downloading Magisk b6298f86-alpha(23001) complete!
[-] Switch to the location of the script file
[*] Extracting busybox and Magisk.zip ...
[*] Re-Run rootAVD in Magisk Busybox STANDALONE (D)ASH
[!] We are in an emulator shell
[-] We are now in Magisk Busybox STANDALONE (D)ASH
[*] rootAVD with Magisk b6298f86-alpha(23001) Installer
[-] Get Flags
[*] System-as-root, keep dm/avb-verity
[-] Encrypted data, keep forceencrypt
[*] RECOVERYMODE=false
[-] KEEPVERITY=true
[*] KEEPFORCEENCRYPT=true
[-] copy all arm64-v8a files from /data/data/com.android.shell/Magisk/lib/arm64-v8a 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
[-] API level greater then 30
[*] Check if we need to repack ramdisk before patching ..
[-] Multiple cpio archives detected
[*] Unpacking ramdisk ..
[-] Dumping from 0 to 1832688 ..
[-] Dumping from 1832704 to 4632124 ..
[*] Repacking ramdisk ..
[-] Deleting system ramdisk build.prop
[-] Test patch status and do restore
[-] Checking ramdisk status
[-] STATUS=0
[-] Stock boot image detected
[-] Patching ramdisk
[*] adding overlay.d/sbin folders to ramdisk
Loading cpio: [ramdisk.cpio]
Create directory [overlay.d] (0750)
Create directory [overlay.d/sbin] (0750)
Dump cpio: [ramdisk.cpio]
[!] PATCHFSTAB=false
[!] Skipping fstab.ranchu patch with /dev/block/sda
[?] If you want fstab.ranchu patched, Call rootAVD with PATCHFSTAB
[!] AddRCscripts=false
[!] Skip adding *.rc scripts into ramdisk.img/sbin/*.rc
[?] If you want *.rc scripts added into ramdisk.img/sbin/*.rc, Call rootAVD with AddRCscripts
[!] patching the ramdisk with Magisk Init
Loading cpio: [ramdisk.cpio]
Add entry [init] (0750)
Add entry [overlay.d/sbin/magisk64.xz] (0644)
Patch with flag KEEPVERITY=[true] KEEPFORCEENCRYPT=[true]
Loading cpio: [ramdisk.cpio.orig]
Backup mismatch entry: [init] -> [.backup/init]
Record new entry: [overlay.d] -> [.backup/.rmlist]
Record new entry: [overlay.d/sbin] -> [.backup/.rmlist]
Record new entry: [overlay.d/sbin/magisk64.xz] -> [.backup/.rmlist]
Create directory [.backup] (0000)
Add entry [.backup/.magisk] (0000)
Dump cpio: [ramdisk.cpio]
[*] repacking back to ramdisk.img format
[!] Copy Magisk.zip to Magisk.apk
[*] Pull ramdiskpatched4AVD.img into ramdisk.img
[-] /data/data/com.android.shell/Magisk/ramdiskpatched4AVD.img: 1 file pulled, 0 skipped. 290.8 MB/s (1969989 bytes in 0.006s)
[*] Pull Magisk.apk into
[-] /data/data/com.android.shell/Magisk/Magisk.apk: 1 file pulled, 0 skipped. 587.3 MB/s (10749579 bytes in 0.017s)
[*] Pull Magisk.zip into .
[-] /data/data/com.android.shell/Magisk/Magisk.zip: 1 file pulled, 0 skipped. 605.8 MB/s (10749579 bytes in 0.017s)
[-] 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
[-] Modded by NewBit XDA - Jan. 2021
[!] Huge Credits and big Thanks to topjohnwu, shakalaca and vvb2060
[-] Trying to shut down the AVD
[!] If the AVD doesn't shut down, try it manually!

After a restart, the Android 11 emulator is rooted.


However, it does not work with Android 12. After patching, you get a black screen when restarting the emulator.
Personally, I am happy with Android 11. I do not need more at the moment. But maybe the log data is helpful:


./rootAVD.sh ~/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a/ramdisk.img↩ī¸

Log
[!] 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
[-] Magisk installer Zip exists already
[*] Cleaning up the ADB working space
[*] Creating the ADB working space
[*] Push Magisk.zip into /data/data/com.android.shell/Magisk
[-] ./Magisk.zip: 1 file pushed, 0 skipped. 307.5 MB/s (6874374 bytes in 0.021s)
[-] ramdisk.img Backup exists already
[*] Push ramdisk.img into /data/data/com.android.shell/Magisk
[-] /Users/michael/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a/ramdisk.img: 1 file pushed, 0 skipped. 303.0 MB/s (4206336 bytes in 0.013s)
[*] Push rootAVD.sh into /data/data/com.android.shell/Magisk
[-] rootAVD.sh: 1 file pushed, 0 skipped. 228.7 MB/s (7824512 bytes in 0.033s)
[-] run the actually Boot/Ramdisk/Kernel Image Patch Script
[*] from Magisk by topjohnwu and modded by NewBit XDA
[!] We are in an emulator shell
[-] Api Level Arch Detect
[-] Device Platform is arm64 only
[-] Device SDK API: 31
[-] First API Level: 31
[-] Switch to the location of the script file
[*] Extracting busybox and Magisk.zip ...
[*] Extracting busybox from script ...
[!] Found a working busybox Binary:
[!] BusyBox v1.33.1-Magisk (2021-05-08 15:20:41 PDT) multi-call binary.
[-] Checking AVDs Internet connection...
[!] AVD is online
[!] Checking available Magisk Versions
[?] Choose a Magisk Version to install and make it local
[1] Local '23.0' (ENTER)
[2] Canary d7e7df3b(23010)
[3] Stable 23.0
[4] Alpha b6298f86-alpha(23001)
4
[4] You choose Magisk Alpha Version b6298f86-alpha(23001)
[*] Deleting local Magisk '23.0'
[*] Downloading Magisk b6298f86-alpha(23001)
[!] Downloading Magisk b6298f86-alpha(23001) complete!
[-] Switch to the location of the script file
[*] Extracting busybox and Magisk.zip ...
[*] Re-Run rootAVD in Magisk Busybox STANDALONE (D)ASH
[!] We are in an emulator shell
[-] We are now in Magisk Busybox STANDALONE (D)ASH
[*] rootAVD with Magisk b6298f86-alpha(23001) Installer
[-] Get Flags
[*] System-as-root, keep dm/avb-verity
[-] Encrypted data, keep forceencrypt
[*] RECOVERYMODE=false
[-] KEEPVERITY=true
[*] KEEPFORCEENCRYPT=true
[-] copy all arm64-v8a files from /data/data/com.android.shell/Magisk/lib/arm64-v8a to /data/data/com.android.shell/Magisk
[*] Detecting ramdisk.img compression
[!] Ramdisk.img uses lz4_legacy compression
[-] taken from shakalaca's MagiskOnEmulator/process.sh
[*] executing ramdisk splitting / extraction / repacking
[-] API level greater then 30
[*] Check if we need to repack ramdisk before patching ..
[-] Multiple cpio archives detected
[*] Unpacking ramdisk ..
[-] Dumping from 0 to 1568188 ..
Detected format: [lz4_legacy]
[-] Dumping from 1568188 to 4206336 ..
Detected format: [raw]
Input file is not a supported compressed type!
[*] Repacking ramdisk ..
[-] Deleting system ramdisk build.prop
[-] Test patch status and do restore
[-] Checking ramdisk status
[-] STATUS=0
[-] Stock boot image detected
[-] Patching ramdisk
[*] adding overlay.d/sbin folders to ramdisk
Loading cpio: [ramdisk.cpio]
Create directory [overlay.d] (0750)
Create directory [overlay.d/sbin] (0750)
Dump cpio: [ramdisk.cpio]
[!] PATCHFSTAB=false
[!] Skipping fstab.ranchu patch with /dev/block/sda
[?] If you want fstab.ranchu patched, Call rootAVD with PATCHFSTAB
[!] AddRCscripts=false
[!] Skip adding *.rc scripts into ramdisk.img/sbin/*.rc
[?] If you want *.rc scripts added into ramdisk.img/sbin/*.rc, Call rootAVD with AddRCscripts
[!] patching the ramdisk with Magisk Init
Loading cpio: [ramdisk.cpio]
Add entry [init] (0750)
Add entry [overlay.d/sbin/magisk64.xz] (0644)
Patch with flag KEEPVERITY=[true] KEEPFORCEENCRYPT=[true]
Loading cpio: [ramdisk.cpio.orig]
Backup mismatch entry: [init] -> [.backup/init]
Record new entry: [overlay.d] -> [.backup/.rmlist]
Record new entry: [overlay.d/sbin] -> [.backup/.rmlist]
Record new entry: [overlay.d/sbin/magisk64.xz] -> [.backup/.rmlist]
Create directory [.backup] (0000)
Add entry [.backup/.magisk] (0000)
Dump cpio: [ramdisk.cpio]
[*] repacking back to ramdisk.img format
[!] Copy Magisk.zip to Magisk.apk
[*] Pull ramdiskpatched4AVD.img into ramdisk.img
[-] /data/data/com.android.shell/Magisk/ramdiskpatched4AVD.img: 1 file pulled, 0 skipped. 310.6 MB/s (2056615 bytes in 0.006s)
[*] Pull Magisk.apk into
[-] /data/data/com.android.shell/Magisk/Magisk.apk: 1 file pulled, 0 skipped. 334.2 MB/s (10749579 bytes in 0.031s)
[*] Pull Magisk.zip into .
[-] /data/data/com.android.shell/Magisk/Magisk.zip: 1 file pulled, 0 skipped. 328.9 MB/s (10749579 bytes in 0.031s)
[-] 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
[-] Modded by NewBit XDA - Jan. 2021
[!] Huge Credits and big Thanks to topjohnwu, shakalaca and vvb2060
[-] Trying to shut down the AVD
[!] If the AVD doesn't shut down, try it manually!

$ANDROID_SDK_ROOT/emulator/emulator -avd Android_12↩ī¸

Log
INFO    | Android emulator version 30.9.4.0 (build_id 7759208) (CL:N/A)
WARNING | unexpected system image feature string, emulator might not function correctly, please try updating the emulator.
WARNING | cannot add library /Users/michael/Library/Android/sdk/emulator/qemu/darwin-aarch64/lib64/vulkan/libvulkan.dylib: failed
WARNING | cannot add library /Users/michael/Library/Android/sdk/emulator/lib64/vulkan/libvulkan.dylib: failed
WARNING | cannot add library /Users/michael/Library/Android/sdk/emulator/qemu/darwin-aarch64/lib64/vulkan/libMoltenVK.dylib: failed
INFO    | added library /Users/michael/Library/Android/sdk/emulator/lib64/vulkan/libMoltenVK.dylib
createOrGetGlobalVkEmulation: warning: instance doesn't support external memory capabilities, picking first physical device
INFO    | configAndStartRenderer: setting vsync to 60 hz
INFO    | Sending adb public key [QAAAAKlYI8FnNL1ocehzNzaf0viHKPj9K6LF3VutiIB29rtAb+vqPFasCb5PWMf1dc0Yhr/8DTNtBbHYEs0iA9Vvc75fNUU9BbcEImoOKyYLQ4HlueTYjrWVvd/kz2iu8X5M0TFMLLbQ0gtnpkVE0/wm7pJkJSzxjvgI6ZZoMU/Mh+77AJ9VSlHfqiTg0hY6ZD38ZJw9Kf7iqUQ7cVtUK+EIXGnygWaMMxcWpwEeTyVwMK+mjhwLHkyyDqREoARc7YJ1vIs6MEFYe19EWgAxeljVthdn+yOtLY+Ine4nGW0LtLDWPm+ZKeQi22Du80RWoRLF8awDn3YCB8yFF6nJchvb4EdIOlPu3QlrkIht4TgUZ1NlgBbHGVeGbe3ypQ1YtyG6NLNACRFOjf6pn4TK7qZ44APGd09uNC6YD+tL5E3gPkCd8ZA8Sikwm2l/PP2nynqKDfr0KzIx1fPBsZPQsg3opAjKKU7/Xy0QPTWf8Bow2c11XBnGVDMLEn4HKxOJWqfZlhZw5SPosPiXlkFsGwM1AOHeF38jOettzqSrqX9gTcxfObQTStrHjX6G7RRbXXhstF4yK4iWYq6O+CcW7Qdix+i6L9jL8v+dSHtFN2bZR1XCQLkUjbV3N7QK/TcbjFOfvDd4t7P0IpCwaGqBETlUNJqROdSCo3k1YAoZ0uq2sxBbSqvsWQEAAQA= michael@unknown]
INFO    | Rootcanal has **NOT** been activated.
INFO    | Started GRPC server at 127.0.0.1:8554, security: Local
INFO    | Advertising in: /Users/michael/Library/Caches/TemporaryItems/avd/running/pid_11300.ini

(emulator is stuck here with a black screen)

from rootavd.

newbit1 avatar newbit1 commented on September 26, 2024

Oh wow that is great news. Thanks for your feedback and the logs.
Both logs look exactly how they should. So with Android 12 it seems more like an Emulator Issue.
Is the 30.9.4.0 the newest Version?
Perhaps caused from one of the Magisk files. But still weird. If you are in the mood, you could try out
if the safeboot procedure is getting you back in a booted state. Also, if the screens remains black, check
if you can connect to the AVD via adb shell. They might be more infos with the logcat as well.

And If you don't mind, could you please provide me the download link from the Android 11 system image?
The one that is displayed when you download it the first time.

Is there a reason why you start the AVD from the terminal? And not from the Manager?

from rootavd.

kolbasa avatar kolbasa commented on September 26, 2024

Is the 30.9.4.0 the newest Version?

Yes, I use the beta branch of Android Studio because it has the best M1 support. This may also be the reason why it causes problems.

you could try out if the safeboot procedure

I have tried this, but without success: Tap and Hold the Volume Down Button. Nothing happens there.

you can connect to the AVD via adb shell

This does not work. The emulator appears in adb, but is marked as offline.

Is there a reason why you start the AVD from the terminal? And not from the Manager?

It doesn't really make a difference how you start it. In the manager, the emulator also gets stuck. But via the terminal I get some useful log entries.

Here again the log in verbose mode:

Log
INFO    | Android emulator version 30.9.4.0 (build_id 7759208) (CL:N/A)
INFO    | Found AVD name 'Android_12'
INFO    | Found AVD target architecture: arm64
INFO    | argv[0]: '/Users/michael/Library/Android/sdk/emulator/emulator'; program directory: '/Users/michael/Library/Android/sdk/emulator'
VERBOSE |  Found directory: /Users/michael/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a/
INFO    | emuDirName: '/Users/michael/Library/Android/sdk/emulator'
INFO    | try dir /Users/michael/Library/Android/sdk/emulator
INFO    | Trying emulator path '/Users/michael/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64'
INFO    | Found target-specific 64-bit emulator binary: /Users/michael/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64
INFO    | Adding library search path: '/Users/michael/Library/Android/sdk/emulator/lib64'
INFO    | Adding library search path: '/Users/michael/Library/Android/sdk/emulator/lib64/gles_angle'
INFO    | Adding library search path: '/Users/michael/Library/Android/sdk/emulator/lib64/gles_angle9'
INFO    | Adding library search path: '/Users/michael/Library/Android/sdk/emulator/lib64/gles_angle11'
INFO    | Adding library search path: '/Users/michael/Library/Android/sdk/emulator/lib64/gles_swiftshader'
VERBOSE | Adding library search path for Qt: '/Users/michael/Library/Android/sdk/emulator/lib64/qt/lib'
VERBOSE | Silencing all qWarning(); use qCWarning(...) instead: QT_LOGGING_RULES=default.warning=false
VERBOSE | Setting Qt plugin search path: QT_QPA_PLATFORM_PLUGIN_PATH=/Users/michael/Library/Android/sdk/emulator/lib64/qt/plugins
VERBOSE | Setting Qt to use software OpenGL: QT_OPENGL=software
VERBOSE | Setting QML to use software QtQuick2D: QMLSCENE_DEVICE=softwarecontext
VERBOSE | Overriding pre-existing bad Qt high dpi settings...
VERBOSE | emulator: Running :/Users/michael/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64
VERBOSE | qemu backend: argv[00] = "/Users/michael/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64"
VERBOSE | qemu backend: argv[01] = "-avd"
VERBOSE | qemu backend: argv[02] = "Android_12"
VERBOSE | qemu backend: argv[03] = "-verbose"
VERBOSE | Concatenated backend parameters:  /Users/michael/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64 -avd Android_12 -verbose
VERBOSE | autoconfig: -skin 1080x1920
VERBOSE | autoconfig: -skindir (null)
VERBOSE | autoconfig: -kernel /Users/michael/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a//kernel-ranchu
VERBOSE | Target arch = 'arm64'
VERBOSE | Auto-detect: Kernel image requires new device naming scheme.
VERBOSE | Auto-detect: Kernel does not support YAFFS2 partitions.
VERBOSE | autoconfig: -ramdisk /Users/michael/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a//ramdisk.img
VERBOSE | Using initial system image: /Users/michael/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a//system.img
VERBOSE | Using initial vendor image: /Users/michael/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a//vendor.img
VERBOSE | autoconfig: -data /Users/michael/.android/avd/Android_12.avd/userdata-qemu.img
VERBOSE | autoconfig: -initdata /Users/michael/.android/avd/Android_12.avd/userdata.img
VERBOSE | autoconfig: -cache /Users/michael/.android/avd/Android_12.avd/cache.img
VERBOSE | INFO: ignore sdcard for arm at api level >= 30
VERBOSE | Increasing RAM size to 2048MB
VERBOSE | VM heap size 256MB is below hardware specified minimum of 512MB,setting it to that value
VERBOSE | System image is read only
VERBOSE | autoconfig: -no-snapshot from AVD config.ini
VERBOSE | Found 2 DNS servers:
VERBOSE | 	192.168.178.1
VERBOSE | 	fd00::3a10:d5ff:fe21:b89e
WARNING | unexpected system image feature string, emulator might not function correctly, please try updating the emulator.
VERBOSE | Unexpected feature list:
VERBOSE | Vulkan
VERBOSE | found magic skin width=1080 height=1920 bpp=16

VERBOSE | CPU Acceleration: working
VERBOSE | CPU Acceleration status: Hypervisor.Framework OS X Version 11.6
VERBOSE | handleCpuAcceleration: feature check for hvf
VERBOSE | Bluetooth requested by guest
VERBOSE | started modem simulator host server at port: 64605
VERBOSE | GPU emulation enabled using 'host' mode
VERBOSE | Initializing hardware OpenGLES emulation support
VERBOSE | create display 0
VERBOSE | setDisplayPose 0 x 0 y 0 w 1080 h 1920 dpi 0
WARNING | cannot add library /Users/michael/Library/Android/sdk/emulator/qemu/darwin-aarch64/lib64/vulkan/libvulkan.dylib: failed
WARNING | cannot add library /Users/michael/Library/Android/sdk/emulator/lib64/vulkan/libvulkan.dylib: failed
WARNING | cannot add library /Users/michael/Library/Android/sdk/emulator/qemu/darwin-aarch64/lib64/vulkan/libMoltenVK.dylib: failed
INFO    | added library /Users/michael/Library/Android/sdk/emulator/lib64/vulkan/libMoltenVK.dylib
createOrGetGlobalVkEmulation: warning: instance doesn't support external memory capabilities, picking first physical device
INFO    | configAndStartRenderer: setting vsync to 60 hz
VERBOSE | INFO: ignore sdcard for arm at api level >= 30
INFO    | Sending adb public key [QAAAAKlYI8FnNL1ocehzNzaf0viHKPj9K6LF3VutiIB29rtAb+vqPFasCb5PWMf1dc0Yhr/8DTNtBbHYEs0iA9Vvc75fNUU9BbcEImoOKyYLQ4HlueTYjrWVvd/kz2iu8X5M0TFMLLbQ0gtnpkVE0/wm7pJkJSzxjvgI6ZZoMU/Mh+77AJ9VSlHfqiTg0hY6ZD38ZJw9Kf7iqUQ7cVtUK+EIXGnygWaMMxcWpwEeTyVwMK+mjhwLHkyyDqREoARc7YJ1vIs6MEFYe19EWgAxeljVthdn+yOtLY+Ine4nGW0LtLDWPm+ZKeQi22Du80RWoRLF8awDn3YCB8yFF6nJchvb4EdIOlPu3QlrkIht4TgUZ1NlgBbHGVeGbe3ypQ1YtyG6NLNACRFOjf6pn4TK7qZ44APGd09uNC6YD+tL5E3gPkCd8ZA8Sikwm2l/PP2nynqKDfr0KzIx1fPBsZPQsg3opAjKKU7/Xy0QPTWf8Bow2c11XBnGVDMLEn4HKxOJWqfZlhZw5SPosPiXlkFsGwM1AOHeF38jOettzqSrqX9gTcxfObQTStrHjX6G7RRbXXhstF4yK4iWYq6O+CcW7Qdix+i6L9jL8v+dSHtFN2bZR1XCQLkUjbV3N7QK/TcbjFOfvDd4t7P0IpCwaGqBETlUNJqROdSCo3k1YAoZ0uq2sxBbSqvsWQEAAQA= michael@unknown]
VERBOSE | Found 2 DNS servers:
VERBOSE | 	192.168.178.1
VERBOSE | 	fd00::3a10:d5ff:fe21:b89e
INFO    | Content of hardware configuration file:
INFO    | 	hw.cpu.arch = arm64
INFO    | 	hw.cpu.ncore = 4
INFO    | 	hw.ramSize = 2048
INFO    | 	hw.screen = multi-touch
INFO    | 	hw.mainKeys = false
INFO    | 	hw.trackBall = false
INFO    | 	hw.keyboard = true
INFO    | 	hw.keyboard.lid = false
INFO    | 	hw.keyboard.charmap = qwerty2
INFO    | 	hw.dPad = false
INFO    | 	hw.rotaryInput = false
INFO    | 	hw.gsmModem = true
INFO    | 	hw.gps = true
INFO    | 	hw.battery = true
INFO    | 	hw.accelerometer = true
INFO    | 	hw.gyroscope = true
INFO    | 	hw.audioInput = true
INFO    | 	hw.audioOutput = true
INFO    | 	hw.sdCard = true
INFO    | 	disk.cachePartition = true
INFO    | 	disk.cachePartition.path = /Users/michael/.android/avd/Android_12.avd/cache.img
INFO    | 	disk.cachePartition.size = 66m
INFO    | 	test.quitAfterBootTimeOut = -1
INFO    | 	test.delayAdbTillBootComplete = 0
INFO    | 	test.monitorAdb = 0
INFO    | 	hw.lcd.width = 1080
INFO    | 	hw.lcd.height = 1920
INFO    | 	hw.lcd.depth = 16
INFO    | 	hw.lcd.density = 420
INFO    | 	hw.lcd.backlight = true
INFO    | 	hw.lcd.vsync = 60
INFO    | 	hw.gltransport = pipe
INFO    | 	hw.gltransport.asg.writeBufferSize = 1048576
INFO    | 	hw.gltransport.asg.writeStepSize = 4096
INFO    | 	hw.gltransport.asg.dataRingSize = 32768
INFO    | 	hw.gltransport.drawFlushInterval = 800
INFO    | 	hw.displayRegion.0.1.xOffset = -1
INFO    | 	hw.displayRegion.0.1.yOffset = -1
INFO    | 	hw.displayRegion.0.1.width = 0
INFO    | 	hw.displayRegion.0.1.height = 0
INFO    | 	hw.displayRegion.0.2.xOffset = -1
INFO    | 	hw.displayRegion.0.2.yOffset = -1
INFO    | 	hw.displayRegion.0.2.width = 0
INFO    | 	hw.displayRegion.0.2.height = 0
INFO    | 	hw.displayRegion.0.3.xOffset = -1
INFO    | 	hw.displayRegion.0.3.yOffset = -1
INFO    | 	hw.displayRegion.0.3.width = 0
INFO    | 	hw.displayRegion.0.3.height = 0
INFO    | 	hw.display1.width = 0
INFO    | 	hw.display1.height = 0
INFO    | 	hw.display1.density = 0
INFO    | 	hw.display1.xOffset = -1
INFO    | 	hw.display1.yOffset = -1
INFO    | 	hw.display1.flag = 0
INFO    | 	hw.display2.width = 0
INFO    | 	hw.display2.height = 0
INFO    | 	hw.display2.density = 0
INFO    | 	hw.display2.xOffset = -1
INFO    | 	hw.display2.yOffset = -1
INFO    | 	hw.display2.flag = 0
INFO    | 	hw.display3.width = 0
INFO    | 	hw.display3.height = 0
INFO    | 	hw.display3.density = 0
INFO    | 	hw.display3.xOffset = -1
INFO    | 	hw.display3.yOffset = -1
INFO    | 	hw.display3.flag = 0
INFO    | 	hw.gpu.enabled = true
INFO    | 	hw.gpu.mode = host
INFO    | 	hw.initialOrientation = Portrait
INFO    | 	hw.camera.back = virtualscene
INFO    | 	hw.camera.front = emulated
INFO    | 	vm.heapSize = 512
INFO    | 	hw.sensors.light = true
INFO    | 	hw.sensors.pressure = true
INFO    | 	hw.sensors.humidity = true
INFO    | 	hw.sensors.proximity = true
INFO    | 	hw.sensors.magnetic_field = true
INFO    | 	hw.sensors.magnetic_field_uncalibrated = true
INFO    | 	hw.sensors.gyroscope_uncalibrated = true
INFO    | 	hw.sensors.orientation = true
INFO    | 	hw.sensors.temperature = true
INFO    | 	hw.sensors.rgbclight = false
INFO    | 	hw.sensor.hinge = true
INFO    | 	hw.sensor.hinge.count = 0
INFO    | 	hw.sensor.hinge.type = 0
INFO    | 	hw.sensor.hinge.sub_type = 0
INFO    | 	hw.sensor.hinge.fold_to_displayRegion.0.1_at_posture = 1
INFO    | 	hw.sensor.roll = false
INFO    | 	hw.sensor.roll.count = 0
INFO    | 	hw.sensor.roll.resize_to_displayRegion.0.1_at_posture = 6
INFO    | 	hw.sensor.roll.resize_to_displayRegion.0.2_at_posture = 6
INFO    | 	hw.sensor.roll.resize_to_displayRegion.0.3_at_posture = 6
INFO    | 	hw.sensors.heart_rate = false
INFO    | 	hw.useext4 = true
INFO    | 	hw.arc = false
INFO    | 	hw.arc.autologin = false
INFO    | 	kernel.path = /Users/michael/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a//kernel-ranchu
INFO    | 	kernel.newDeviceNaming = yes
INFO    | 	kernel.supportsYaffs2 = no
INFO    | 	disk.ramdisk.path = /Users/michael/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a//ramdisk.img
INFO    | 	disk.systemPartition.initPath = /Users/michael/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a//system.img
INFO    | 	disk.systemPartition.size = 4107m
INFO    | 	disk.vendorPartition.initPath = /Users/michael/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a//vendor.img
INFO    | 	disk.vendorPartition.size = 800m
INFO    | 	disk.dataPartition.path = /Users/michael/.android/avd/Android_12.avd/userdata-qemu.img
INFO    | 	disk.dataPartition.size = 800m
INFO    | 	disk.encryptionKeyPartition.path = /Users/michael/.android/avd/Android_12.avd/encryptionkey.img
INFO    | 	PlayStore.enabled = false
INFO    | 	avd.name = Android_12
INFO    | 	avd.id = Android_12
INFO    | 	fastboot.forceColdBoot = true
INFO    | 	android.sdk.root = /Users/michael/Library/Android/sdk
INFO    | 	android.avd.home = /Users/michael/.android/avd
INFO    | 	hw.device.name = pixel_2
INFO    | .
INFO    | QEMU options list:
INFO    | 	 argv[00] = "/Users/michael/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64"
INFO    | 	 argv[01] = "-dns-server"
INFO    | 	 argv[02] = "192.168.178.1,fd00::3a10:d5ff:fe21:b89e"
INFO    | 	 argv[03] = "-serial"
INFO    | 	 argv[04] = "null"
INFO    | 	 argv[05] = "-cpu"
INFO    | 	 argv[06] = "cortex-a53"
INFO    | 	 argv[07] = "-machine"
INFO    | 	 argv[08] = "type=virt"
INFO    | 	 argv[09] = "-enable-hvf"
INFO    | 	 argv[10] = "-smp"
INFO    | 	 argv[11] = "cores=4"
INFO    | 	 argv[12] = "-m"
INFO    | 	 argv[13] = "2048"
INFO    | 	 argv[14] = "-lcd-density"
INFO    | 	 argv[15] = "420"
INFO    | 	 argv[16] = "-nodefaults"
INFO    | 	 argv[17] = "-kernel"
INFO    | 	 argv[18] = "/Users/michael/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a//kernel-ranchu"
INFO    | 	 argv[19] = "-initrd"
INFO    | 	 argv[20] = "/Users/michael/.android/avd/Android_12.avd/initrd"
INFO    | 	 argv[21] = "-drive"
INFO    | 	 argv[22] = "index=0,id=vendor,if=none,file=/Users/michael/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a//vendor.img,read-only"
INFO    | 	 argv[23] = "-device"
INFO    | 	 argv[24] = "virtio-blk-device,drive=vendor"
INFO    | 	 argv[25] = "-drive"
INFO    | 	 argv[26] = "index=1,id=encrypt,if=none,file=/Users/michael/.android/avd/Android_12.avd/encryptionkey.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576"
INFO    | 	 argv[27] = "-device"
INFO    | 	 argv[28] = "virtio-blk-device,drive=encrypt"
INFO    | 	 argv[29] = "-drive"
INFO    | 	 argv[30] = "index=2,id=userdata,if=none,file=/Users/michael/.android/avd/Android_12.avd/userdata-qemu.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576"
INFO    | 	 argv[31] = "-device"
INFO    | 	 argv[32] = "virtio-blk-device,drive=userdata"
INFO    | 	 argv[33] = "-drive"
INFO    | 	 argv[34] = "index=3,id=cache,if=none,file=/Users/michael/.android/avd/Android_12.avd/cache.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576"
INFO    | 	 argv[35] = "-device"
INFO    | 	 argv[36] = "virtio-blk-device,drive=cache"
INFO    | 	 argv[37] = "-drive"
INFO    | 	 argv[38] = "index=4,id=system,if=none,file=/Users/michael/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a//system.img,read-only"
INFO    | 	 argv[39] = "-device"
INFO    | 	 argv[40] = "virtio-blk-device,drive=system"
INFO    | 	 argv[41] = "-netdev"
INFO    | 	 argv[42] = "user,id=mynet"
INFO    | 	 argv[43] = "-device"
INFO    | 	 argv[44] = "virtio-net-device,netdev=mynet"
INFO    | 	 argv[45] = "-chardev"
INFO    | 	 argv[46] = "null,id=forhvc0"
INFO    | 	 argv[47] = "-chardev"
INFO    | 	 argv[48] = "null,id=forhvc1"
INFO    | 	 argv[49] = "-device"
INFO    | 	 argv[50] = "virtio-serial-pci,ioeventfd=off"
INFO    | 	 argv[51] = "-device"
INFO    | 	 argv[52] = "virtconsole,chardev=forhvc0"
INFO    | 	 argv[53] = "-device"
INFO    | 	 argv[54] = "virtconsole,chardev=forhvc1"
INFO    | 	 argv[55] = "-chardev"
INFO    | 	 argv[56] = "rootcanal,id=rootcanal"
INFO    | 	 argv[57] = "-device"
INFO    | 	 argv[58] = "virtserialport,chardev=rootcanal,name=bluetooth"
INFO    | 	 argv[59] = "-device"
INFO    | 	 argv[60] = "virtio-serial,ioeventfd=off"
INFO    | 	 argv[61] = "-chardev"
INFO    | 	 argv[62] = "socket,port=64604,host=::1,nowait,nodelay,ipv6,id=modem"
INFO    | 	 argv[63] = "-device"
INFO    | 	 argv[64] = "virtserialport,chardev=modem,name=modem"
INFO    | 	 argv[65] = "-device"
INFO    | 	 argv[66] = "virtio-rng-device"
INFO    | 	 argv[67] = "-show-cursor"
INFO    | 	 argv[68] = "-device"
INFO    | 	 argv[69] = "virtio_input_multi_touch_pci_1"
INFO    | 	 argv[70] = "-device"
INFO    | 	 argv[71] = "virtio_input_multi_touch_pci_2"
INFO    | 	 argv[72] = "-device"
INFO    | 	 argv[73] = "virtio_input_multi_touch_pci_3"
INFO    | 	 argv[74] = "-device"
INFO    | 	 argv[75] = "virtio_input_multi_touch_pci_4"
INFO    | 	 argv[76] = "-device"
INFO    | 	 argv[77] = "virtio_input_multi_touch_pci_5"
INFO    | 	 argv[78] = "-device"
INFO    | 	 argv[79] = "virtio_input_multi_touch_pci_6"
INFO    | 	 argv[80] = "-device"
INFO    | 	 argv[81] = "virtio_input_multi_touch_pci_7"
INFO    | 	 argv[82] = "-device"
INFO    | 	 argv[83] = "virtio_input_multi_touch_pci_8"
INFO    | 	 argv[84] = "-device"
INFO    | 	 argv[85] = "virtio_input_multi_touch_pci_9"
INFO    | 	 argv[86] = "-device"
INFO    | 	 argv[87] = "virtio_input_multi_touch_pci_10"
INFO    | 	 argv[88] = "-device"
INFO    | 	 argv[89] = "virtio_input_multi_touch_pci_11"
INFO    | 	 argv[90] = "-device"
INFO    | 	 argv[91] = "virtio-keyboard-pci"
INFO    | 	 argv[92] = "-netdev"
INFO    | 	 argv[93] = "user,id=virtio-wifi,dhcpstart=10.0.2.16"
INFO    | 	 argv[94] = "-device"
INFO    | 	 argv[95] = "virtio-wifi-pci,netdev=virtio-wifi"
INFO    | 	 argv[96] = "-device"
INFO    | 	 argv[97] = "virtio-vsock-pci,guest-cid=77"
INFO    | 	 argv[98] = "-L"
INFO    | 	 argv[99] = "/Users/michael/Library/Android/sdk/emulator/lib/pc-bios"
INFO    | 	 argv[100] = "-soundhw"
INFO    | 	 argv[101] = "hda"
INFO    | 	 argv[102] = "-append"
INFO    | 	 argv[103] = "no_timer_check keep_bootcon earlyprintk=ttyAMA0 console=0 cma=288M@0-4G ndns=2 loop.max_part=7 printk.devkmsg=on bootconfig"
INFO    | 	 argv[104] = "-android-hw"
INFO    | 	 argv[105] = "/Users/michael/.android/avd/Android_12.avd/hardware-qemu.ini"
INFO    | Concatenated QEMU options: /Users/michael/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64 -dns-server 192.168.178.1,fd00::3a10:d5ff:fe21:b89e -serial null -cpu cortex-a53 -machine type=virt -enable-hvf -smp cores=4 -m 2048 -lcd-density 420 -nodefaults -kernel /Users/michael/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a//kernel-ranchu -initrd /Users/michael/.android/avd/Android_12.avd/initrd -drive index=0,id=vendor,if=none,file=/Users/michael/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a//vendor.img,read-only -device virtio-blk-device,drive=vendor -drive index=1,id=encrypt,if=none,file=/Users/michael/.android/avd/Android_12.avd/encryptionkey.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-device,drive=encrypt -drive index=2,id=userdata,if=none,file=/Users/michael/.android/avd/Android_12.avd/userdata-qemu.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-device,drive=userdata -drive index=3,id=cache,if=none,file=/Users/michael/.android/avd/Android_12.avd/cache.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-device,drive=cache -drive index=4,id=system,if=none,file=/Users/michael/Library/Android/sdk/system-images/android-31/google_apis/arm64-v8a//system.img,read-only -device virtio-blk-device,drive=system -netdev user,id=mynet -device virtio-net-device,netdev=mynet -chardev null,id=forhvc0 -chardev null,id=forhvc1 -device virtio-serial-pci,ioeventfd=off -device virtconsole,chardev=forhvc0 -device virtconsole,chardev=forhvc1 -chardev rootcanal,id=rootcanal -device virtserialport,chardev=rootcanal,name=bluetooth -device virtio-serial,ioeventfd=off -chardev socket,port=64604,host=::1,nowait,nodelay,ipv6,id=modem -device virtserialport,chardev=modem,name=modem -device virtio-rng-device -show-cursor -device virtio_input_multi_touch_pci_1 -device virtio_input_multi_touch_pci_2 -device virtio_input_multi_touch_pci_3 -device virtio_input_multi_touch_pci_4 -device virtio_input_multi_touch_pci_5 -device virtio_input_multi_touch_pci_6 -device virtio_input_multi_touch_pci_7 -device virtio_input_multi_touch_pci_8 -device virtio_input_multi_touch_pci_9 -device virtio_input_multi_touch_pci_10 -device virtio_input_multi_touch_pci_11 -device virtio-keyboard-pci -netdev user,id=virtio-wifi,dhcpstart=10.0.2.16 -device virtio-wifi-pci,netdev=virtio-wifi -device virtio-vsock-pci,guest-cid=77 -L /Users/michael/Library/Android/sdk/emulator/lib/pc-bios -soundhw hda -append 'no_timer_check keep_bootcon earlyprintk=ttyAMA0 console=0 cma=288M@0-4G ndns=2 loop.max_part=7 printk.devkmsg=on bootconfig' -android-hw /Users/michael/.android/avd/Android_12.avd/hardware-qemu.ini
VERBOSE | Starting hostapd main loop.
VERBOSE | Android qemu version 30.9.4.0 (build_id 7759208) (CL:N/A)
VERBOSE | Starting QEMU main loop
VERBOSE | registered 'boot-properties' qemud service
VERBOSE | Adding boot property: 'ro.opengles.version' = '196608'
VERBOSE | Adding boot property: 'qemu.sf.fake_camera' = 'front'
VERBOSE | Adding boot property: 'dalvik.vm.heapsize' = '512m'
VERBOSE | Adding boot property: 'qemu.hw.mainkeys' = '0'
VERBOSE | Adding boot property: 'qemu.sf.lcd_density' = '420'
INFO    | Rootcanal has **NOT** been activated.
VERBOSE | goldfish_events.have-dpad: false
VERBOSE | goldfish_events.have-trackball: false
VERBOSE | goldfish_events.have-camera: true
VERBOSE | goldfish_events.have-keyboard: false
VERBOSE | goldfish_events.have-lidswitch: false
VERBOSE | goldfish_events.have-tabletmode: false
VERBOSE | goldfish_events.have-touch: false
VERBOSE | goldfish_events.have-multitouch: false
VERBOSE | control console listening on port 5554, ADB on port 5555
VERBOSE | Adding boot property: 'net.wifi_mac_prefix' = '5554'
VERBOSE | Not using any http proxy
VERBOSE | Adding boot property: 'qemu.timezone' = 'Europe/Berlin'
VERBOSE | android_hw_fingerprint_init: fingerprint qemud listen service initialized
INFO    | Started GRPC server at 127.0.0.1:8554, security: Local
INFO    | Advertising in: /Users/michael/Library/Caches/TemporaryItems/avd/running/pid_18268.ini
VERBOSE | emulator_window_fb_rotate
VERBOSE | config multidisplay with config.ini 0x0 0x0 0x0
VERBOSE | Path:/Users/michael/Library/Android/sdk/platform-tools/adb protocol version: 41
VERBOSE | Path:/Users/michael/Library/Android/sdk/platform-tools/adb protocol version: 41
VERBOSE | Path:/Users/michael/Library/Android/sdk/platform-tools/adb protocol version: 41
VERBOSE | Found: 3 adb executables
VERBOSE | Adb: /Users/michael/Library/Android/sdk/platform-tools/adb
VERBOSE | Adb: /Users/michael/Library/Android/sdk/platform-tools/adb
VERBOSE | Adb: /Users/michael/Library/Android/sdk/platform-tools/adb
VERBOSE | Path:/Users/michael/Library/Android/sdk/platform-tools/adb protocol version: 41
VERBOSE | Path:/Users/michael/Library/Android/sdk/platform-tools/adb protocol version: 41
VERBOSE | Path:/Users/michael/Library/Android/sdk/platform-tools/adb protocol version: 41
VERBOSE | VirtIO WiFi: unexpected full virtqueue
VERBOSE | VirtIO WiFi: unexpected full virtqueue
VERBOSE | VirtIO WiFi: unexpected full virtqueue
VERBOSE | VirtIO WiFi: unexpected full virtqueue
VERBOSE | VirtIO WiFi: unexpected full virtqueue
VERBOSE | VirtIO WiFi: unexpected full virtqueue
VERBOSE | VirtIO WiFi: unexpected full virtqueue
VERBOSE | VirtIO WiFi: unexpected full virtqueue
VERBOSE | VirtIO WiFi: unexpected full virtqueue
VERBOSE | VirtIO WiFi: unexpected full virtqueue
VERBOSE | VirtIO WiFi: unexpected full virtqueue
VERBOSE | VirtIO WiFi: unexpected full virtqueue
VERBOSE | VirtIO WiFi: unexpected full virtqueue
VERBOSE | VirtIO WiFi: unexpected full virtqueue
VERBOSE | VirtIO WiFi: unexpected full virtqueue
VERBOSE | VirtIO WiFi: unexpected full virtqueue
VERBOSE | VirtIO WiFi: unexpected full virtqueue
VERBOSE | VirtIO WiFi: unexpected full virtqueue
VERBOSE | VirtIO WiFi: unexpected full virtqueue
VERBOSE | VirtIO WiFi: unexpected full virtqueue

The emulator seems to get stuck at VirtIO WiFi: unexpected full virtqueue. This is printed once a second.
Something must have been corrupted.

After a .../ramdisk.img restore the emulator can be started normally again.

from rootavd.

newbit1 avatar newbit1 commented on September 26, 2024

This could be an issue with one of the modules inside the ramdisk. You can try a newer kernel
by running the script on a the stock ramdisk with the InstallPrebuiltKernelModules parameter.

I had quite some issues connecting the AVD with the SDK if it was started from the command line.
If you run the AVD with the -show-kernel -verbose parameter, you can see in detail the kernel boot process
and perhaps on which boot stage it stuck. The kernel must be booted in order to access the safeboot feature.
So all this points to the inside the ramdisk. You can upload me the patched and the stock ramdisk file so I
can have a look inside if the structure is alright. And thank you for your feedbacks, very much appreciated.

from rootavd.

kolbasa avatar kolbasa commented on September 26, 2024

If you run the AVD with the -show-kernel -verbose parameter, you can see in detail the kernel boot process

$ANDROID_SDK_ROOT/emulator/emulator -avd Android_12 -show-kernel -verbose↩ī¸
> Log

You can upload me the patched and the stock ramdisk file

Patched: ramdisk.img.zip
Stock: ramdisk.img.backup.zip

Even if you do not find the error, it works super reliably with Android 11, which is really useful :).

from rootavd.

newbit1 avatar newbit1 commented on September 26, 2024

In the log it says:

[    0.443145][    T1] init: Unable to open /lib/modules, skipping module loading.
...
[    0.449691][    T1] reboot: Restarting system with command 'bootloader'
[    0.000000][    T0] Booting Linux on physical CPU 0x0000000000 [0x00000000]

And then it keeps repeating this and results in that black boot screen.

Thanks for the files. I will look into this.
Cheers

Edit:
So yes, the lib modules folder is completely missing.
Even in your log it says:
[-] Dumping from 1568188 to 4206336 ..
Detected format: [raw]
Input file is not a supported compressed type!

Something went wrong with extracting the second stage ramdisk.
I am wondering if this is Busybox Arm64 related?!

Edit2:
It could be fixed now. The LZ4 decompression routine wasn't resilient enough, now it should be.
Also I've updated the InstallPrebuiltKernelModules feature. It should now work with ARM64 as well.
If you would try this as well, a wipe data might be necessary after.
Thanks

from rootavd.

y0sua avatar y0sua commented on September 26, 2024

Hi gyus,
I am stuck at:
$ ./rootAVD.sh ~/Library/Android/sdk/system-images/android-26/default/arm64-v8a/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. 589.1 MB/s (11278270 bytes in 0.018s)
[-] ramdisk.img Backup exists already
[] Push ramdisk.img into /data/data/com.android.shell/Magisk
[-] /Users/han/Library/Android/sdk/system-images/android-26/default/arm64-v8a/ramdisk.img: 1 file pushed, 0 skipped. 877.5 MB/s (1800005 bytes in 0.002s)
[
] Push rootAVD.sh into /data/data/com.android.shell/Magisk
[-] rootAVD.sh: 1 file pushed, 0 skipped. 695.7 MB/s (7855800 bytes in 0.011s)
[-] 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 is arm64 only
[-] Device SDK API: 26
[-] First API Level:
[-] The AVD runs on Android 8.0.0
[-] Switch to the location of the script file
[
] Extracting busybox from script ...

stuck waiting here forever, please help

from rootavd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.