Scrcpy: adb: error: failed to copy scrcpy-server.jar

Created on 24 Jul 2019  路  21Comments  路  Source: Genymobile/scrcpy

adb: error: failed to copy 'C:\Users\HeyWolf\Desktop\scrcpy-win64\scrcpy-server.jar' to '/data/local/tmp/scrcpy-server.jar': couldn't read from device

adb

All 21 comments

What is the result of:

adb devices
adb shell ls -l /data/local/tmp

?

total 12
-rw-r--r-- 1 root root 2814 2019-07-24 10:23 acc-install.log
-rw-r--r-- 1 root root 930 2019-07-24 03:50 cmdline
drwx--x--x 3 shell shell 4096 2018-12-17 18:32 oat

adb push C:\Users\HeyWolf\Desktop\scrcpy-win64\scrcpy-server.jar /data/local/tmp/scrcpy-server.jar

?

adb: error: failed to copy 'C:\Users\HeyWolf\Desktop\scrcpy-win64\scrcpy-server.jar' to '/data/local/tmp/scrcpy-server.jar': couldn't read from device
C:\Users\HeyWolf\Desktop\scrcpy-win64\scrcpy-server.jar: 0 files pushed. 0.0 MB/s (22470 bytes in 5.052s)

It seems to be a low level issue. Check with another USB port or another cable.

https://stackoverflow.com/questions/48725774/mac-adb-push-command-only-works-on-one-of-my-usb-ports

Help please
adb: error: failed to copy 'D:\scrcpy-win64-v1.10\scrcpy-server.jar' to '/data/local/tmp/scrcpy-server.jar': remote couldn't create file: Premission denied
How to solved that problem?

@Endhen14 What is the result of:

adb shell ls -ld /data/local/tmp/

?

drwxrwx--x 2 shell shell 4096 2019-08-08 03:07 /data/local/tmp/
this result of
adb shell ls -ld /data/local/tmp/

Sorry, remove the d:

adb shell ls -l /data/local/tmp/

ls: /data/local/tmp/: Permission denied
This result of
adb shell ls -ld /data/local/tmp/

Ah, that's the problem: /data/local/tmp/ is not accessible on your device.

So, to summarize:

$ adb shell ls -ld /data/local/tmp/
drwxrwx--x 2 shell shell 4096 2019-08-08 03:07 /data/local/tmp/
$ adb shell ls -l /data/local/tmp/
ls: /data/local/tmp/: Permission denied

Confirm that you execute the command as shell:

$ adb shell whoami
shell

If you have permission denied as shell, then there is probably some SELinux permissions issues.

What is the result of:

adb shell ls -ldZ /data/local/tmp

?

I confirm this me executed the command as Shell
This result
$ adb shell whoami
Shell
And results for
adb shell ls -ldZ /data/local/tmp/
drwxrwx--x 2 shell shell u:object_r:system_data_file: s0 4096 2019-08-08 03:07 /data/local/tmp/

$ adb shell whoami
Shell

You mean shell (lowercase)? (please copy-paste instead)

adb shell ls -ldZ /data/local/tmp/
drwxrwx--x 2 shell shell u:object_r:system_data_file: s0 4096 2019-08-08 03:07 /data/local/tmp/

OK, that's probably the problem, for me it is:

$ adb shell ls -ldZ /data/local/tmp/
drwxrwx--x shell    shell             u:object_r:shell_data_file:s0

(shell_data_file instead of system_data_file)

yes shell (lowercase) @rom1v

and this result in my command no show this:
$ adb shell ls -ldZ /data/local/tmp/
drwxrwx--x shell shell u:object_r:shell_data_file:s0

( in my result command that system_data_file not shell_data_file )

how to solve this problem @rom1v

$ adb shell whoami
Shell

You mean shell (lowercase)? (please copy-paste instead)

adb shell ls -ldZ /data/local/tmp/
drwxrwx--x 2 shell shell u:object_r:system_data_file: s0 4096 2019-08-08 03:07 /data/local/tmp/

OK, that's probably the problem, for me it is:

$ adb shell ls -ldZ /data/local/tmp/
drwxrwx--x shell    shell             u:object_r:shell_data_file:s0

(shell_data_file instead of system_data_file)

have the same issue here

Seeing similar errors on my machine:

2020-02-06 13:53:35.003 scrcpy[913:1730559] INFO: scrcpy 1.12.1 <https://github.com/Genymobile/scrcpy>
exec: Permission denied
2020-02-06 13:53:35.004 scrcpy[913:1730559] ERROR: Failed to execute: [/Users/saket/Library/Android/sdk/platform-tools/], [push], [/usr/local/Cellar/scrcpy/1.12.1/share/scrcpy/scrcpy-server], [/data/local/tmp/scrcpy-server.jar]
2020-02-06 13:53:35.004 scrcpy[913:1730559] ERROR: Could not execute "adb push"

In case these are useful:

$ adb shell ls -l /data/local/tmp:
total 28
-rw-rw-rw- 1 shell shell 26202 2019-12-10 04:07 scrcpy-server.jar
$ adb shell whoami
shell
$ adb shell ls -ldZ /data/local/tmp
drwxrwx--x 2 shell shell u:object_r:shell_data_file:s0 3488 2020-02-06 13:51 /data/local/tmp

I'm trying to run scrcpy on macOS Catalina with a Pixel 3 running Android 10. Any ideas what might be happening?

ERROR: Failed to execute: [/Users/saket/Library/Android/sdk/platform-tools/], [push], [/usr/local/Cellar/scrcpy/1.12.1/share/scrcpy/scrcpy-server], [/data/local/tmp/scrcpy-server.jar]

You set the ADB env variable to a wrong value: it must contains the path of the adb binary, not its directory.

Either unset it, or set it to /Users/saket/Library/Android/sdk/platform-tools/adb.

Huh interesting. I was able to run adb just fine so did not suspect the path was wrong. Updating the path fixes the issue. Thanks for the quick reply, appreciate it!

ls: /data/local/tmp/: Permission denied
This result of
adb shell ls -ld /data/local/tmp/

Ah, that's the problem: /data/local/tmp/ is not accessible on your device.

So, to summarize:

$ adb shell ls -ld /data/local/tmp/
drwxrwx--x 2 shell shell 4096 2019-08-08 03:07 /data/local/tmp/
$ adb shell ls -l /data/local/tmp/
ls: /data/local/tmp/: Permission denied

Confirm that you execute the command as shell:

$ adb shell whoami
shell

If you have permission denied as shell, then there is probably some SELinux permissions issues.

What is the result of:

adb shell ls -ldZ /data/local/tmp

?

turns out it's SELinux error, here's a workaround i figured out to push server to /data/local/tmp
https://gist.github.com/AwaisKing/009a64d92d476da33036efd61c961a7a

hope it works

hope it works

Yes this is the correct fix for this error.. I was having a similar issue and the selinux context for it was set to system_data_file which i changed to shell_data_file using,

chcon -R u:object_r:shell_data_file:s0 /data/local/tmp

It seems to be a low level issue. Check with another USB port or another cable.

https://stackoverflow.com/questions/48725774/mac-adb-push-command-only-works-on-one-of-my-usb-ports

Forget to tell how I solved this. It's the cable who broke.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BloodPHamtOm picture BloodPHamtOm  路  3Comments

jonnybrooks picture jonnybrooks  路  3Comments

tonypachino picture tonypachino  路  3Comments

cordac1 picture cordac1  路  4Comments

udit7395 picture udit7395  路  4Comments