10

Does anyone know if there's a way to get an Android phone to reboot into recovery mode, from the Android command line?

Note:

I do NOT have adb access.

I do NOT know the magic power-on sequence to do it from the boot loader. I've tried the common things and nothing works.

I DO have root. (And can enter commands directly on the device using a terminal emulator.)

I know it's possible, somehow, because applications like ROM Manager do it. But how?

2 Answers 2

12

Generally, reboot binary provides a recovery switch. After switching to root, execute this command:

/system/bin/reboot recovery

This may not work if your manufacturer doesn't support it. ROM Manager type apps uses API of Android which you can't access via Terminal Emulator directly.

6
  • 1
    You shouldn't need the full path for reboot, but this is exactly right. Mar 26, 2012 at 17:30
  • 1
    @MatthewRead Yup, full path is really not needed. :) But, I didn't want to leave a chance in case someone messed up with PATH variable.
    – iOS
    Mar 26, 2012 at 17:46
  • @Otech1408 You have to have a rooted device to do this.
    – onik
    Jun 3, 2014 at 12:33
  • on non rooted devices you can achieve this through adb: adb reboot recovery Apr 7, 2015 at 6:39
  • You might need to type su in terminal to gain root access before running reboot recovery. Apr 8, 2015 at 17:12
2

I tested the following command on stock Android 5.0 and 6.0.1, CM 14, and Android 8.1.0 with graceful shutdown and reboot to recovery:

su -c 'svc power reboot recovery'

It worked on Android 4.4.2 as well but the shutdown appeared to be low-level. It requires root access though.

Alternatively, if you're running Android KitKat or above* and have root access, you can try this command in a terminal app:

su -c 'setprop sys.powerctl reboot,recovery'
  • replace su -c with adb shell to run the command using
  • replace reboot,recovery with reboot to reboot the device
  • replace reboot,recovery with shutdown to shutdown the device

Note that all of those setprop commands would do a low-level (unclean; not graceful) shutdown/reboot.

In Android Lollipop and above*, you can also try:

su -c 'setprop ctl.start pre-recovery'

For Android Jelly Bean and below, SS-3's answer appears to be the only possible solution.


* The last version on which the command is tested upon is stock Android 6.0.1.

4
  • CM's su binary I suppose doesn't have -c argument, so first switch to root user using su and then execute the quoted command
    – Firelord
    Mar 8, 2016 at 21:44
  • 1
    I believe it was running either cupcake or donut. Regardless, it went off to the great phone recyling centre in the sky long ago. But thanks anyway! Mar 8, 2016 at 22:17
  • 1
    @DavidGiven : It may be appearing quite silly that I revived an old question but I did that because you didn't mention a particular Android version so I tried to use it as an opportunity to mention what would work not only for you but for other and successive Android versions as well. It also helped me in avoiding forking a duplicate question but for other Android versions.
    – Firelord
    Mar 8, 2016 at 22:21
  • 1
    The "su -c 'svc power reboot recovery'" is working on my cm14.1 (android 7.1) based rom. It is shutting down gracefully before rebooting into recovery. This is the best solution i have come across so far.
    – keen
    Nov 3, 2016 at 9:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .