Android Debug Bridge deamon not starting

I have the packages android-tools and android-udev installed.

When I run adb xxx (xxx being any command other than help) nothing happens for several minutes, then I get errors connecting to daemon.
When I run adb start-server (as root) I get the following:

# adb start-server 
* daemon not running; starting now at tcp:5037
ADB server didn't ACK
Full server startup log: /tmp/adb.0.log
Server had pid: 3671963
--- adb starting (pid 3671963) ---
04-29 21:08:19.248 3671963 3671963 I adb     : main.cpp:63 Android Debug Bridge version 1.0.41
04-29 21:08:19.248 3671963 3671963 I adb     : main.cpp:63 Version 35.0.2-android-tools
04-29 21:08:19.248 3671963 3671963 I adb     : main.cpp:63 Installed as /usr/bin/adb
04-29 21:08:19.248 3671963 3671963 I adb     : main.cpp:63 Running on Linux 6.12.19-1-MANJARO (x86_64)
04-29 21:08:19.248 3671963 3671963 I adb     : main.cpp:63 
04-29 21:08:19.754 3671963 3671963 F adb     : main.cpp:157 could not install *smartsocket* listener: Address already in use

* failed to start daemon
error: cannot connect to daemon

The file /tmp/adb.0.log contains the same as the log printed to stdout, except for the first 4 lines are not in the file.

The behavior is independent if phone is connected or not.
lsusb recognizes the phone. Phone set to file transfer shows up in Thunar, and file copy works there.

What is the trick to make the deamon start?

Looks like something else is occupying port 5037.

I don’t think it is meant to be run as root, and especially not if it connects to a port number above 1023.

1 Like

What are you trying to do?
I have never seen a failure like that - when connecting to a phone I wanted to
(and did)
to re-flash with … something else

# ss |grep 5037

returns nothing. I think that should indicate it is not in use.

The same behavior happens when run as regular user.

I’d like to get a recording of a speech I held in 2018. It’s recorded on this old phone. Phone is locked with a pin code I can’t remember. The google account used with the phone does no longer exist. I think usb-debug is enabled, which mean I should be able to connect to the phone using adb and run shell commands.
Phone is a samsung galaxy S5 mini.
For the purpose of getting adb to start I’m using a new phone where I know the pin code.

If the phone was set up to encrypt … there is nothing you can do to access any file on it in the clear.

If that is/was not the case:
not a problem to access and recover the data on it.

As far as I know:
knowing the pin code has got
nothing
to do with the ability to connect (using adb)

You can connect just fine, I suppose
(I have never tried this, I have never taken the time to encrypt my phones contents and then compare it to what it was when not encrypted …)
the files will all be there …
but:
encrypted

The pin code of the phone is never an issue …
You can connect just fine without it - but the files on the phone are still encrypted …

If it was that easy to circumvent encryption, it wouldn’t be worth the name …



Hm.
Is it enabled?
Or is it not?

Sorry for answering why I wanted adb to run, as that clearly brought this thread off topic.
The issue in this thread is to figure out what can be done in order to make adb start. It fails before it even get to the point of trying to find a phone.

All searching for the error message is very old. The solution they state is to uninstall android-tools package, and rather use the android-sdk package. However, the android-sdk package has no updates since 2022, hence the android-tools package (3 months old) should work.

Is there a way to get more detailed logging?

I figured it out, just to run into a new problem:
Kill a hangig adb process, then open firewall:

iptables -I INPUT -i lo -p tcp -m tcp --dport 5037 -j ACCEPT

That got the deamon startet. Next problem is that

adb devices

does not list any devices, no matter which phone is connected. All 3 tested phones show up when running lsusb, none of them gets listed with adb.

The issue with devices not listed got solved by
adb kill-server
and
adb start-server
while phone was connected. Seems like server needs restart after phone connect. On the new phones, whenever it connects there is a popup on the phones screen asking if I accept the connection (listing key fingerprint). After accepting, the phone gets listed as connected device. Sample with Motorola E14 connected:

# adb devices 
List of devices attached
ZY22K6****	device

If I ignore the popup message, the device list looks like this

# adb devices 
List of devices attached
ZY22K6DPJS	unauthorized

Now comes the next issue:
With the old phone, I cannot unlock the screen to see if such message pops up there.

#adb devices 
List of devices attached
520015deb2e*****	unauthorized

That might be why I get the following error:

# adb shell
adb: device unauthorized.
This adb server's $ADB_VENDOR_KEYS is not set
Try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.

I was hoping the old phone was old enough to not run into this issue…

If I disable usb-debugging on the new phones, the popup asking if I accept the connection with listed key fingerprint does not show up. And in this case, the phone is not listed as devices in adb. I think this confirmes that usb-debug is enabled in the phone I’m locked out of.