1

I used ADB.exe to get access to my System partition, I linked the dalvik-cache folder there to save space on my data partition, but the problem is I need to convert it read/write everytime I want to install a new app (or even if the old app wants to update), is there a way to make the partition always read/write instead read-only? Thanks!

6
  • I reckon that needs to be done on a kernel level...
    – Andy Yan
    Commented Apr 28, 2017 at 23:43
  • That means I need a custom kernel, right? My device doesn't have development of a custom kernel... thanks for your answer!
    – GABO
    Commented Apr 28, 2017 at 23:46
  • Not even most custom kernels would do it (not really useful unless under certain situations like yours). I think you could look up init.d and have a init.d script that do the remount job on reboot for you. Can't really guarantee it will work though - I've seldom had luck executing init.d scripts that requires su.
    – Andy Yan
    Commented Apr 29, 2017 at 0:00
  • @AndyYan A custom kernel with init.d support is unnecessary. I'll post an answer soon.
    – iBug
    Commented Apr 29, 2017 at 0:36
  • 2
    I want to add also, that auto RW mount is a huge security flaw.
    – Suncatcher
    Commented Apr 29, 2017 at 5:57

1 Answer 1

5

You don't need to make /system permanently R/W. You just need to mount it as R/W at every boot. So I'm providing you with a few options to mount /system as R/W at boot automatically, but do note that these methods mount /system as R/W in master mount namespace, which means ALL programs can write to it as long as file permission is right. This creates a severely huge security flaw. Do it at your own risk.
The following options are not steps of a single method, but different approaches.

  1. If you can modify your boot image, then editing /init.rc is the best and easiest way.
  2. If you can't modify /boot directly, but init.d is availble, you can write a simple script to mount /system as R/W. As is mentioned in comments, it may not go right through if you try to call su from an init.d script.
  3. If both 1 and 2 is unavailable and you have root (I suppose you do by asking this question), replace a system service (debuggerd is the best choice) binary with a custom shell script. Then run start debuggerd to activate it (effective from next boot).

The script required by method 2 and 3 is very simple, like below.

#!/system/bin/sh
/system/bin/mount -o rw,remount /system

You probably would like to add a sleep loop after it if you use method 3, as whenever debuggerd exits, it will be restarted.

BTW, you can easily add init.d support by yourself with method 3. Just take a glance at this. However in my opinion, re-partitioning is the best way to utilize free space /system, yet it's potentially harmful.

1
  • 1
    Method 3 seems conceived by a malware writer. I like it. +1.
    – Grimoire
    Commented Apr 29, 2017 at 13:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .