topjohnwu / Magisk

The Magic Mask for Android
GNU General Public License v3.0
47.6k stars 12.09k forks source link

Magisk on Android Q AVD - Partially working, empty log #2112

Closed andronoob closed 4 years ago

andronoob commented 4 years ago

I managed to modify ramdisk.img to install Magisk v20.1 on my emulated Android 10.0 device (with Google Play, x86_64). However, it just worked partially.

Magiskroot (su) worked fine.

Observed problems:

  1. Magisk Manager showed empty magisk log to me. This might be caused by /cache, I found /cache was readonly, it's not mounted - mount | grep cache printed empty result. However, logcat seemed to be working normally.

  2. I didn't see errors while flashing magisk-riru-core-v19.5.zip, but, after reboot, the Riru app still reported "Riru not found in memory". mount | grep libmemtrack printed nothing.

andronoob commented 4 years ago
generic_x86_64:/ # logcat | grep -i magisk
11-29 07:40:41.166  1737  1737 I Magisk  : Magisk v20.1(20100) daemon started
11-29 07:40:41.168  1737  1737 I Magisk  : * Device API level: 29
11-29 07:40:41.233  1737  1738 I Magisk  : ** post-fs-data mode running
11-29 07:40:41.233  1737  1741 E Magisk  : open: /cache/magisk.log failed with 30: Read-only file system
11-29 07:40:41.236  1737  1738 I Magisk  : * Initializing Magisk environment
11-29 07:40:41.241  1737  1738 I Magisk  : * Mounting mirrors
11-29 07:40:41.242  1737  1738 I Magisk  : mount: /sbin/.magisk/mirror/vendor
11-29 07:40:41.242  1737  1738 I Magisk  : mount: /sbin/.magisk/mirror/data
11-29 07:40:41.242  1737  1738 I Magisk  : link: /sbin/.magisk/mirror/system
11-29 07:40:41.242  1737  1738 I Magisk  : link: /sbin/.magisk/mirror/product
11-29 07:40:41.243  1737  1738 I Magisk  : * Setting up internal busybox
11-29 07:40:41.259  1737  1738 I Magisk  : * Running post-fs-data.d scripts
11-29 07:40:41.270  1737  1738 I Magisk  : * Running module post-fs-data scripts
11-29 07:40:41.271  1737  1738 I Magisk  : riru-core: exec [post-fs-data.sh]
11-29 07:40:41.318  1737  1738 I Magisk  : riru_edxposed_sandhook: exec [post-fs-data.sh]
11-29 07:40:41.450  1737  1738 I Magisk  : * Loading modules
11-29 07:40:41.450  1737  1738 I Magisk  : riru_edxposed_sandhook: loading [system.prop]
11-29 07:40:41.453  1737  1738 I Magisk  : hosts: constructing magic mount structure
11-29 07:40:41.454  1737  1738 I Magisk  : bind_mount: /system/etc/hosts
11-29 07:40:41.467  1737  1773 I Magisk  : * Starting MagiskHide
11-29 07:40:41.467  1737  1773 I Magisk  : hide_policy: Hiding sensitive props
11-29 07:40:41.471  1737  1773 I Magisk  : hide_list init: [com.google.android.gms/com.google.android.gms.unstable]
11-29 07:40:41.472  1737  1773 I Magisk  : hide_list init: [org.microg.gms.droidguard/com.google.android.gms.unstable]
11-29 07:40:42.858  1737  1912 I Magisk  : ** late_start service mode running
11-29 07:40:42.860  1737  1912 I Magisk  : * Running service.d scripts
11-29 07:40:42.860  1737  1912 I Magisk  : * Running module service scripts
11-29 07:40:46.178  2047  2047 I PackageManager: Un-granting permission android.permission.REQUEST_INSTALL_PACKAGES from package com.topjohnwu.magisk (protectionLevel=66 flags=0x3848be44)
11-29 07:40:48.269  2047  2047 I PackageManager: Un-granting permission android.permission.REQUEST_INSTALL_PACKAGES from package com.topjohnwu.magisk (protectionLevel=66 flags=0x38c8be44)
11-29 07:40:55.382  1737  2756 I Magisk  : ** boot_complete triggered
11-29 07:40:57.663  2047  2355 I ActivityManager: Start proc 2833:com.topjohnwu.magisk/u0a135 for broadcast {com.topjohnwu.magisk/a.h}
11-29 07:41:00.699  2833  2833 W opjohnwu.magis: resources.arsc in APK '/data/app/com.topjohnwu.magisk-OQ7Pr74qQIUkLbqX8CvvDw==/base.apk' is compressed.
11-29 07:41:10.955  1737  1773 I Magisk  : proc_monitor: [com.google.android.gms.unstable] PID=[3752] UID=[10106]
11-29 07:41:19.301  2047  4018 I ActivityManager: Killing 2833:com.topjohnwu.magisk/u0a135 (adj 985): empty #17
11-29 07:41:19.313  2766  2860 W gle.android.gm: resources.arsc in APK '/data/app/com.topjohnwu.magisk-OQ7Pr74qQIUkLbqX8CvvDw==/base.apk' is compressed.
11-29 07:41:30.334  2047  2075 I ActivityManager: Start proc 5180:com.topjohnwu.magisk/u0a135 for broadcast {com.topjohnwu.magisk/a.h}
11-29 07:41:30.450  5180  5180 W opjohnwu.magis: resources.arsc in APK '/data/app/com.topjohnwu.magisk-OQ7Pr74qQIUkLbqX8CvvDw==/base.apk' is compressed.
11-29 07:42:30.633  2047  2074 W BroadcastQueue: Receiver during timeout of BroadcastRecord{ec6954b u0 android.intent.action.REBOOT} : ResolveInfo{2f7156d com.topjohnwu.magisk/a.h m=0x108000}
11-29 07:42:30.897  2047  2074 E ActivityManager: ANR in com.topjohnwu.magisk
11-29 07:42:30.897  2047  2074 E ActivityManager: Reason: Broadcast of Intent { act=android.intent.action.REBOOT flg=0x400030 pkg=com.topjohnwu.magisk cmp=com.topjohnwu.magisk/a.h (has extras) }
11-29 07:42:30.897  2047  2074 E ActivityManager:   0.3% 1737/magiskd: 0% user + 0.3% kernel / faults: 418 minor
11-29 07:42:30.900  2047  2074 I ActivityManager: Killing 5180:com.topjohnwu.magisk/u0a135 (adj 0): bg anr
andronoob commented 4 years ago

Got original Xposed (Magisk module) on Android 7.0 AVD. I have decided to give up on this.

RedGinger7 commented 4 years ago

@andronoob Could you please tell us the steps how to install magisk on Android 7.0 AVD in android studio? I'm very interested to try this. I'm a newbie. So please kindly provide me steps to do or make a video of it? or share pics?

andronoob commented 4 years ago

@RedGinger7

Linux environment is needed.

First, decompress the ramdisk.img: gzip -d < ramdisk.img > ramdisk.cpio, and make a copy of it: cp ramdisk.cpio ramdisk.cpio.orig

Then, prepare a config file with the following content:

KEEPVERITY=false
KEEPFORCEENCRYPT=false
RECOVERYMODE=false

Then modify the ramdisk image with this command (it was splitted into multiple lines): https://github.com/topjohnwu/Magisk/blob/af060b313295ab7b0d23e9e816b97ed37ef03411/scripts/boot_patch.sh#L142-L147

After that, compress the modified ramdisk image with gzip -9 < ramdisk.cpio > ramdisk-modifed.img

Finally, replace the original ramdisk.img with the modified one.

andronoob commented 4 years ago

I don't remember the exact content of config file. If that didn't work, try replacing KEEPFORCEENCRYPT=false with KEEPFORCEENCRYPT=true

SoumyBhow commented 4 years ago

Is there an actual workaround/fix for this? I'm currently in the same situation: Android Studio AVD running android 10 x86-64 with Magisk 20.4 beta. I'm also trying to install and run Edxposed, but according to the Riru app, riru wasn't found in the memory. Any help is appreciated.

Swiffers commented 3 years ago

To install Magisk on the Emulator of Android Virtual Device (AVD) from the Android Studio suite, this can be done in a few seconds by using: https://github.com/shakalaca/MagiskOnEmulator. It works like a charm with Android 7.0 AVD.