'adb wait-for-device' returns too early causing subsequent 'adb shell' to report "error: protocol fault (no status)"

Bug #1358784 reported by James Hunt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
android-tools (Ubuntu)
New
Undecided
Unassigned

Bug Description

$ adb wait-for-device && adb shell
error: protocol fault (no status)
$ echo $?
$ adb version
Android Debug Bridge version 1.0.31

ProblemType: Bug
DistroRelease: Ubuntu 14.10
Package: android-tools-adb 4.2.2+git20130218-3ubuntu27
ProcVersionSignature: Ubuntu 3.16.0-9.14-generic 3.16.1
Uname: Linux 3.16.0-9-generic x86_64
ApportVersion: 2.14.6-0ubuntu1
Architecture: amd64
CurrentDesktop: Unity
Date: Tue Aug 19 15:45:56 2014
InstallationDate: Installed on 2014-04-11 (129 days ago)
InstallationMedia: Ubuntu 14.04 LTS "Trusty Tahr" - Daily amd64 (20140409)
SourcePackage: android-tools
UpgradeStatus: Upgraded to utopic on 2014-05-08 (103 days ago)

Revision history for this message
James Hunt (jamesodhunt) wrote :
James Hunt (jamesodhunt)
summary: - 'adb wait-for-device' occasionally fails returning 'error: protocol
- fault (no status)'
+ 'adb wait-for-device' returns too early
Revision history for this message
James Hunt (jamesodhunt) wrote : Re: 'adb wait-for-device' returns too early

It's actually the subsequent 'adb shell' which is producing the protocol fault error:

$ adb wait-for-device && echo $? && adb shell
0
error: protocol fault (no status)
$ echo $?
1

'adb help' describes wait-for-device as, "block until device is online". The meaning of 'online' however is not defined. It either means:

(1) the device has reached some sequence point in its boot path.
(2) the device is ready to accept 'adb shell' connections.

I'm guessing it actually means (1). However, users would expect it to mean (2) to be useful.

A rather awful work-around for current behaviour:

$ adb wait-for-device && while ! adb shell true; do sleep 1; done && adb shell

summary: - 'adb wait-for-device' returns too early
+ 'adb wait-for-device' returns too early causing subsequent 'adb shell'
+ to report "error: protocol fault (no status)"
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.