Anarchy-Droid
Anarchy-Droid copied to clipboard
[linux] sudo password prompt causing "unknown adb state"
unknown state:
StdOUT:
StdERR:[sudo] password amo: error: no devices/emulators found
unknown adb state
File "/home/amo/Anarchy-Droid/logger/logger.go", line 156, in LogError.func1
sentry.CaptureException(fmt.Errorf(message + " " + err.Error()))
File "/home/amo/Anarchy-Droid/logger/logger.go", line 150, in LogError
sentry.WithScope(func(scope *sentry.Scope) {
File "/home/amo/Anarchy-Droid/device/adb/adb.go", line 124, in State
logger.LogError("unknown state:\nStdOUT:" + stdout + "\nStdERR:" + stderr + "\n", fmt.Errorf("unknown adb state"))
File "/home/amo/Anarchy-Droid/device/device.go", line 92, in (*Device).GetState
adb_state := adb.State()
File "/home/amo/Anarchy-Droid/device/observer.go", line 43, in (*Device).doObservation
new_state := d.GetState()
File "/home/amo/Anarchy-Droid/device/observer.go", line 31, in (*Device).startObserver
new_state = d.doObservation(last_state)
in adb.State()
(and: Unknown ADB error: [sudo] password for amo:
in adb.unavailable()
)
*errors.errorString: Unknown ADB error: [sudo] password for amo:
File "/home/runner/work/Anarchy-Droid/Anarchy-Droid/logger/logger.go", line 156, in LogError.func1
File "/home/runner/work/Anarchy-Droid/Anarchy-Droid/logger/logger.go", line 150, in LogError
File "/home/runner/work/Anarchy-Droid/Anarchy-Droid/device/adb/adb.go", line 77, in unavailable
File "/home/runner/work/Anarchy-Droid/Anarchy-Droid/device/adb/adb.go", line 186, in IsBooting
File "/home/runner/work/Anarchy-Droid/Anarchy-Droid/device/adb/adb.go", line 113, in State
File "/home/runner/work/Anarchy-Droid/Anarchy-Droid/device/device.go", line 94, in (*Device).GetState
File "/home/runner/work/Anarchy-Droid/Anarchy-Droid/device/observer.go", line 43, in (*Device).doObservation
File "/home/runner/work/Anarchy-Droid/Anarchy-Droid/device/observer.go", line 31, in (*Device).startObserver
Also:
ADB command kill-server gave an unexpected error: stdout: ; stderr: Password: **** is not in the sudoers file. This incident will be reported.
Though this error actually could be caught and reported to the user. This is probably simply a linux (or bsd?) system without sudo.
Not sure if this error is related
Bug: sudo password prompt instead of command output. Killing adb server and retrying kill-server
Stderr contains [sudo]
but running the command with sudo
works fine, (not sure why the need to provide the sudo pass in the dialog if the command is running with sudo anyway)
Providing the sudo password in the dialog is preferred rather than running the whole application with sudo. This way, if the application has a bug, it will not misbehave with sudo-rights on your system. The even more preferred way is to configure udev rules for your device (on archlinux, this is done by simply installing the package android-udev
).
I used it on Ubuntu 20.04, without sudo the application would just throw endless errors as above, with sudo it worked fine so the error above should be some indication as to why that is.