31

For info

adb remount 

returns "remount failed: Operation not permitted"

adb shell 'su -c  mount -o rw,remount /system'

returns unknown option -- o

My device is rooted.

Giacomo1968
  • 25,759
  • 11
  • 71
  • 103
Andrew
  • 411
  • 1
  • 5
  • 6
  • This is not answerable in the general case. Android's mount command is atypical and the exact details of what invocation it needs (often a specific device file as well as mount point) are device/version specific. Further, it's quite likely that the -o is not being passed through to the mount command, but processed as an argument to su. – Chris Stratton Jan 19 '15 at 05:01
  • From reading other posts, it seem that it cannot necessarilty be done. "your boot.img or kernel needs to be changed to allow it. Are you stock and rooted? If so, try a custom rom". I will let you know if I find a workaround. – Andrew Jan 20 '15 at 13:42
  • That's a distinct issue, that the hardware might be enforcing write protection below filesystem level. – Chris Stratton Jan 20 '15 at 13:59
  • 1
    Possible duplicate of [adb remount permission denied, but able to access super user in shell -- android](http://stackoverflow.com/questions/13089694/adb-remount-permission-denied-but-able-to-access-super-user-in-shell-android) – bummi Jan 31 '16 at 07:30
  • since android 10/11 it's not possible, you have to create a tmpfs: https://medium.com/@anthony.f.tannous/android-10-emulation-of-magisk-supersu-on-an-aosp-avd-de93ed080fad – Gizmo Aug 16 '20 at 18:23

8 Answers8

41

Probable cause that remount fails is you are not running adb as root.

Shell Script should be as follow.

# Script to mount Android Device as read/write.
# List the Devices.
adb devices;

# Run adb as root (Needs root access).
adb root;

# Since you're running as root su is not required
adb shell mount -o rw,remount /;

If this fails, you could try the below:

# List the Devices.
adb devices;

# Run adb as root
adb root;

adb remount;
adb shell su -c "mount -o rw,remount /";

To find which user you are:

$ adb shell whoami
Saurabh Meshram
  • 8,106
  • 3
  • 23
  • 32
15

I could not get the mount command to work without specifying the dev block to mount as /system

#cat /proc/mounts returns ( only the system line here )
/dev/stl12 /system rfs ro,relatime,vfat,log_off,check=no,gid/uid/rwx,iocharset=utf8 0 0

so my working command is
mount -o rw,remount -t rfs /dev/stl12 /system

LostNomad311
  • 1,975
  • 2
  • 23
  • 31
  • Thanks, that format did it for me on Nexus 5 running Android 6.0.1. Command ended up being: mount -o rw,remount -t ext4 /dev/block/platform/soc.0/f9824900.sdhci/by-name/system /system – Lance Nanek Jun 07 '16 at 19:32
  • The only answer that actually works on Android 6.0.1. Good job sir. – m0skit0 May 22 '18 at 14:30
15

Otherwise... if

getenforce

returns

Enforcing

Then maybe you should call

setenforce 0 
mount -o rw,remount /system 
setenforce 1
Benoit Duffez
  • 11,839
  • 12
  • 77
  • 125
Albert
  • 159
  • 1
  • 2
  • Unfortunately it isn't allowed. `type=1400 audit(1678982139.040:13): avc: denied { setenforce } for pid=1195 comm="setenforce" scontext=u:r:shell:s0 tcontext=u:object_r:kernel:s0 tclass=security permissive=0` then `setenforce: Couldn't set enforcing status to '0': Permission denied` – Ben Voigt Mar 16 '23 at 20:51
6

The following may help (study the impacts of disable-verity first):

adb root
adb disable-verity
adb reboot
Tosha
  • 998
  • 1
  • 10
  • 22
2

I had the same problem and could not mount system as read/write. It would return

Usage: mount [-r] [-w] [-o options] [-t type] device directory

Or

operation not permitted. Access denied

Now this works on all rooted devices.

DO THE FOLLOWING IN TERMINAL EMULATOR OR IN ADB SHELL

$ su
#mount - o rw,remount -t yaffs2 /system

Yaffs2 is the type of system partition. Replace it by the type of your system partition as obtained from executing the following

#cat /proc/mounts

Then check where /system is appearing from the lengthy result

Extract of mine was like

mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0/dev/block/platform/msm_sdcc.3/by-num/p10 /system ext4 ro,relatime,data=ordered 0 0
/dev/block/platform/msm_sdcc.3/by-num/p11 /cache ext4 rw,nosuid,nodev,relatime,data=ordered 0 0

So my system is ext4. And my command was

$ su
#mount  -o  rw,remount  -t  ext4  /system 

Done.

Lnux
  • 319
  • 1
  • 6
  • 15
1

Get "adbd insecure" from google play store, it helps give write access to custom roms that have it secured my the manufacturers.

joey c
  • 11
  • 1
0

In addition to all the other answers you received, I want to explain the unknown option -- o error: Your command was

$ adb shell 'su -c  mount -o rw,remount /system'

which calls su through adb. You properly quoted the whole su command in order to pass it as one argument to adb shell. However, su -c <cmd> also needs you to quote the command with arguments it shall pass to the shell's -c option. (YMMV depending on su variants.) Therefore, you might want to try

$ adb shell 'su -c "mount -o rw,remount /system"'

(and potentially add the actual device listed in the output of mount | grep system before the /system arg – see the other answers.)

hans_meine
  • 1,881
  • 1
  • 17
  • 29
0
mount -o rw,remount $(mount | grep /dev/root | awk '{print $3}')

this does the job for me, and should work for any android version.

oeter
  • 627
  • 2
  • 8
  • 23