Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I'm using Android 2.3.3 and I want to copy the iwconfig file to /system/xbin. First I tried doing it with adb push using this:

adb push iwconfig /system/xbin

But in return I had: failed to copy 'iwconfig' to '/system/xbin/iwconfig': Permission denied

So I made my research and finally found this mount command that actually worked (most of them returned the usage: mount []... line)

mount -o remount,rw /dev/block/mtdblock4 /system

But even with that I'm still having the "Permission denied" line.

I also tried mount -o remount,rw /dev/block/mtdblock4 /system/xbin

Buth it returned "Invalid Argument"

Any ideas?

share|improve this question
    
if you are trying with an emulator, then you can first use 'adb remount' which remounts the system partition for read-write. Also, see similar question: stackoverflow.com/questions/6066030/… –  Narayanan Jul 17 '12 at 9:39
    
First use mount command without any arguments. This will list all the mount points and its name. Search for '/system' and it might have different mtdbblock#. For instance, in my device it is '/dev/block/mtdblock1 /system yaffs2 rw,relatime 0 0'. Hence I have to correct the mount statement to appropriate mtdbblock# number in order for the command to work. –  Narayanan Jul 17 '12 at 9:49
    
I'm using a real device, I saw that question already, but it didn't helped, it accepts the mount command, but when I try to push the file, it still tells me that permissions are denied. –  Alberto Urbina Jul 17 '12 at 9:50
    
if your device is rooted, probably you can push the file to /mnt/sdcard and then on the device, either use a terminal emulator or file explorer (with root access) to move the files. That's what I did when I replaced two files in /system/bin. –  Narayanan Jul 17 '12 at 9:53
    
@Narayanan, I did what you tell, I saw this: /dev/block/mtdblock1 /system yaffs2 rw,relatime 0 0 So I tried: mount -o remount,rw /dev/block/mtdblock1 /system But when i try to push the file, it stills tells me that permissions are denied. –  Alberto Urbina Jul 17 '12 at 9:54

1 Answer 1

First, make sure adbd is running as root:

adb root

If you get an error that says something like "unable to run as root on production builds" it means that you must always issue su command in the adb shell to gain superuser privileges. You will need to enter the shell before any mount commands will work. You will need to push the file to the SD Card, then mount /system partition as read-write, and then copy the file to the /xbin directory like so:

adb push [path-to-iwconfig] /sdcard/
adb shell
su
mount -o remount,rw /system
cp /sdcard/iwconfig /system/xbin/
mount -o remount,ro /system
exit
exit
share|improve this answer
    
As you said, it returned "unable to run as root production builds", then mount -o remount,rw /system returns: usage: mount[-r][-w][-o options] [-t type] device directory. I solved this using: mount -o remount,rw /dev/block/mtdblock1 /system. cp /sdcard/iwconfig /system/xbin/ returns: cp: not found –  Alberto Urbina Jul 17 '12 at 13:57
    
Try busybox cp instead. –  Chahk Jul 17 '12 at 14:20
1  
Or use cat - that works quite well as a useful alternative cat [source] > [destination] –  t0mm13b Jul 17 '12 at 15:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.