Android:adb:将文件复制到 /system(权限被拒绝)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10864907/
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: adb: copy file to /system (Permission denied)
提问by red_trumpet
actually I try to install busybox on my HTC Desire. Therefore I try to copy a busybox-binary to /system/bin. So I remounted /system with rw:
实际上我尝试在我的 HTC Desire 上安装 busybox。因此我尝试将一个busybox-binary 复制到/system/bin。所以我用 rw 重新安装了 /system:
mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system
After this I didn't get a "Read-only file system"-error. But now I'm experiencing "Permission denied" when trying to push the file to /system/bin. I also tried pushing my file to /sdcard and then move this to /system/bin, but this doesn't work either:
在此之后,我没有收到“只读文件系统”错误。但是现在我在尝试将文件推送到 /system/bin 时遇到“权限被拒绝”。我还尝试将我的文件推送到 /sdcard,然后将其移动到 /system/bin,但这也不起作用:
$ mv /sdcard/busybox /system/bin
failed on '/sdcard/busybox' - Cross-device link
Some ideas, how to solve this problem?
一些想法,如何解决这个问题?
采纳答案by Rodrigo Gurgel
Do a mount
to check if the device really was remounted as RW.
做一个mount
检查设备是否真的被重新安装为 RW。
The same error happened to me, then I simply made a cp orig dest and then a rm on orig, weird but seams mv behaves this way.
同样的错误发生在我身上,然后我简单地创建了一个 cp orig dest,然后在 orig 上创建了一个 rm,很奇怪,但 seams mv 的行为是这样的。
回答by Ofir Luzon
Mounting is not enough, you have to run as root (this is the reason for permission denied). This is how I push busybox:
挂载是不够的,你必须以 root 身份运行(这是权限被拒绝的原因)。这就是我推送busybox的方式:
adb root
adb remount
adb push busybox /system/bin
I run into some devices that you need to remount with mount -o remount,rw /system
and not with adb remount
.
我遇到了一些您需要重新安装mount -o remount,rw /system
而不是使用的设备adb remount
。
回答by Magnus
Not sure but since you asked for ideas I'll mention that I never specified the -t option.
不确定,但既然你问了想法,我会提到我从未指定 -t 选项。
mount -o remount,rw /system
mount -o remount,rw /system
always worked for me
一直为我工作
回答by TomG
mv just moves a hardlink within a single filesystem. If you want to move files between two filesystems you need to copy and then delete the original. e.g.
mv 只是在单个文件系统中移动硬链接。如果要在两个文件系统之间移动文件,则需要复制并删除原始文件。例如
if ( cp -R /sdcard/busybox /system/bin ); then
rm -fR /sdcard/busybox
fi
回答by Pawel Mikielewicz
If some command is not working, try putting busybox in front of it. (if installed)
如果某些命令不起作用,请尝试将 busybox 放在它前面。(如果已安装)
f.ex.
例如
root@android:/ # mv /sdcard/androidLTheme/bootanim/bootanimation.zip /system/media/
failed on '/sdcard/androidLTheme/bootanim/bootanimation.zip' - Cross-device link
root@android:/ # _
but
但
root@android:/ # busybox mv /sdcard/androidLTheme/bootanim/bootanimation.zip /system/media/
root@android:/ # _