stf icon indicating copy to clipboard operation
stf copied to clipboard

'Failed to authenticate to ...' error with ADB connect command (ADB version 1.0.40 4986621)

Open denis99999 opened this issue 8 years ago • 30 comments

What is the issue or idea you have? Using the latest version of ADB (1.0.40 4986621), the adb connect command return an error like Failed to authenticate to 10.193.14.128:15005, although the device has been well connected, it is confirmed by running adb devices -l and adb shell commands, so it is not a blocking issue.

Note this error message does not appear while connecting directly to a device configured with a adb tcpip 5555 command, neither with lower version of ADB.

At stf-provider side, the ADB version is 1.0.36 but a I made also a test with an 1.0.40 version and the issue remains.

So, it seems the problem is perhaps located at stf-provider side using adbkit.

Does it only happen on a specific device? Please run adb devices -l and paste the corresponding row. no device specific, but ADB specific from 1.0.40 4986621 version.

Please provide the steps to reproduce the issue. see above.

What is the expected behavior? ADB should return a message like connected to 10.193.14.128:15005

Do you see errors or warnings in the stf local output? If so, please paste them or the full log here. No, just an info message like New remote ADB connection from ::ffff:10.193.14.11

Please run stf doctor and paste the output here.

debian@debian:~/stf-master$ stf doctor
2018-10-29T09:40:24.221Z INF/cli:doctor 7077 [*] OS Arch: x64
2018-10-29T09:40:24.224Z INF/cli:doctor 7077 [*] OS Platform: linux
2018-10-29T09:40:24.224Z INF/cli:doctor 7077 [*] OS Platform: 3.16.0-4-amd64
2018-10-29T09:40:24.225Z INF/cli:doctor 7077 [*] Using Node 8.9.3
2018-10-29T09:40:24.240Z INF/cli:doctor 7077 [*] Using ZeroMQ 4.0.5
2018-10-29T09:40:24.252Z INF/cli:doctor 7077 [*] Using ADB 1.0.36
2018-10-29T09:40:24.253Z ERR/cli:doctor 7077 [*] ProtoBuf is not installed (`protoc` is missing)
2018-10-29T09:40:24.269Z INF/cli:doctor 7077 [*] Using GraphicsMagick 1.3.20
2018-10-29T09:40:24.323Z INF/cli:doctor 7077 [*] Using RethinkDB 2.3.6~0jessie
debian@debian:~/stf-master$

denis99999 avatar Oct 29 '18 09:10 denis99999

+1

chagasaway avatar Oct 31 '18 13:10 chagasaway

+1

zademaxfield avatar Nov 06 '18 22:11 zademaxfield

Please don't post comments with "+1" only or similar. It won't speed up fixing. You can upvote this issue by adding reaction at the bottom of the first post.

koral-- avatar Nov 07 '18 02:11 koral--

Hi I use stf api inside a docker container to access devices connected on aother system. The same docker image and api code works on production environment but fails on local environment I get this response back from stf "success":true,"remoteConnectUrl":"192.168.187.109:7409" followed by this line failed to authenticate to 192.168.187.109:7409 The user account associated with the container is root.

Please advise a fix

djcm75 avatar Nov 27 '18 07:11 djcm75

Hi I am facing the same issue, please see the attached logs

adb I 12-03 06:09:47 297 297 auth.cpp:473] Calling send_auth_response adb I 12-03 06:09:47 297 297 auth.cpp:440] Calling send_auth_publickey adb I 12-03 06:09:48 297 297 adb.cpp:145] 10.30.2.188:7401: offline adb server killed by remote request adb I 12-03 06:09:51 297 297 transport.cpp:337] BlockingConnectionAdapter(10.30.2.188:7401): stopping adb I 12-03 06:09:51 297 446 transport.cpp:285] 10.30.2.188:7401: read failed: Success adb I 12-03 06:09:51 297 297 transport.cpp:355] BlockingConnectionAdapter(10.30.2.188:7401): stopped --- adb starting (pid 530) --- adb I 12-03 06:11:10 530 530 main.cpp:56] Android Debug Bridge version 1.0.40 adb I 12-03 06:11:10 530 530 main.cpp:56] Version 4986621 adb I 12-03 06:11:10 530 530 main.cpp:56] Installed as /opt/android-sdk/platform-tools/adb adb I 12-03 06:11:10 530 530 main.cpp:56] adb I 12-03 06:11:10 530 530 auth.cpp:421] adb_auth_init... adb I 12-03 06:11:10 530 530 auth.cpp:174] read_key_file '/root/.android/adbkey'... adb I 12-03 06:11:10 530 530 auth.cpp:396] adb_auth_inotify_init... adb I 12-03 06:11:16 530 543 transport.cpp:281] 10.30.2.188:7409: read thread spawning adb I 12-03 06:11:16 530 544 transport.cpp:294] 10.30.2.188:7409: write thread spawning adb I 12-03 06:11:16 530 530 auth.cpp:473] Calling send_auth_response adb I 12-03 06:11:16 530 530 auth.cpp:440] Calling send_auth_publickey adb I 12-03 06:11:16 530 530 adb.cpp:145] 10.30.2.188:7409: offline

djcm75 avatar Dec 03 '18 06:12 djcm75

Hi, i am facing the same issue, what can i do to solve it?

fightingAries avatar Dec 26 '18 12:12 fightingAries

Hi, i am facing the same issue, what can i do to solve it?

likezjuisee avatar Jan 18 '19 09:01 likezjuisee

adb connect 192.168.1.214

  • daemon not running; starting now at tcp:5037
  • daemon started successfully failed to authenticate to 192.168.1.214:5555

adb connect 192.168.1.214 already connected to 192.168.1.214:5555

adb devices List of devices attached 192.168.1.214:5555 unauthorized

jlvandusen avatar Jan 26 '19 18:01 jlvandusen

any updates on this topic? any solutions? i;m inthe situatia that on my macbook pro i can connect to them using Android Debug Bridge version 1.0.40 Version 4797878, and from other mac minis i get failed to connect/authenticate....

vjmaiky avatar Jan 29 '19 14:01 vjmaiky

I took a brief look a few weeks ago. It seems that adbkit itself is fine, if used by itself everything works well. The issue seems to be that the auth handler in STF rejects the client due to the device already being in use, even if it wasn’t. Seems like events like autojoin may be firing in an incorrect order. I was not able to look into it further yet.

sorccu avatar Jan 29 '19 15:01 sorccu

I took a brief look a few weeks ago. It seems that adbkit itself is fine, if used by itself everything works well. The issue seems to be that the auth handler in STF rejects the client due to the device already being in use, even if it wasn’t. Seems like events like autojoin may be firing in an incorrect order. I was not able to look into it further yet.

Yes, I guess the auth flow is changed.

likezjuisee avatar Jan 31 '19 08:01 likezjuisee

if i close the active screen share and i do adb connect to it's ip..it works..it seems that i cannot be connected with share screen and via adb to it

vjmaiky avatar Jan 31 '19 14:01 vjmaiky

I solved it by downgrading adb to ver 1.0.39 if I use version 1.0.40 I constantly get the error message. Simply downgrading solved the problem. This was done on linux system, I never checked on windows

djcm75 avatar Feb 01 '19 07:02 djcm75

how did you downgraded adb?

vjmaiky avatar Feb 01 '19 07:02 vjmaiky

i had an old version of adb preserved somewhere in git, i copied over the old file into /usr/bin/ folder. If you search google, you may find it somewhere.

djcm75 avatar Feb 04 '19 08:02 djcm75

Downgrading adb to v.1.0.39 fixed the problem for me too. Attached, adb file for Linux (extracted from docker container sorccu/adb). adb.zip

kamil-allaf avatar Feb 11 '19 14:02 kamil-allaf

It seems that there is no need to downgrade ADB nor apply any workaround. The message printed to console is incorrect but connection is actually successful.

koral-- avatar Feb 11 '19 14:02 koral--

Yes, I agree with you, but in my case, the correct adb output is important as I use it to verify adb status by the automatic test framework.

kamil-allaf avatar Feb 12 '19 14:02 kamil-allaf

@sorccu It seems it is the problem of adbkit it self. The issue can be reproduced with the following steps.

Here I use adb 1.0.40

npm i -g adbkit
adbkit usb-device-to-tcp -p 20067 FFKDU17314004185

Then open another terminal

$ adb version
# should show adb version 1.0.40
$ adb connect 127.0.0.1:20067

The first terminal will show

Connect with `adb connect localhost:20067`
An error occured: Unrecognizable public key format
An error occured: Unrecognizable public key format
An error occured: Unrecognizable public key format
An error occured: Unrecognizable public key format
...

------- more --------- Then I start adbkit with debug mode DEBUG=adb:* adbkit usb-device-to-tcp -p 20067 6EB0217704000486

An error show that

adb:tcpusb:socket Received RSA public key 'UUFBQUFKVm1TY3REeXlyM1U3VnlrQmQ5S09LdG1UOGI5dEc2RGQ4cjc3bkdQWU1ZWm9vTzROZk04UnpldXRkcThxcThud0pzWEx4T2Z4bzJMVUdaRHZONk9EZWxpclBZMy8wU0hwWng1MkZhM1drTW40QllOcXp0bkdtQzBXaDZadjZlc21zOTNCY09TY2M5MEhyZEgvSnRPQk1tSUpMTHRzTVhkYmtscW1ocFNGUjlEQjJjSVJ3b1FjZDRWdEkyUjU0ZnRkUGFTMjRmWCt5Y0M2a05Md01CNUoyOGRFWXFHZHhjRTBJS0Y4ZmJVbHFLNnNSM2ROM1M1K25pYThtRjlSVGlMUEZsRjZXWHRVN1J1bVVMZUJYWUdvRVpubmpCald3b2lvejBFY0ZFMTFtNEloUFFMb005Yk04ZmgvSmlJaEMzNU9zNWE2N2tlN3lxa0NONWVWaTBkcUhac2NMTFBNL1JSNWV4VkswZ3RRY25GY1FmU0I0MkdCR2FYaVd4RHhyUG1EWW1QOWowMTNBbE5xMm1IbnpwWHZsd0hMZGQ2aGNwYWRZdUlOb1crWWJUelZCNHhDNE44a0tYa1FjWUdxWW53dGQvemFEQzRsbFBjeUhYTFlnM0ExMGtuQ2cra2ljNEJOQy9yRTAwR01rdGVFZDlvWTM2YTNmM29uaDAzZ2V6elI3U05xSVdjZFhWcXRuc3poUzdXYWt5WW1abzNDTExGMXA4VzA3QXBUd1lEa1VwN0VYd1oremo0NEh3aU5pV2hSbEFRMnZjRXBlcVdTV3FkSlRQVko4TjFOOGNmSVgvV3J2bURoUkpmSVhtbm45NDBCMDR0aHAvY0lhSFN4bVFUbjRnbFpLa0wxK21CbmlYc2JpazlVajFxYldndWNQNHBEOVFDdVVIbk12ZEw2TERZQUVBQVFBPQA='
An error occured: Unrecognaizable public key format

It seems little fix of the line code could fix the issue. https://github.com/openstf/adbkit/blob/7f1581016f1b1d4a8f4a45597f33ca09beed7332/src/adb/auth.coffee#L22

I can make a pr if you want.

codeskyblue avatar Apr 17 '19 01:04 codeskyblue

@codeskyblue - how do I merge this into my HASS.IO install?

jlvandusen avatar Apr 17 '19 10:04 jlvandusen