9

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?

11

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.

  • 1
    You shouldn't need the full path for reboot, but this is exactly right. – Matthew Read Mar 26 '12 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. – Android Quesito Mar 26 '12 at 17:46
  • why can i do this?? the terminal emulator gives me a error said "operation not permitted" what can i do?? Thanks – user62129 Jun 3 '14 at 11:22
  • @Otech1408 You have to have a rooted device to do this. – onik Jun 3 '14 at 12:33
  • on non rooted devices you can achieve this through adb: adb reboot recovery – divided-by-zero Apr 7 '15 at 6:39
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.

  • 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 '16 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! – David Given Mar 8 '16 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 '16 at 22:21
  • Don't worry, I totally agree. I just thought it was amusing quite how dusty this question was... – David Given Mar 8 '16 at 22:34
  • 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 '16 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.