下面的命令一直卡住

root@48c784a7f9cc:/code# adb devices -l

但是手机的端口都是 ok 的

root@48c784a7f9cc:/code# nc -zv 192.168.168.32 43267
Connection to 192.168.168.32 43267 port [tcp/*] succeeded!

我还个手机再使用 adb pair 试试,排查一下是手机的问题,还是电脑的 adb 问题

root@48c784a7f9cc:/code# adb pair 192.168.168.146:36899
Enter pairing code: 124097

换了一个手机,发现也不行

所以不是小米手机的问题,而是 adb 的问题,可能是 adb 卡死了

所以我想重启一下 linux 上的 adb 服务

adb kill-server && adb start-server

但是发现 kill-sever 都不行,也卡住了

所以就直接 kill -9 进程吧

root@48c784a7f9cc:/code# ps jfax
   PPID     PID    PGID     SID TTY        TPGID STAT   UID   TIME COMMAND
      0 1161976 1161976 1161976 pts/3    1162004 Ss       0   0:00 bash
1161976 1161985 1161985 1161976 pts/3    1162004 S        0   0:01  \_ /usr/local/bin/python /usr/local/bin/nameko run --config config.yaml services.consumer_phone
1161985 1161987 1161985 1161976 pts/3    1162004 S        0   0:00  |   \_ /bin/sh -c adb connect 192.168.168.32:43267
1161987 1161988 1161985 1161976 pts/3    1162004 S        0   0:00  |       \_ adb connect 192.168.168.32:43267
1161976 1162004 1162004 1161976 pts/3    1162004 R+       0   0:00  \_ ps jfax
      0   12736   12736   12736 pts/2      12785 Ss       0   0:00 bash
  12736   12785   12785   12736 pts/2      12785 S+       0   0:58  \_ tail -n 1000 -f run.log
      0      24      24      24 pts/1         24 Ss+      0   0:00 bash
      0       1       1       1 pts/0          1 Ssl+     0   0:00 node /usr/local/bin/w2 run --init -z /data/ssl -p 8805
      1      13       1       1 pts/0          1 Sl+      0 3262:22 node --tls-min-v1.0 --max-http-header-size=256000 --max-semi-space-size=64 /usr/local/lib/node_modules/whistle/node_modules/starting/lib/bootstrap.js run /usr/local/lib/node_modules/whistle/index.js --data %7B%22__maxHttpHeaderSize%22%
     13      30       1       1 pts/0          1 Sl+      0 1340:17  \_ node --tls-min-v1.0 --max-http-header-size=256000 --max-semi-space-size=64 /usr/local/lib/node_modules/whistle/node_modules/pfork/lib/main %7B%22name%22%3A%22whistle.autosave%22%2C%22script%22%3A%22%2Fusr%2Flocal%2Flib%2Fnode_modul
      1      42      42      42 ?             -1 Zs       0   2:27 [adb] <defunct>
      1   12745   12743   12736 pts/2      12785 Z        0   0:00 [git] <defunct>
      1  100132  100132  100132 ?             -1 Zs       0   2:12 [adb] <defunct>
      1  332209  332209  332209 ?             -1 Zs       0   1:48 [adb] <defunct>
      1  547143  547143  547143 ?             -1 Zs       0   0:54 [adb] <defunct>
      1  655617  655617  655617 ?             -1 Zs       0   0:57 [adb] <defunct>
      1  769136  769136  769136 ?             -1 Zs       0   0:43 [adb] <defunct>
      1  855939  855939  855939 ?             -1 Zs       0   0:29 [adb] <defunct>
      1  914443  914443  914443 ?             -1 Zs       0   0:48 [adb] <defunct>
      1 1010238 1010238 1010238 ?             -1 Zs       0   0:26 [adb] <defunct>
      1 1062121 1062121 1062121 ?             -1 Ssl      0   1:19 adb -L tcp:5037 fork-server server --reply-fd 4

kill -9 之后,再重启重启就正常了

root@48c784a7f9cc:/code# adb kill-server && adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully

但是之前保存的 devices 记录都没有了

root@48c784a7f9cc:/code# adb devices
List of devices attached
如果你想固定 adb 的端口,可以参考:adb 无线调试固定手机的端口

更新

这个问题,我又在 mac 上遇到了,mac 的 adb 也是一样的问题

╰─➤  adb kill-server && adb start-server                                                            130 ↵
error: failed to read response from server

mac 上的 adb 版本是

─➤  where adb                                                                                                                                          1 ↵
/opt/homebrew/bin/adb
/opt/homebrew/bin/adb
╰─➤  adb --version                                                                                                                                    130 ↵
Android Debug Bridge version 1.0.41
Version 34.0.5-10900879
Installed as /opt/homebrew/bin/adb
Running on Darwin 23.2.0 (arm64)

universe_king
3.4k 声望680 粉丝