title: Remount /system from app
body: <p>I am trying to create a small application, that needs read/write access on the /system folder (it is trying to remove a file, and create a new one instead of it).
  I am able to remount the folder without a problem with adb, and if I do it, certainly my app works fine until the reboot.</p>
  
  <p>My device is rooted (sgs3 with stock 4.1.2). I can acquire root access without a problem - i get the pop up message where i can enable it. But after that it does not really respond to commands.</p>
  
  <p>I have something like this:</p>
  
  <pre><code>//at this point I get the popup to grant root access
  Runtime.getRuntime().exec("su");
  
  //no error messages - not on console, not in logcat
  Runtime.getRuntime().exec("mount -w -o remount -t ext4 /dev/block/mmcblk0p9 /system");
  
  //trying to do things in the system folder...
  FileWriter fw=new FileWriter(file);
  fw.write("a");
  fw.close();
  
  //trying to remount the folder as read only only once everything is done
  Runtime.getRuntime().exec("mount -r -o remount -t ext4 /dev/block/mmcblk0p9 /system");
  </code></pre>
  
  <p>If I run the same remounting command from adb shell, everything is perfect. If I don't run it, but try to rely on the app, I get the following error message (IOException thrown) when I try to write/delete from the file system:</p>
  
  <pre><code>open failed: EROFS (read-only file system)
  </code></pre>
  
  <p>Some additional info: I am using 2.2 SDK, have WRITE_EXTERNAL_STORAGE permission in my manifest file (although I am not sure if I need it, since I am trying to use the internal storage).</p>
  
  <p>All ideas are welcome.</p>