3

tl;dr

  • I mount system rw
  • I try to copy/update/write /system/xposed.prop
  • System is auto-remounted ro, causing the write to fail (applicable to a variety of workarounds)
  • Moving/renaming/deleting files causes them to resurrect after a umount/mount cycle, but only for some files.

Environment: TWRP 3.0.0-1 shamu, using Android Debug Bridge version 1.0.32.

Also attempted with a 2.x version of TWRP and ADB 1.0.31. Recovery is freshly installed. Problematic write commands include shell redirection (>), cp, mv. This is reproducible on my device whether I use mount, /sbin/mount, or busybox mount.

For reference (state of desired file BEFORE update):

~ # ls -l /system/xposed.prop
-rw-r--r--    1 root     root            65 Feb 29 04:17 /system/xposed.prop

From adb shell

/system appears to be mounted correctly

/system # mount
...
/dev/block/mmcblk0p41 on /system type ext4 (rw,seclabel,relatime,data=ordered)

Some sanity testing

/system # touch a
/system # ls a
a
/system # rm a
/system # ls a
ls: a: No such file or directory

Ok, copy a file (xposed.prop) to /system

/system # cat /data/media/0/xposed-v80-sdk22-arm/system/xposed.prop > /system/xposed.prop
/system # cat: write error: Read-only file system

How peculiar.

/system # mount
...
/dev/block/mmcblk0p41 on /system type ext4 (ro,seclabel,relatime,data=ordered)

Somehow /system got remounted ro?

/system # cd /
~ # mount -o remount,rw /system
~ # mount
...
/dev/block/mmcblk0p41 on /system type ext4 (ro,seclabel,relatime,data=ordered)
~ # mount -o rw,remount /dev/block/mmcblk0p41 /system
~ # mount
/dev/block/mmcblk0p41 on /system type ext4 (ro,seclabel,relatime,data=ordered)

Well, remount doesn't seem to work.

From another shell on my workstation {

$ adb root
adbd is already running as root
$ adb remount
remount of system failed: Read-only file system
remount of vendor failed: Read-only file system
remount failed

}

Helpful.

Back to adb shell

~ # umount /system
~ # mount
...
~ # mount -o rw /dev/block/mmcblk0p41 /system
~ # mount
...
/dev/block/mmcblk0p41 on /system type ext4 (rw,seclabel,relatime,data=ordered)

Ok looks remounted. Let's try this again.

~ # cat /data/media/0/xposed-v80-sdk22-arm/system/xposed.prop > /system/xposed.prop
cat: write error: Read-only file system

... sigh

~ # umount /system
~ # mount -o rw /system

More [in]sanity testing

~ # touch system/a
~ # ls -l /system/a
-rw-rw-rw-    1 root     root             0 Feb 29 04:18 /system/a
~ # umount /system && mount -o rw /system
~ # ls -l /system/a
-rw-rw-rw-    1 root     root             0 Feb 29 04:18 /system/a

Ok. Let's try going the long way around

~ # cat /data/media/0/xposed-v80-sdk22-arm/system/xposed.prop > /system/a
~ # ls -l /system/a
-rw-rw-rw-    1 root     root            40 Feb 29 04:27 /system/a

Looks like the data got written.

~ # mv /system/a /system/xposed.prop
~ # ls -l /system/a
ls: /system/a: No such file or directory
~ # ls -l /system/xposed.prop
-rw-rw-rw-    1 root     root             0 Feb 29 04:18 xposed.prop

0 bytes??

~ # umount /system && mount -o rw /system
~ # ls -l /system/a
-rw-rw-rw-    1 root     root             0 Feb 29 04:18 a
~ # ls -l /system/xposed.prop
-rw-r--r--    1 root     root            65 Feb 29 04:17 xposed.prop

And now my files are zombies, reanimating from the dead.

~ # rm /system/a
~ # umount /system && mount -o rw /system
~ # ls -l /system/a
ls: /system/a: No such file or directory

Ok, I have no idea what's going on now.

Anyone seen anything like this before? I'm suspecting some weird kernel stuff is happening, but this should be stock/default Nexus 6 Android kernel.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.