adb can list devices but adb shell/logcat doesn't work

Jinghao Shi picture Jinghao Shi · Sep 27, 2013 · Viewed 14.3k times · Source

Short version

adb devices can list device, but adb shell or adb logcat just hang and don't work.

Long version

Here are various command outputs.

/* system info */
$ uname -a
Linux ubuntu-vm 3.8.0-19-generic #29-Ubuntu SMP Wed Apr 17 18:16:28 UTC 2013 x86_64 x86_64    x86_64 GNU/Linux

/* udev info */
$ cat /etc/udev/rules.d/51-android.rules 
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666", GROUP="plugdev" 

$ lsusb
Bus 001 Device 003: ID 04e8:6860 Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II], GT-P7500 [Galaxy Tab 10.1]
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub



$ adb devices -l
List of devices attached 
0A3C294805017006       device usb:1-1 product:full_toroplus model:Full_AOSP_on_Toroplus device:toroplus

$ adb shell
/* no output, just hang */

$ adb logcat
/* no output either */

/* verbose mode */
$ ADB_TARCE=1 adb shell
system/core/adb/adb.c::main():Handling commandline()
system/core/adb/commandline.c::adb_commandline():starting interactive shell
system/core/adb/adb_client.c::_adb_connect():_adb_connect: host:version
..........
4f4b4159 OKAY
system/core/adb/adb_client.c::switch_socket_transport():Switch transport success
system/core/adb/transport.c::writex():writex: fd=3 len=4: 30303036 0006
system/core/adb/transport.c::writex():writex: fd=3 len=6: 7368656c6c3a shell:
system/core/adb/transport.c::readx():readx: fd=3 wanted=4
/* hang at this point */

It seems that adb server is expecting some data from phone but can not get it, thus it's stuck there.

I've tried:

  • kill and restart adb server
  • unplug and then plug phone
  • reboot phone
  • disable usb debug on phone and then enable it

Sometimes, after unplug/plug the phone, it will work for a while (I can do adb shell), but soon it stops working. And most of the time, unplug/plug phone even has no effect at all!

I'm running ubuntu as vmplayer guest. Host is windows 7.

Thanks in advance for any help or hints.

UPDATE

After plug the phone into rear usb port, it suddenly works! But I'm not sure the problem is really solved. Will see.

Answer

user3546604 picture user3546604 · Apr 17, 2014

I had the exact same problem with adb shell hanging. I am running an Ubuntu 12.04 VM guest on an Ubuntu host. The problem for me was the USB Compatibility setting for the VM was set to 1.1, it needs to be at least 2.0. To change the setting power down the VM and choose the "Edit virtual machine settings" in the VMPlayer startup menu. Then select the "USB Controller" device and change "USB Compatibility" to USB 2.0.