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?

  • 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. 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. Jul 17 '12 at 9:54

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
mount -o remount,rw /system
cp /sdcard/iwconfig /system/xbin/
mount -o remount,ro /system
  • 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 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
  • I have a rooted device, and get root access with SU command in shell, but when I want to cp a file to /system/lib/ , I get this: Read-only file system
    – Dr.jacky
    May 24 '16 at 5:59
  • @Mr.Hyde Did you mount /system partition for read/write access?
    – Chahk
    May 24 '16 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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