Thursday, July 16, 2015

4.4 kitkat - It's there a way to get /system partition permanent read/write access even after reboot?


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!



Answer



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.



No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...