Linux Android 挂载具有写权限的文件系统
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10294808/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android mount the filesystem with write permission
提问by Mr.
The Android device I am using does not hold sqlite3
on it, so i thought to push
it to the device after pull
ing it from the AVD.
我正在使用的 Android 设备不支持sqlite3
它,所以我push
在pull
从 AVD 读取它后想到了它。
I had no problem pulling it from the AVD, though I cannot push it to the device since I need to enable a write permission. I tried to follow sqlite3: not found
我从 AVD 中提取它没有问题,但我无法将它推送到设备,因为我需要启用写入权限。我试图关注sqlite3: not found
I tried the following
我尝试了以下
$ adb -d shell
$ mount
mount
rootfs / rootfs ro,relatime 0 0
tmpfs /dev tmpfs rw,relatime,mode=111 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/usb tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /app-cache tmpfs rw,relatime,size=7168k 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
/dev/block/mmcblk0p9 /system ext4 ro,relatime,barrier=1,data=ordered 0 0
/dev/block/mmcblk0p7 /cache ext4 rw,nosuid,nodev,noatime,barrier=1,data=ordered
/dev/block/mmcblk0p1 /efs ext4 rw,nosuid,nodev,noatime,barrier=1,data=ordered 0
nil /sys/kernel/debug debugfs rw,relatime 0 0
/dev/block/mmcblk0p10 /data ext4 rw,nosuid,nodev,noatime,barrier=1,data=ordered,
/dev/block/mmcblk0p4 /mnt/.lfs j4fs rw,relatime 0 0
/dev/block/vold/179:11 /mnt/sdcard vfat rw,dirsync,nosuid,nodev,noexec,noatime,n
epage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro,discard 0
I followed this linkand tried to mount the filesystem as follows but I got a permission error.
我按照此链接尝试按如下方式挂载文件系统,但出现权限错误。
$ mount -o rw,remount -t yaffs2 /dev/block/mmcblk0p9 /system
mount: Operation not permitted
Any clue what is needed to be done in order to push
sqlite3
into an Adroid device for debugging reasons?
任何线索需要做什么才能push
sqlite3
出于调试原因进入 Adroid 设备?
采纳答案by mk..
Edit: Found a better solution
编辑:找到了更好的解决方案
From host machine(Linux or windows PC), execute the following commands.
从主机(Linux 或 Windows PC),执行以下命令。
>> adb root
>> adb remount
remount will by default remount the /system partition with rw, if you have the permissions.
如果您有权限,remount 将默认使用 rw 重新挂载 /system 分区。
The Note 1 and 2mentioned below are still applicable.
下面提到的注 1 和注 2仍然适用。
Old way
老办法
To remount a mounted system you need to have root privileges. Do an su
. You will enter root mode. Then run the below command. It will work, I did it many a times.
要重新挂载已挂载的系统,您需要具有 root 权限。做一个su
。您将进入根模式。然后运行下面的命令。它会起作用,我做了很多次。
So here are the steps:
所以这里是步骤:
adb shell
su
mount -o rw,remount /system
Note 1:To execute the commands su
or adb root
, your device must be rooted and have su executable on it. If the command su
is successful, terminal prompt will change from $
to #
.
注意 1:要执行命令su
或adb root
,您的设备必须根植并具有 su 可执行文件。如果命令su
成功,终端提示符将从$
变为#
。
Note 2:In recent mobiles, Security has been tightened, and even after rooting the phone, adb remount
wouldn't work. As of i know, there is no solution available for it so far.
注意2:最近的手机,安全性已经加强了,即使在手机root后adb remount
也不起作用。据我所知,到目前为止还没有可用的解决方案。
回答by Scott D
As mk points out, many newer phones have adb root and adb remount disabled. My LGL34C is locked out, and adb is pretty much only useful for pulling in the protected areas of the filesystem.
正如 mk 指出的那样,许多较新的手机都禁用了 adb root 和 adb remount。我的 LGL34C 被锁定,而 adb 几乎只用于拉入文件系统的受保护区域。
But there IS a way around it (there's ALWAYS a way)! You still need a rooted phone with su installed, of course. Install a shell terminal and/or sshd service on the phone. Remount and writing to /system work just fine from the local OS.
但是有办法解决它(总有办法)!当然,您仍然需要安装了 su 的 root 手机。在手机上安装 shell 终端和/或 sshd 服务。从本地操作系统重新挂载和写入 /system 工作正常。
回答by user7485198
the main reason you didnt have permissions...no root on that script hince the $ su turns that into a # i believe....
您没有权限的主要原因...该脚本上没有root,因为$ su 将其变成了# 我相信....