shakalaca / MagiskOnEmulator

Install Magisk on Official Android Emulator
Apache License 2.0
671 stars 113 forks source link

Error: /system/xbin/su: invalid uid/gid '-c' #53

Closed ArnoldVadiyants closed 2 years ago

ArnoldVadiyants commented 2 years ago

Hi, I did everything as described, but magisk isn't patched correctly to me. From the patching logs I see this line: /system/xbin/su: invalid uid/gid '-c'

Here are the logs: $ ./patch.sh

ramdisk.img: 1 file pushed, 0 skipped. 608.2 MB/s (1271629 bytes in 0.002s)
magisk.apk: 1 file pushed, 0 skipped. 292.9 MB/s (6874374 bytes in 0.022s)
busybox: 1 file pushed, 0 skipped. 350.9 MB/s (2074240 bytes in 0.006s)
process.sh: 1 file pushed, 0 skipped. 10.5 MB/s (11525 bytes in 0.001s)
[*] Checking Android version
[*] Unzipping Magisk ..
[*] New Magisk packaging format detected ..
[*] Checking ramdisk status ..
[-] Magisk patched boot image detected
[*] Patching ramdisk ..

Loading cpio: [/data/local/tmp/ramdisk.img]
Add entry [init] (0750)
Create directory [overlay.d] (0750)
Create directory [overlay.d/sbin] (0750)
Add entry [overlay.d/sbin/magisk32.xz] (0644)
Add entry [overlay.d/sbin/magisk64.xz] (0644)
Patch with flag KEEPVERITY=[false] KEEPFORCEENCRYPT=[true]
Found fstab file [fstab.ranchu]
Remove pattern [,avb=vbmeta]
Loading cpio: [/data/local/tmp/ramdisk.img.orig]
Backup mismatch entry: [fstab.ranchu] -> [.backup/fstab.ranchu]
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/magisk32.xz] -> [.backup/.rmlist]
Record new entry: [overlay.d/sbin/magisk64.xz] -> [.backup/.rmlist]
Create directory [.backup] (0000)
Add entry [.backup/.magisk] (0000)
Dump cpio: [/data/local/tmp/ramdisk.img]
[*] Done patching, compressing ramdisk ..
[*] Installing MagiskManager ..
/system/xbin/su: invalid uid/gid '-c'
[*] Installing su binaries ..
mkdir: '/data/user_de/0/com.topjohnwu.magisk/install/': File exists
total 3520
-rwxr-xr-x 1 root root    3530 2022-01-12 23:48 addon.d.sh
-rwxr-xr-x 1 root root    5429 2022-01-12 23:48 boot_patch.sh
-rwxr-xr-x 1 root root 2082432 2022-01-12 23:48 busybox
drwxr-xr-x 2 root root    4096 2022-01-12 23:44 chromeos
-rwxr-xr-x 1 root root  161524 2022-01-12 23:48 magisk32
-rw-rw-rw- 1 root root   62348 2022-01-12 23:48 magisk32.xz
-rwxr-xr-x 1 root root  170432 2022-01-12 23:48 magisk64
-rw-rw-rw- 1 root root   64448 2022-01-12 23:48 magisk64.xz
-rwxr-xr-x 1 root root  448172 2022-01-12 23:48 magiskboot
-rwxr-xr-x 1 root root  502956 2022-01-12 23:48 magiskinit
-rwxr-xr-x 1 root root    4753 2022-01-12 23:48 uninstaller.sh
-rwxr-xr-x 1 root root   22289 2022-01-12 23:48 util_functions.sh
[*] Clean up
/data/local/tmp/ramdisk.img: 1 file pulled, 0 skipped. 130.2 MB/s (1271629 bytes in 0.009s)

After replacing the updated ramdisk.img inside sdk directory and rebooting device I don't see that the emulator is rooted by magisk.

Reproduced for Pixel 3 API 30, Pixel 3 API 29 (Google APis) emulators.

Any ideas how to resolve it?

Screenshot 2022-01-13 at 00 01 22
ArnoldVadiyants commented 2 years ago

Sorry, I figured out with the problem. Just need to run adb root before running the patch script.