0

I am trying to remount the /system partition from a shell, and tried both commands suggested in this post, but it does not work. Here are the script commands I am issuing:

adb shell mount | grep -e "system"
echo
adb shell "su -c 'adb shell mount -o rw,remount /system'"
echo
adb shell mount | grep -e "system"
echo

I get:

/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,seclabel,relatime,data=ordered 0 0

error: device not found

/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,seclabel,relatime,data=ordered 0 0

@Bo Lawson- I tried the command you suggested. Here are the relevant lines from my script; /system remains in ro.

adb shell mount | grep -e "system"

echo
adb shell su -c mount -o remount,rw /system
echo
adb shell mount | grep -e "system"
echo

Here is the output...

sansari@ubuntu:~$ ./module_script 
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,seclabel,relatime,data=ordered 0 0


/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,seclabel,relatime,data=ordered 0 0

@Bo Lawson - Thanks. You are absolutely right. I got the result I wanted. No explanation is necessary; I am just grateful for your help.

user3326293
  • 109
  • 1
  • 1
  • 4
  • You do not need to repeat adb shell. So it would look like adb shell su -c mount -o remount,rw /system – Bo Lawson Oct 03 '15 at 23:17
  • What about mounting the system partition directly mount -o rw,remount /dev/block/platform/msm_sdcc.1/by-name/system /system – Bo Lawson Oct 04 '15 at 02:24
  • I had tried the latest command you suggested before; I tried it again just now and do not get write access. I assume I can see all the replies from the prompt regardless of successful execution or not? What I am asking is if there is an option to print more verbose feedback maybe we can figure out what is wrong with the command(s) we issue. As it is, nothing prints to the screen. – user3326293 Oct 04 '15 at 19:12
  • After the mount command if you put (without [ ]) [ echo $? ] it will give you the return code of the previous command. That will let you know if it was a success or failure. As far as logs and good to know how to do this will put a verbose logcat on your desktop Linux [ adb logcat -v long > ~/Desktop/logcat.txt ] – Bo Lawson Oct 04 '15 at 21:48
  • In the logcat I see: [ 10-04 21:48:37.116 13281:13281 E/MTPRx ] Status for mount/Unmount :unmountable. Isn't it strange that I can log in and mount it rw, but from the shell I have issue? – user3326293 Oct 05 '15 at 02:54
  • The echo $? just generates a zero. I am not sure what to make of it. All I see is "0" without the "s. – user3326293 Oct 05 '15 at 02:55
  • A status code returns 0 that equals successful other numbers it's a failure with reason. I am no allstar and learning too to get things to work i start super simple with each command on its own line to get it to work then improve from there. [ adb shell ] [ mount | grep -e system ] [ echo ] [ su ] [ mount -o rw,remount /system ] [ echo ] [ mount | grep -e system ] [ echo ] – Bo Lawson Oct 05 '15 at 05:26
  • I agree with your strategy, and was about to do it. I logged into the file and started to type. However, in this case, I am not sure how much this would benefit me. I already know I can grep the result of mount as I see it on the screen. The only part I have trouble with is the remount, and that can not be broken down any smaller. – user3326293 Oct 05 '15 at 12:47
  • When the first grep is requested it is without elevated privileges $. Then the a single command is thrown with su for the mount but only for that command. Since it was not called on individually it does not stay so you are achieving the RW mount hence the 0. Then the second grep is called on from a $ non elevated privileges it returns RO because root is needed for the RW. If you grep from the # elevated privileges it should show RW. Sorry I should have caught that one earlier. – Bo Lawson Oct 05 '15 at 18:39
  • It worked! Thank you. /dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,seclabel,relatime,data=ordered 0 0

    0 /dev/block/platform/msm_sdcc.1/by-name/system /system ext4 rw,seclabel,relatime,data=ordered 0 0

    – user3326293 Oct 08 '15 at 16:53

0 Answers0