Closed Uj947nXmRqV2nRaWshKtHzTvckUUpD closed 4 years ago
Just made a quick fix in https://github.com/shakalaca/MagiskOnEmulator/commit/dec6a82c06bc5c4a6bf255713ede52c8d7f0e15a , please try again with latest code :)
Am i doing something wrong? I am not sure if I followed step 2 correctly ("Clone this repository and copy the ramdisk.img to here.")
Now I get this error (I ran the bat as admin while avd was running and its ramdisk.img copied from C:\Users\
patch.bat ramdisk.img: 1 file pushed, 0 skipped. 342.2 MB/s (899609 bytes in 0.003s) magisk_emu.zip: 1 file pushed, 0 skipp... 462.5 MB/s (12863269 bytes in 0.027s) update-binary: 1 file pushed, 0 skipped. 413.9 MB/s (3527756 bytes in 0.008s) process.sh: 1 file pushed, 0 skipped. 1.4 MB/s (2317 bytes in 0.002s) : inaccessible or not found2]: : inaccessible or not found8]: ': Permission deniedtmp ': Permission deniedtmp : inaccessible or not found11]: : No such file or directory13]: cd: /data/local/tmp sh: update-binary: No such file or directory : inaccessible or not found15]: /data/local/tmp/process.sh[18]: ./busybox: inaccessible or not found /data/local/tmp/process.sh[19]: ./busybox: inaccessible or not found : inaccessible or not found21]: : inaccessible or not found24]: : inaccessible or not found25]: : inaccessible or not found26]: : inaccessible or not found27]: : inaccessible or not found28]: /data/local/tmp/process.sh[30]: ./busybox: inaccessible or not found /data/local/tmp/process.sh[31]: ./busybox: inaccessible or not found : inaccessible or not found32]: /': No such file or directory /common/': No such file or directory /chromeos': No such file or directory cp: bad './busybox': No such file or directory : inaccessible or not found37]: false : inaccessible or not found38]: : No such file or directory /magiskinit: inaccessible or not foundlocal/tmp : inaccessible or not found41]: : Read-only file system.sh[43]: can't create config : Read-only file system.sh[44]: can't create config /magiskboot: inaccessible or not foundlocal/tmp /magiskboot: inaccessible or not foundlocal/tmp /magiskboot: inaccessible or not foundlocal/tmp /data/local/tmp/process.sh[48]: ./busybox: inaccessible or not found .gz': No such file or directory : inaccessible or not found50]: /magisk.apkle to open file: /data/local/tmp Consider using a file under /data/local/tmp/ /magisk.apkt open file: /data/local/tmp
Exception occurred while executing: /magisk.apkllegalArgumentException: Error: Can't open file: /data/local/tmp at com.android.server.pm.PackageManagerShellCommand.setParamsSize(PackageManagerShellCommand.java:461) at com.android.server.pm.PackageManagerShellCommand.runInstall(PackageManagerShellCommand.java:1060) at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:169) at android.os.ShellCommand.exec(ShellCommand.java:104) at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:21729) at android.os.Binder.shellCommand(Binder.java:881) at android.os.Binder.onTransact(Binder.java:765) at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4860) at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4014) at android.os.Binder.execTransactInternal(Binder.java:1021) at android.os.Binder.execTransact(Binder.java:994) : inaccessible or not found54]: /data/local/tmp/process.sh[64]: syntax error: unmatched 'if' adb: error: failed to stat remote object '/data/local/tmp/ramdisk.img': No such file or directory
Now I get this error (I ran the bat as admin while avd was running and its ramdisk.img copied from C:\Users
\AppData\Local\Android\Sdk\system-images\android-29\google_apis\x86\ramdisk.img to where the patch.bat was cloned):
Yes this is correct.
you please grab me the output of adb shell "ls -l /data/local/tmp"
?
then execute the following commands:
adb shell
sh /data/local/tmp/process.sh /data/local/tmp
Please find below the output: Also note the strange ";" at the end of the duplicate magisk.zip and ramdisk.img.gz (maybe remnants of the first failed attempt?). Should i delete these?
PS > adb devices
List of devices attached
emulator-
PS > adb shell "ls -l /data/local/tmp" total 30372 -rw-rw-rw- 1 shell shell 2317 2020-06-06 17:11 ; -rw-rw-rw- 1 shell shell 12863269 2020-06-06 17:11 magisk.zip -rw-rw-rw- 1 shell shell 12863269 2020-06-06 17:11 magisk.zip; -rw-rw-rw- 1 shell shell 2317 2020-06-06 17:11 process.sh -rw-rw-rw- 1 shell shell 899609 2020-06-06 16:24 ramdisk.img.gz -rw-rw-rw- 1 shell shell 899609 2020-06-06 16:24 ramdisk.img.gz; -rw-rw-rw- 1 shell shell 3527756 2020-06-06 17:11 update-binary
PS > adb shell generic_x86:/ $ sh /data/local/tmp/process.sh /data/local/tmp : inaccessible or not found2]: : inaccessible or not found8]: ': Permission deniedtmp ': Permission deniedtmp : inaccessible or not found11]: : No such file or directory13]: cd: /data/local/tmp sh: update-binary: No such file or directory : inaccessible or not found15]: /data/local/tmp/process.sh[18]: ./busybox: inaccessible or not found /data/local/tmp/process.sh[19]: ./busybox: inaccessible or not found : inaccessible or not found21]: : inaccessible or not found24]: : inaccessible or not found25]: : inaccessible or not found26]: : inaccessible or not found27]: : inaccessible or not found28]: /data/local/tmp/process.sh[30]: ./busybox: inaccessible or not found /data/local/tmp/process.sh[31]: ./busybox: inaccessible or not found : inaccessible or not found32]: /': No such file or directory /common/': No such file or directory /chromeos': No such file or directory cp: bad './busybox': No such file or directory : inaccessible or not found37]: false : inaccessible or not found38]: : No such file or directory /magiskinit: inaccessible or not foundlocal/tmp : inaccessible or not found41]: : Read-only file system.sh[43]: can't create config : Read-only file system.sh[44]: can't create config /magiskboot: inaccessible or not foundlocal/tmp /magiskboot: inaccessible or not foundlocal/tmp /magiskboot: inaccessible or not foundlocal/tmp /data/local/tmp/process.sh[48]: ./busybox: inaccessible or not found .gz': No such file or directory : inaccessible or not found50]: /magisk.apkle to open file: /data/local/tmp Consider using a file under /data/local/tmp/ /magisk.apkt open file: /data/local/tmp
Exception occurred while executing: /magisk.apkllegalArgumentException: Error: Can't open file: /data/local/tmp at com.android.server.pm.PackageManagerShellCommand.setParamsSize(PackageManagerShellCommand.java:461) at com.android.server.pm.PackageManagerShellCommand.runInstall(PackageManagerShellCommand.java:1060) at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:169) at android.os.ShellCommand.exec(ShellCommand.java:104) at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:21729) at android.os.Binder.shellCommand(Binder.java:881) at android.os.Binder.onTransact(Binder.java:765) at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4860) at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4014) at android.os.Binder.execTransactInternal(Binder.java:1021) at android.os.Binder.execTransact(Binder.java:994) : inaccessible or not found54]: /data/local/tmp/process.sh[64]: syntax error: unmatched 'if'
I tried running the patch on a newly created avd, and get similar error.
PS > adb devices
List of devices attached
emulator-
PS > adb shell "ls -l /data/local/tmp" total 0
PS > .\patch.bat ramdisk.img: 1 file pushed, 0 skipped. 288.8 MB/s (899609 bytes in 0.003s) magisk_emu.zip: 1 file pushed, 0 skipped. 365.4 MB/s (12863269 bytes in 0.034s) update-binary: 1 file pushed, 0 skipped. 413.6 MB/s (3527756 bytes in 0.008s) process.sh: 1 file pushed, 0 skipped. 2.7 MB/s (2317 bytes in 0.001s) : inaccessible or not found2]: : inaccessible or not found8]: ': Permission deniedtmp ': Permission deniedtmp : inaccessible or not found11]: : No such file or directory13]: cd: /data/local/tmp sh: update-binary: No such file or directory : inaccessible or not found15]: /data/local/tmp/process.sh[18]: ./busybox: inaccessible or not found /data/local/tmp/process.sh[19]: ./busybox: inaccessible or not found : inaccessible or not found21]: : inaccessible or not found24]: : inaccessible or not found25]: : inaccessible or not found26]: : inaccessible or not found27]: : inaccessible or not found28]: /data/local/tmp/process.sh[30]: ./busybox: inaccessible or not found /data/local/tmp/process.sh[31]: ./busybox: inaccessible or not found : inaccessible or not found32]: /': No such file or directory /common/': No such file or directory /chromeos': No such file or directory cp: bad './busybox': No such file or directory : inaccessible or not found37]: false : inaccessible or not found38]: : No such file or directory /magiskinit: inaccessible or not foundlocal/tmp : inaccessible or not found41]: : Read-only file system.sh[43]: can't create config : Read-only file system.sh[44]: can't create config /magiskboot: inaccessible or not foundlocal/tmp /magiskboot: inaccessible or not foundlocal/tmp /magiskboot: inaccessible or not foundlocal/tmp /data/local/tmp/process.sh[48]: ./busybox: inaccessible or not found .gz': No such file or directory : inaccessible or not found50]: /magisk.apkle to open file: /data/local/tmp Consider using a file under /data/local/tmp/ /magisk.apkt open file: /data/local/tmp
Exception occurred while executing: /magisk.apkllegalArgumentException: Error: Can't open file: /data/local/tmp at com.android.server.pm.PackageManagerShellCommand.setParamsSize(PackageManagerShellCommand.java:461) at com.android.server.pm.PackageManagerShellCommand.runInstall(PackageManagerShellCommand.java:1060) at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:169) at android.os.ShellCommand.exec(ShellCommand.java:104) at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:21729) at android.os.Binder.shellCommand(Binder.java:881) at android.os.Binder.onTransact(Binder.java:765) at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4860) at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4014) at android.os.Binder.execTransactInternal(Binder.java:1021) at android.os.Binder.execTransact(Binder.java:994) : inaccessible or not found54]: /data/local/tmp/process.sh[64]: syntax error: unmatched 'if' adb: error: failed to stat remote object '/data/local/tmp/ramdisk.img': No such file or directory PS > adb shell "ls -l /data/local/tmp" total 16912 -rw-rw-rw- 1 shell shell 12863269 2020-06-06 17:11 magisk.zip -rw-rw-rw- 1 shell shell 2317 2020-06-06 17:11 process.sh -rw-rw-rw- 1 shell shell 899609 2020-06-06 16:24 ramdisk.img.gz -rw-rw-rw- 1 shell shell 3527756 2020-06-06 17:11 update-binary
This error gets my attentions "adb: error: failed to stat remote object '/data/local/tmp/ramdisk.img': No such file or directory"
so this line is pushing as gz even if there is no ramdisk.img on my tmp folder (because it was not extracted)
adb -e push ramdisk.img /data/local/tmp/ramdisk.img.gz
looking in process.sh why the gz was not decompressed, it looks obvious that i do not have busybox but it should be installed..
"/data/local/tmp/process.sh[18]: ./busybox: inaccessible or not found"
What if you :
adb shell
cd /data/local/tmp; sh ./update-binary -x
busybox
should be extracted from update-binary
after above lines.
BTW did you sync this repo ? I've upload the fix
yes i synced it
Eventually i figured it out..the process.sh script is being pushed as windows-style line ending as seen from emulator side:
generic_x86:/data/local/tmp $ cat -vet process.sh
....
The fix is to convert it to unix format just before execution inside the patch.bat: ... adb -e shell "dos2unix /data/local/tmp/process.sh" adb -e shell "sh /data/local/tmp/process.sh /data/local/tmp" ...
PS: i am not allowed to create a pull request with the fix. I think you need to tweak the repo permissions
The script is in unix-format on github, maybe your git client changed the format ?
Indeed... I used GitHub Desktop (the gui one) and it seem to mess with the line ending.
Also tried now with git-scm (https://git-scm.com/) and I get same issue.
The only way that worked out of the box was through cygwin + git (since it is a linux like environment and the extra ^M CR+LF character is not being added at the end of the lines)
My recommendation is to add the dos2unix line just to make sure that the format is right without any other extra configurations of git from user side.
Exception occurred while executing: /magisk.apkllegalArgumentException: Error: Can't open file: /data/local/tmp at com.android.server.pm.PackageManagerShellCommand.setParamsSize(PackageManagerShellCommand.java:461) at com.android.server.pm.PackageManagerShellCommand.runInstall(PackageManagerShellCommand.java:1060) at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:169) at android.os.ShellCommand.exec(ShellCommand.java:104) at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:21729) at android.os.Binder.shellCommand(Binder.java:881) at android.os.Binder.onTransact(Binder.java:765) at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4860) at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4014) at android.os.Binder.execTransactInternal(Binder.java:1021) at android.os.Binder.execTransact(Binder.java:994) : inaccessible or not found54]: /data/local/tmp/process.sh[64]: syntax error: unmatched 'if' adb: error: failed to stat remote object '/data/local/tmp/ramdisk.img;': No such file or directory
SPECS:
Android Studio 4 Name: Pixel_3_XL_API_29 CPU/ABI: Google APIs Intel Atom (x86) Path: C:\Users\.android\avd\Pixel_3_XL_API_29.avd
Target: google_apis [Google APIs] (API level 29)
Skin: pixel_3_xl
SD Card: 2G
fastboot.chosenSnapshotFile:
runtime.network.speed: full
hw.accelerometer: yes
hw.device.name: pixel_3_xl
hw.lcd.width: 1440
hw.initialOrientation: Portrait
image.androidVersion.api: 29
tag.id: google_apis
hw.mainKeys: no
hw.camera.front: emulated
avd.ini.displayname: Pixel 3 XL API 29
hw.gpu.mode: host
hw.ramSize: 3072
PlayStore.enabled: false
fastboot.forceColdBoot: no
hw.cpu.ncore: 4
hw.keyboard: yes
hw.sensors.proximity: yes
hw.dPad: no
hw.lcd.height: 2960
vm.heapSize: 1024
skin.dynamic: yes
hw.device.manufacturer: Google
hw.gps: yes
hw.audioInput: yes
image.sysdir.1: system-images\android-29\google_apis\x86\
showDeviceFrame: yes
hw.camera.back: virtualscene
AvdId: Pixel_3_XL_API_29
hw.lcd.density: 560
hw.arc: false
hw.device.hash2: MD5:
fastboot.forceChosenSnapshotBoot: no
fastboot.forceFastBoot: yes
hw.trackBall: no
hw.battery: yes
hw.sdCard: yes
tag.display: Google APIs
runtime.network.latency: none
disk.dataPartition.size: 5G
hw.sensors.orientation: yes
avd.ini.encoding: UTF-8
hw.gpu.enabled: yes