adb reboot fails: "reboot failed: -1" with xenial

Bug #1613966 reported by Michał Sawicz
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Canonical System Image
Confirmed
Critical
Unassigned

Bug Description

Steps:
* flash ubuntu-touch/staging/ubuntu on frieza or krillin
* adb reboot

Expected:
* device reboots

Current:
* prints "reboot failed: -1"

Michał Sawicz (saviq)
Changed in canonical-devices-system-image:
milestone: none → xenial
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Yeah this is how it is on xenial. Also means a need to manually to put the device to eg fastboot mode if necessary, or recovery mode in order to upgrade image.

Changed in canonical-devices-system-image:
status: New → Confirmed
Revision history for this message
Chunsang Jeong (chunsang) wrote :

Currently, "adb reboot" only reboot android container, so after "adb reboot" commands turn off android container, second try of adb reboot returns "reboot failed: -1" all the time because adbd failed to read "sys.powerctl" from android container.

android-tools-adbd-reboot-watcher.conf is supposed to get "sys.powerctl" from android container before it reboots and do /sbin/reboot to reboot ubuntu but it doesn't run successfully, which I'm looking into.

Changed in canonical-devices-system-image:
assignee: nobody → Chunsang Jeong (chunsang)
importance: Undecided → Critical
Revision history for this message
Chunsang Jeong (chunsang) wrote :

Even changing sys.powerctl from android container, didn't make android-toos-adbd-reboot-watcher start which triggers sys.powerctl=reboot*

 start on android-container sys.powerctl=reboot*

$ initctl list | grep reboot-watcher
android-tools-adbd-reboot-watcher stop/waiting

From vivid, the status changed while running script if sys.powerctl is set reboot*.
$ initctl list | grep reboot-watcher
android-tools-adbd-reboot-watcher start/running

Revision history for this message
Ondrej Kubik (ondrak) wrote :

abd reboot from Ubuntu has following steps:
1) adbd sets android property "sys.powerctl" to "reboot"/"reboot recovery" or any supported value
2) this is picked by Android inside container, and Android shuts down in controlled way
3) on Ubuntu side we have Upstart job /etc/init/android-tools-adbd-reboot-watcher.conf
   which is waiting for Android property "sys.powerctl" change, when value "reboot*" is detected, it waits for 1 second to give Android time to finish shut down, and then it executes "/sbin/reboot -f <optional value>" to reboot Ubuntu.

As Chunsang mentioned, calling adb reboot twice, will result in error, as Android is shut down and adbd fails to even change value of Android property "sys.powerctl" and returns error "reboot failed: %d".

Considering Chunsang's findings we have first 2 steps working.
For third step there could be 2 reasons for reboot not working:
- upstart job is not picking android property change
  this could be caused, either by Android side (upstart-property-watcher is not working) or upstart is broken and does not parse property changes correctly.
  We can have race between UpstartPropertyWatcher signalling to upstart and Android shutting down. upstart-property-watcher logs to logcat with tag "UpstartPropertyWatcher", so we should be able to see "sys.powerctl" change in logs, if it's missing then we have race condition on Android side.
Otherwise we can add trace to /etc/init/android-tools-adbd-reboot-watcher.conf to see if signal is received by upstart script.

- /sbin/reboot -f does not work
 - this could be easily tested by running /sbin/reboot -f from shell manually

Either way, this is very upstart related, so so considering we are moving to systemd, we might give this bug lover priority unless easy fix......

Revision history for this message
Paul Larson (pwlars) wrote :

Anyone still working on this? I can reproduce this easily on a m10 tablet that we are trying to use for automated testing, and it's a bit of a blocker to our automation.

Revision history for this message
dinamic (dinamic6661) wrote :

can reproduce this on m10, staging r138

Revision history for this message
Chunsang Jeong (chunsang) wrote :

It happened only when using systemd as commented at #4.

Please share info which device and version it still happens from? and can try ad-hoc way as "adb shell /sbin/reboot -f" before everything is settled down?

Changed in canonical-devices-system-image:
assignee: Chunsang Jeong (chunsang) → nobody
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.