Issue with linux "adb push" command, "No such file or directory" error

10.7k Views Asked by At

I am trying to develop a simple pygame with Ubuntu Linux 11.10 for my Motorola android phone. I am having trouble getting the "adb push" command to work. I get an failed to copy 'foo.txt' to '/media/MOT': No such file or directory error message. What am I doing wrong?

Here is what I tried so far:

The phone's SD card is mounted at /media/MOT/ and I am able to ls, create a folder and delete a folder in it.

     user@linuxlappy:~$ 
     user@linuxlappy:~$ cd /media/MOT/
     user@linuxlappy:/media/MOT$ ls
     Android  burstlyImageCache  burstlyVideoCache  data  DCIM  download  gstomperdemo  LOST.DIR  slacker  temp.apk
     user@linuxlappy:/media/MOT$ mkdir writetest
     user@linuxlappy:/media/MOT$ rmdir writetest/

The file that I am trying to copy is foo.txt in my /home/user/ directory

     user@linuxlappy:/media/MOT$ cd /home/user/
     user@linuxlappy:~$ ls foo.*
     foo.txt  foo.txt~

I enabled USB debugging on the phone with: Settings > Applications > Development > USB debugging.

I believe I have adb installed correctly, I am able to list the phone with adb devices.

     user@linuxlappy:~$ adb devices
     List of devices attached 
     0910E8201700B017   device

When I try to push a simple text file to the SD card I get this error message.

     user@linuxlappy:~$ adb push foo.txt /media/MOT
     failed to copy 'foo.txt' to '/media/MOT': No such file or directory
     user@linuxlappy:~$
1

There are 1 best solutions below

2
On

The phone's SD card is mounted at /media/MOT/

Based on your terminal output, it is mounted on your desktop Linux environment as /media/MOT. In which case, to copy files to it, you use cp.

Using adb push, you need to use the path where the external storage resides on the phone. A common spot is /mnt/sdcard/, though it may vary. Also, bear in mind that, depending on your phone, external storage may not be available while you have it mounted as a volume on your desktop Linux environment.