11

I am trying to remount the /system as a rw file system so I can push some files into /system/framework. It is an android emulator running Android 6.0 x86 image.

$ mount
...
/dev/block/vda /system ext4 ro,seclabel,relatime,data=ordered 0 0
...

Then I do

su
mount -o rw,remount /system
mount
...
    /dev/block/vda /system ext4 rw,seclabel,relatime,data=ordered 0 0
...

At this time I am thinking I am ok. Then I am doing on host:

adb push test.jar /system/framework/

However I see:

failed to copy 'test.jar' to '/system/framework/test.jar': Read-only file system

Then I go back to adb:

mount
...
    /dev/block/vda /system ext4 ro,seclabel,relatime,data=ordered 0 0
...

It goes back to ro again.

When I trying to do remount again, it doesn't even let me do it this time:

mount: Read-only file system
255|root@generic_x86:/ # 

So where I am doing wrong? Thanks!

___ Edit____

restarting adbd as root via adb root command solves my issue.

darklord
  • 5,077
  • 12
  • 40
  • 65
  • have you tried http://www.bradcurtis.com/hosts-files-and-the-google-android-emulator/ ? I'm not sure if the command `adb remount` still works so I don't put it as answer yet – pzmarzly Apr 16 '16 at 22:43
  • @PawełZmarzły No it doesn't work. The save behavior as my approach. It changes to rw after I do adb remount. However when I actually write something to /system it throws error and change back to ro – darklord Apr 16 '16 at 22:49
  • @darklord Did you figured out how to push the files? I am also getting the same issue when update my sdk tools – Satya May 18 '16 at 10:55
  • @Satya I didn't but it should have to do with the selinux introduced in recent android releases. (See android doc for this) I can make it work on Android 4.2 though. – darklord May 18 '16 at 15:22
  • @darklord I am able to push in Android 6.0, but when I update the build tools to 25 version then I am getting this error. Tried many ways but failed – Satya May 19 '16 at 05:43
  • Identical Super User post by same user: ["How to remount /system on android device as rw?"](http://superuser.com/questions/1066329/how-to-remount-system-on-android-device-as-rw) – unforgettableidSupportsMonica Jul 14 '16 at 19:50

3 Answers3

25

based on @raed-hosny answer I solve the problem with

$ emulator -writable-system -netdelay none -netspeed full -avd Nexus_5X_API_25

In your log you will have something like this

sh: 1: glxinfo: not found emulator: WARNING: System image is writable sh: 1: glxinfo: not found emulator: Listening for console connections on port: 5554 emulator: Serial number of this emulator (for ADB): emulator-5554

JFouad
  • 551
  • 6
  • 12
14

try to start emulator from terminal using -writable-system so you can mount /system as writable in the old way

raed hosny
  • 179
  • 1
  • 6
  • 5
    could you please give exact command? writable-system is an argument to what? mount command or adb? – user13107 Nov 24 '16 at 09:22
  • @user13107 he is referring to the executable at sdk/tools/emulator – Merk Jul 17 '17 at 22:23
  • To answer to user13107's question: `emulator -writable-system -netdelay none -netspeed full -avd THE_NAME_OF_YOUR_EMULATOR` – SudoPlz Jan 14 '21 at 19:30
0

The other answer was close for me, but was missing some steps. You have to first start the server if it's not already running:

adb start-server
emulator -writable-system -avd Pixel_2_API_24

Then you can mount as writable:

adb root
adb remount

https://docs.mitmproxy.org/stable/howto-install-system-trusted-ca-android

halfer
  • 19,824
  • 17
  • 99
  • 186
Zombo
  • 1
  • 62
  • 391
  • 407