Android: adb: copy file to /system (Permission

2019-02-03 10:40发布

问题:

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:

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:

$ mv /sdcard/busybox /system/bin
failed on '/sdcard/busybox' - Cross-device link

Some ideas, how to solve this problem?

回答1:

Mounting is not enough, you have to run as root (this is the reason for permission denied). This is how I push 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.



回答2:

Do a mount to check if the device really was remounted as 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.



回答3:

Not sure but since you asked for ideas I'll mention that I never specified the -t option.

mount -o remount,rw /system

always worked for me



回答4:

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.

if ( cp -R /sdcard/busybox /system/bin ); then
rm -fR /sdcard/busybox
fi


回答5:

If some command is not working, try putting busybox in front of it. (if installed)

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:/ # _