android-remount-rw-alternative.md 1.4 KB


title: Android Remount /system date: 2021-01-13 categories: [cheatsheets]

tags: [mobile]

Remounting /system to rw

  • A rooted Phone is needed for all methods

Default Method

Connect to the phone via ADB and remount the partition.

adb shell
> mount -o rw,remount /system

# make changes to the filesystem (e.g. changin /system/etc/hosts)
> mount -o ro,remount /system

Alternative

This methods works if the above one is not working. This could be the case if your on a production build, where adb root cannot be used.

  1. Boot into Recovery Mode

    adb reboot recovery
    
  2. Go to Mount and check "System"

  3. Make sure that "mount read-only" is not checked.

  4. Get an ADB Shell (works in recovery mode too)

  5. Use ADB to change files (eg. /system/etc/hosts)

    adb shell 'echo "<ip> <hostname>" >> /system/etc/hosts'
    

Running in an emulator

When using the android studio emulator, and none of the above methods is working, you can start the AVD (Android Virtual Device) with the -writable-system flag.

Therefore, search for the AVD (probaby located in ~/.android/avd// and change the emu-launch-params.txt file.

Or start the emulator directly with that flag:

emulator -netdelay none -netspeed full  -avd <avd-name> -writable-system

You can list all available AVDs with:

emulator -list-avds