[英]Read only file system on Android
I recently rooted my Droid X and everything seems to be working perfectly.我最近扎根了我的 Droid X,一切似乎都运行良好。 I made some changes to
build.prop
and when I do adb push build.prop /system/
I get the following error: failed to copy 'c:\\build.prop' to '/system//build.prop': Read-only file system
.我对
build.prop
进行了一些更改,当我执行adb push build.prop /system/
出现以下错误: failed to copy 'c:\\build.prop' to '/system//build.prop': Read-only file system
。
How can I fix this?我怎样才能解决这个问题?
Not all phones and versions of android have things mounted the same.并非所有手机和 android 版本都安装了相同的东西。
Limiting options when remounting would be best.最好在重新安装时限制选项。
Simply remount as rw (Read/Write):只需重新挂载为 rw(读/写):
# mount -o rw,remount /system
Once you are done making changes, remount to ro (read-only):完成更改后,重新挂载到 ro(只读):
# mount -o ro,remount /system
adb remount
对我有用,似乎是最简单的解决方案。
Got this off an Android forum where I asked the same question.从 Android 论坛上得到了这个,我在那里问了同样的问题。 Hope this helps somebody else.
希望这对其他人有帮助。
On a terminal emulator on the phone:在手机上的终端模拟器上:
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
Then on the cmd prompt, do the adb push
然后在 cmd 提示符下,执行
adb push
While I know the question is about the real device, in case someone got here with a similar issue in the emulator, with whatever tools are the latest as of Feb, 2017, the emulator needs to be launched from the command line with:虽然我知道问题是关于真实设备的,但如果有人在模拟器中遇到类似问题,使用截至 2017 年 2 月的最新工具,模拟器需要从命令行启动:
-writable-system
For anything to be writable to the /system
.对于可写入
/system
任何内容。 Without this flag no combination of remount
or mount
will allow one to write to /system
.如果没有此标志,则
remount
或mount
组合将不允许写入/system
。
After the emulator is launched with that flag, a single adb remount
after adb root
is sufficient to get permissions to push to /system
.在使用该标志启动模拟器后,在
adb root
之后adb remount
单个adb remount
就足以获得推送到/system
权限。
Here's an example of the command line I use to run my emulator:这是我用来运行模拟器的命令行示例:
./emulator -writable-system -avd Nexus_5_API_25 -no-snapshot-load -qemu
The value for the -avd
flags comes from: -avd
标志的值来自:
./emulator -list-avds
I think the safest way is remounting the /system as read-write, using:我认为最安全的方法是将 /system 重新挂载为读写,使用:
mount -o remount,rw /system
and when done, remount it as read-only:完成后,将其重新挂载为只读:
mount -o remount,ro /system
On my Samsung galaxy mini S5570 (after got root on cellphone):在我的三星galaxy mini S5570上(在手机上root后):
Fist, as root, I ran:拳头,作为根,我跑了:
systemctl start adb
as a normal user:作为普通用户:
adb shell
su
Grant root permissions on touch screen在触摸屏上授予 root 权限
mount
list all mount points that we have and we can see, in my case, that /dev/stl12 was mounted on /system as ro (ready only), so we just need do:列出我们拥有的所有挂载点,我们可以看到,在我的情况下,/dev/stl12 作为 ro 挂载在 /system 上(仅就绪),所以我们只需要执行以下操作:
mount -o rw,remount /dev/stl12 /system
adb disable-verity
adb reboot
adb root
adb remount
This works for me, and is the simplest solution.这对我有用,并且是最简单的解决方案。
Try the following on the command prompt:在命令提示符下尝试以下操作:
>adb remount
>adb push framework-res_old.apk /system/framework-res.apk
Here is what worked for me.这对我有用。 I was running an emulated Android 7.1.1 (Nougat) device.
我正在运行模拟的 Android 7.1.1 (Nougat) 设备。
On a terminal, I hit the following command.在终端上,我点击了以下命令。 One thing to be noticed is the -writable-system flag
需要注意的一件事是 -writable-system 标志
./emulator -writable-system -avd Nexus_6_API_25 -partition-size 280
On another tab在另一个选项卡上
./adb shell
su
mount -o rw,remount -t ext4 /dev/block/vda /system
All the changes that you do on the /system contents will survive a restart.您对 /system 内容所做的所有更改都将在重新启动后继续存在。
I checked with emulator and following worked.我检查了模拟器并进行了以下工作。
As mentioned above as well, execute second step in single shot.同样如上所述,单次执行第二步。
Open terminal emulator on the phone: then在手机上打开终端模拟器:然后
adb shell
after that daemon is started守护进程启动后
su
mount -o rw,remount /mnt/sdcard
then the read only is converted into the read-Write.然后只读转换为读写。
mount -o rw,remount /dev/stl12 /system
为我工作
This worked for me
#Mount as ReadOnly
su -c "mount -o rw,remount /system"
# Change Permission for file
su -c "chmod 777 /system/build.prop"
#Edit the file to add the property
su -c "busybox vi /system/build.prop"
# Add now
service.adb.tcp.port=5678
# Reset old permissions
su -c "chmod 644 /system/build.prop"
# Mount as readonly again once done
su -c "mount -o ro,remount /system"
I found this article from google, and thought I'd add the steps necessary on a Sony Xperia Z (4.2.2).我从谷歌上找到了这篇文章,并认为我会在 Sony Xperia Z (4.2.2) 上添加必要的步骤。
The Sony has a watchdog process which detects when you've changed ro to rw on / and /system (these are the only ones I was trying to modify) and possibly others.索尼有一个看门狗进程,它可以检测您何时在 / 和 / 系统上将 ro 更改为 rw(这些是我试图修改的唯一的)以及其他可能的。
The following was what I ran to perform the changes I was trying to achieve.以下是我为执行我试图实现的更改而运行的内容。 I pasted these into a window, because removing the execute bit from /sbin/ric needs to be done quickly in order to stop it restarting itself.
我将这些粘贴到一个窗口中,因为从 /sbin/ric 中删除执行位需要快速完成以阻止它重新启动。 (I tried
stop ric
; this doesn't work - although it worked on a previous version of android on the phone). (我试过
stop ric
;这不起作用 - 尽管它在手机上的先前版本的 android 上工作)。
pkill -9 ric; mount -o rw,remount -t rootfs /
chmod 640 /sbin/ric
mount -o rw,remount /system
I modified the hosts file here, so this is the place you make the changes you need to the filesystem.我在这里修改了 hosts 文件,因此这是您对文件系统进行所需更改的地方。 To leave things the way we found them, do this:
要让事情保持我们发现它们的方式,请执行以下操作:
mount -o ro,remount /system
chmod 750 /sbin/ric
mount -o ro,remount -t rootfs /
At which point ric should automatically restart.此时 ric 应自动重新启动。 (It restarted for me automatically.)
(它自动为我重新启动。)
Adding a little bit more to Jan Bergström's answer: Because Android is a Linux based system, and the path in Linux contains forward slashes(../), while using push command, use "/" to define destination path in the Android device.在 Jan Bergström 的回答中添加一点:因为 Android 是基于 Linux 的系统,并且 Linux 中的路径包含正斜杠 (../),在使用 push 命令时,使用“/”来定义 Android 设备中的目标路径。
For Example, the command goes: adb push C:\\Users\\admin\\Desktop\\1.JPG sdcard/pictures/例如,命令是: adb push C:\\Users\\admin\\Desktop\\1.JPG sdcard/pictures/
Notice that here, back slashes are used to define source path of the file to be pushed from windows PC and forward slashes are used to define destination path because Android is a Linux based system.请注意,这里的反斜杠用于定义要从 Windows PC 推送的文件的源路径,而正斜杠用于定义目标路径,因为 Android 是基于 Linux 的系统。 You don't have to act as a root to use this command and also, it works perfectly fine on production devices.
您不必以 root 身份使用此命令,而且它在生产设备上运行良好。
Sometimes you get the error because the destination location in phone are not exist.有时您会收到错误消息,因为手机中的目标位置不存在。 For example, some android phone external storage location is
/storage/emulated/legacy
instead of /storage/emulated/0
.例如,一些安卓手机的外部存储位置是
/storage/emulated/legacy
而不是/storage/emulated/0
。
Thanks, Sérgio , for "mount" command without parameters idea.谢谢,塞尔吉奥,没有参数想法的“挂载”命令。 I'd need to made
adb push
into /data/data/com.my.app/lib
for some test issue, and get "Read-only filesystem" message.对于某些测试问题,我需要将
adb push
送到/data/data/com.my.app/lib
中,并获得“只读文件系统”消息。
ls command shows me: ls 命令显示我:
root@android:/ # ls -l /data/data/com.my.app/
drwxrwx--x u0_a98 u0_a98 2016-05-06 09:16 cache drwxrwx--x u0_a98 u0_a98 2016-05-06 09:04 files lrwxrwxrwx system system 2016-05-06 11:43 lib -> /mnt/asec/com.my.app-1/lib
So, it's understood, that "lib" directory is separated from other application directories.因此,可以理解,“lib”目录与其他应用程序目录是分开的。
Command mount -o rw,remount /mnt/asec
didn't resolve "r/o fs" issue, it wants device parameter before directory parameter.命令
mount -o rw,remount /mnt/asec
没有解决“r/o fs”问题,它需要目录参数之前的设备参数。
"df" command didn't help also, but shows that my /mnt/asec/com.my.app-1
directory is at the separate mount point. “df”命令也没有帮助,但显示我的
/mnt/asec/com.my.app-1
目录位于单独的挂载点。
Then I looks by mount
and voila!然后我看
mount
,瞧!
root@android:/ # mount ......... /dev/block/dm-4 /mnt/asec/com.my.app-1 ext4 ro,dirsync,relatime 0 0
Next steps are already described upwards: remount to RW, push and remount back to RO.后续步骤已经在上面进行了描述:重新安装到 RW,推送并重新安装回 RO。
与必须解压并重新打包 initrc.img 并使用 mount /system 的代码编辑init
文件相同
Well, I assume you like to copy data to the Sd-card from the developers computer?好吧,我假设您喜欢将数据从开发人员计算机复制到 Sd 卡? You might have rooted the devise and made the area you address available?) I had about the same problem to upload data files for my application(Android Studio 1.3.2 in Win7), but.
您可能已经根植了设备并使您解决的区域可用?)我在为我的应用程序(Win7 中的 Android Studio 1.3.2)上传数据文件时遇到了同样的问题,但是。
So for instance the the adb command can look like this:因此,例如 adb 命令可以如下所示:
adb push C:\\testdata\\t.txt /sdcard/download/t.txt adb push C:\\testdata\\t.txt /sdcard/download/t.txt
如果复制只读文件失败,您可以尝试在根目录中找到原始文件并使用根文本编辑器(最好)RB文本编辑器对其进行修改,它带有ROM Toolbox应用程序。
以 root 身份在终端模拟器中尝试此操作:
restorecon -v -R /data/media
In my case I was using the command adb push ~/Desktop/file.txt ~/sdcard/
在我的情况下,我使用命令 adb push
~/Desktop/file.txt ~/sdcard/
I changed it to ~/Desktop/file.txt /sdcard/
and then it worked.我将其更改为
~/Desktop/file.txt /sdcard/
然后它起作用了。
Make sure to disconnect and reconnect the phone.确保断开并重新连接手机。
我只需要这个:
su -c "mount -o rw,remount /system"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.