Skip to content

Instantly share code, notes, and snippets.

@alsanchez
Created November 23, 2015 09:42
Show Gist options
  • Save alsanchez/2ebb6a066721bc67c5c8 to your computer and use it in GitHub Desktop.
Save alsanchez/2ebb6a066721bc67c5c8 to your computer and use it in GitHub Desktop.
Install busybox on the x86 Android emulator
#!/bin/bash
wget "http://www.busybox.net/downloads/binaries/latest/busybox-i486" -O /tmp/busybox
adb push /tmp/busybox /data/data/busybox
adb shell "mount -o remount,rw /system && mv /data/data/busybox /system/bin/busybox && chmod 755 /system/bin/busybox && /system/bin/busybox --install /system/bin"
@Rodrirokr
Copy link

Rodrirokr commented Mar 18, 2019

The current busybox installer is inside .../busybox/ so I made a few modifications to make it work.

#!/bin/bash
wget --no-parent --no-host-directories --cut-dirs 3 -r https://busybox.net/downloads/binaries/1.30.0-i686/ -P /tmp/busybox
adb push /tmp/busybox /data/data/busybox
adb shell "mount -o rw,remount /system && mv /data/data/busybox /system/bin/busybox && chmod 755 /system/bin/busybox/busybox && /system/bin/busybox/busybox --install /system/bin"

@techcaotri
Copy link

techcaotri commented Aug 8, 2019

with the current Android emulator, you have to start the emulator with "-writable-system" in order to remount and make modifications to the system folder. e.g.:
emulator -avd "Pixel_2_XL_API_27" -writable-system

@eggerand13
Copy link

The current busybox installer is inside .../busybox/ so I made a few modifications to make it work.

#!/bin/bash
wget --no-parent --no-host-directories --cut-dirs 3 -r https://busybox.net/downloads/binaries/1.30.0-i686/ -P /tmp/busybox
adb push /tmp/busybox /data/data/busybox
adb shell "mount -o rw,remount /system && mv /data/data/busybox /system/bin/busybox && chmod 755 /system/bin/busybox/busybox && /system/bin/busybox/busybox --install /system/bin"

Could it be that you have an error in the path of the last command?
As far as I see it (and successfully tried it) it should be:

adb shell "mount -o rw,remount /system && mv /data/data/busybox /system/bin/busybox && chmod 755 /system/bin/busybox && /system/bin/busybox --install /system/bin"

@jmkolbe
Copy link

jmkolbe commented Sep 3, 2021

I could not remount /system on an API 30 emulator. disable-verity left me with a non-bootable emulator. Instead of trying to fix it I tried using an API 25 emulator, without running into that issue.

If you need to run on a later API level, perhaps https://android.stackexchange.com/questions/186630/android-o-failed-to-mount-system-dev-block-dm-0-is-read-only helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment