如何使用adb在bash脚本中将我的Android /系统重新编写为读写?

And*_*rew 24 bash android mount adb

有关信息

adb remount 
Run Code Online (Sandbox Code Playgroud)

回报 "remount failed: Operation not permitted"

adb shell 'su -c  mount -o rw,remount /system'
Run Code Online (Sandbox Code Playgroud)

回报 unknown option -- o

我的设备扎根了.

Sau*_*ram 36

这可能导致remount失败的是你没有运行adbroot.

Shell脚本应如下所示.

# 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 /;
Run Code Online (Sandbox Code Playgroud)

如果失败,您可以尝试以下方法:

# List the Devices.
adb devices;

# Run adb as root
adb root;

adb remount;
adb shell su -c "mount -o rw,remount /";
Run Code Online (Sandbox Code Playgroud)

要找到user你是谁:

$ adb shell whoami
Run Code Online (Sandbox Code Playgroud)

  • adb shell su -c"mount -o rw,remount/system"; 似乎工作 - 非常感谢 (5认同)
  • 使用模拟器时,除非我使用“-writeable-system”标志启动 AVD,否则上述方法均无效 (2认同)

Los*_*311 13

如果没有指定要作为/ system挂载的开发块,我无法使mount命令工作

#cat /proc/mounts 返回(这里只有系统行)
/dev/stl12 /system rfs ro,relatime,vfat,log_off,check=no,gid/uid/rwx,iocharset=utf8 0 0

所以我的工作命令是
mount -o rw,remount -t rfs /dev/stl12 /system


小智 12

否则......如果

getenforce
Run Code Online (Sandbox Code Playgroud)

回报

Enforcing
Run Code Online (Sandbox Code Playgroud)

那么也许你应该打电话

setenforce 0 
mount -o rw,remount /system 
setenforce 1
Run Code Online (Sandbox Code Playgroud)


Tos*_*sha 6

disable-verity以下内容可能会有所帮助(首先研究其影响):

adb root
adb disable-verity
adb reboot
Run Code Online (Sandbox Code Playgroud)