3

Any adb command results in the following output:

* daemon not running. starting it now on port 5037 *
cannot bind 'local:5037'
ADB server didn't ACK
* failed to start daemon *
error: cannot connect to daemon

There is no running adb instance, and nothing is using TCP port 5037.

1

1 Answer 1

6

Note that the error says local:5037, not tcp:5037. ADB is actually trying to connect to an unix socket at /tmp/5037, which fails.

In my case this was because I ran adb as root before. Thus, the socket was owned by root, forbidding my user from removing it. Relevant excerpt from strace adb fork-server server:

socket(PF_LOCAL, SOCK_STREAM, 0)        = 8
unlink("/tmp/5037")                     = -1 EPERM (Operation not permitted)
setsockopt(8, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(8, {sa_family=AF_LOCAL, sun_path="/tmp/5037"}, 12) = -1 EADDRINUSE (Address already in use)
close(8)                                = 0
1
  • 4
    For anyone else who finds this, sudo adb kill-server may not free the port, and sudo rm /tmp/5037 seems to fix it. Commented Jun 12, 2016 at 10:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .