2

I have android marshmallow running in an emulator and I executed the following commands:

adb root
adb mount -o remount,rw /system
adb push file /system/file

and the output is

adb: error: failed to copy 'file' to '/system/file': Read-only file system

the weird thing is, before remounting the system partition is mounted as

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

and after remounting it is mounted as

/dev/block/vda /system ext4 rw,seclabel,relatime,data=ordered 0 0

which seems to be read/writeable. after pushing it is

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

again. Even weirder, the system seems to be writable once:

root@generic_x86:/system # mount | grep system                                 
/dev/block/vda /system ext4 rw,seclabel,relatime,data=ordered 0 0
root@generic_x86:/system # touch foo
root@generic_x86:/system # touch foo2                                          
touch: 'foo2': Read-only file system
root@generic_x86:/system # mount | grep system                               
/dev/block/vda /system ext4 ro,seclabel,relatime,data=ordered 0 0

root@generic_x86:/system # ls -la foo*                                          
-rw-rw-rw- root     root            0 2016-09-07 15:50 foo

After that i have to restart the device because the system partition can not be remounted again.

Simiil
  • 2,281
  • 1
  • 22
  • 32
  • Hello Simiil, any luck with a solution to this? I'm facing the exact problem. In my case I have replaced the system.img, userdata.img and ramdisk.img with Android M images I have built. – santosh Oct 07 '16 at 06:46
  • No, not yet. I'm running a completely unmodified android. My solution for now is to just modify one thing per reboot – Simiil Oct 07 '16 at 10:41
  • Potentially similar issue with a solution: http://stackoverflow.com/questions/36670592/cannot-change-android-system-directory-to-rw – Ishamael Feb 16 '17 at 16:45

2 Answers2

2

Noticed from dmesg logs that my emulator was using the Ranchu.fstab (can be found @ android-studio/sdk/system-images/android-23/google_apis/x86) and not the goldfish.fstab. So, in the SDK folder of my Android Studio (version 2.2) moved the "kernel-ranchu" file elsewhere.

With this change, when I run the emulator again (wipe the emulator data), the system partition stays "rw" and doesn't change back to "ro".

The reason I tried this was because of IO errors that I saw in the dmesg logs while running the emulator. By not using the ranchu fstab, the partition names change from /dev/block/vda to /dev/block/mtd0 and so on.

I am not sure what the root cause of the problem is, but forcing the emulator to not pick the ranchu.fstab seems to have helped.

santosh
  • 112
  • 4
1

Instead you should execute:

$ adb remount

From man adb:

adb remount
Remount the /system, /vendor (if present) and /oem (if present) partitions on the device read-write

Bayou
  • 3,293
  • 1
  • 9
  • 22