ubports / ubuntu-touch

Ubuntu Touch's issue inbox is now migrated to GitLab.
https://gitlab.com/ubports/ubuntu-touch
1.28k stars 110 forks source link

Android9 devices fail to reboot with 'adb reboot *arg*' #1837

Open UniversalSuperBox opened 3 years ago

UniversalSuperBox commented 3 years ago

Steps to reproduce

  1. Enable developer mode
  2. Reboot
  3. Run adb reboot bootloader or adb reboot recovery

Expected behavior

The device reboots to the specified argument

Actual behavior

The adb reboot ... command hangs, as does the device. The only obvious way to recover is to force a reboot by holding down the power key.

Logfiles and additional information

Pixel 3a: https://gist.github.com/UniversalSuperBox/a1e152a992c800d1973af369a71cb57e Volla Phone: https://gist.github.com/UniversalSuperBox/d980180c4340fb993fde9a8f4bd52d93

Funny enough, you can get another shell into the device in this state. Running sudo reboot there causes the Pixel 3a to boot into the selected mode, but the Volla Phone does not.

This interrupts the UBports Installer's flow of rebooting the device to bootloader for flashing.

fredldotme commented 3 years ago

For the Pixel 3a the issue starts here: https://gist.github.com/UniversalSuperBox/a1e152a992c800d1973af369a71cb57e#file-gistfile1-txt-L4229

Since to the kernel a container-side restart is causing a restart of its init at best, and since it's apparently done via a setprop command, this causes to run into a situation where the container keeps restarting endlessly instead of having the whole system (including the hosts init) receive the reboot request.

I think we've talked a lot about requiring a property watcher for a handful of things in the past, this seems to be another one of those issues. Listening on that property change could help the host system decide and cause its init to trigger a kernel-respected reboot into whatever mode the user desires.

Flohack74 commented 3 years ago

@fredldotme alright but why this was working in 5.1and maybe even 7.7 device so well then?

fredldotme commented 3 years ago

@fredldotme alright but why this was working in 5.1and maybe even 7.7 device so well then?

Does it actually work on any Halium 7.1 device? Doesn't seem to be the case for suzu.

mardy commented 2 years ago

Since to the kernel a container-side restart is causing a restart of its init at best, and since it's apparently done via a setprop command, this causes to run into a situation where the container keeps restarting endlessly instead of having the whole system (including the hosts init) receive the reboot request.

I noticed that (at least on violet) the lxc-android-config service is stopped when the adb reboot bootloader command is given. Since I guess we want lxc-android-config to be always running, maybe we can configure its upstart (systemd, in Focal) job to restart the system when it gets stopped?

Do we know how to restart the system into a certain boot mode, from Linux? Or is this device specific?