title: Android Remount /system date: 2021-01-13 categories: [cheatsheets]
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
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.
Boot into Recovery Mode
adb reboot recovery
Go to Mount and check "System"
Make sure that "mount read-only" is not checked.
Get an ADB Shell (works in recovery mode too)
Use ADB to change files (eg. /system/etc/hosts)
adb shell 'echo "<ip> <hostname>" >> /system/etc/hosts'
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