Tutorial: How To Protect and Restore Root (4.2.2 Pre-Camera Update Only)

Did this method help you keep root?


  • Total voters
    51

Dark9781

Senior Member
Apr 21, 2009
803
262
0
This tutorial will explain how to protect and restore root for the OTA update.

Disclaimer: If you wish to keep root, DO NOT accept the OTA Update before running through these steps. PwnMyMoto will not work after updating since bug 9695860 (2nd Master Key) was patched. I am not responsible if this bricks your phone. Use at your own risk.


First I would like to thank JCase. If it wasn't for his original root method this would not be possible.

Prerequisites:
Moto X
A data cable (one that came with the phone woks fine)
Root - Grab JCase's program PwnMyMoto from this thread: http://forum.xda-developers.com/showthread.php?t=2444957
ADB & Fastboot (attached to post if anyone needs it)
RSDlite - Can find it here: http://www.4shared.com/rar/HkfWKoC5/RSD_Lite_615__MTK_Patch.html
SuperSU (in playstore, can't guarantee other Superuser programs can restore root)
SUPERCURIO's OTA RootKeeper or equivalent root keeper program (in playstore)
FXZ file for your carrier - Can be found here: http://sbf.droid-developers.org/ghost_rcica/list.php

Steps to Restore Root:
1. Make sure that there are no modifications to the system files. If there are the update will fail to flash. There are two way to go about this. You can flash back to stock using the FXZ for your carrier and rsdlite or fastboot (whichever you prefer) or remove the modifications if you know what they are. If you just removed all mods then skip to step 3.

Note: If you use rsdlite to flash back to stock remember to remove the getvar command from the xml file. If you use fastboot to flash back to stock use the following post as a reference how:
http://forum.xda-developers.com/showpost.php?p=45809324&postcount=3


2. Now you will need to install PwnMyMoto and then run it. After 2-3 reboots you should be rooted.

3. Make sure you install SuperSU and OTA RootKeeper.

4. Shutdown your Moto X. Then hold the power and down volume keys for about 5 seconds to boot into the bootloader. Scroll down with the down volume key to recovery and press the up volume key. You will be booted into android with write protection disabled.

5. Open up SuperSU. If it asks you to update the binary update it. You are going to want to make sure Survival mode is checked.

6. Open OTA RootKeeper. Grant it superuser rights and click Protect Root. It will save a backup of su. After that click Temp. un-root (keeps backup). This will hide root on your device.

7. Next we are going to flash the stock recovery. You will need fastboot, a command prompt and the stock recovery.img. For the recovery,img you can either grab the backup (recovery-stock.img) that is saved to the root of your device or you can grab the one from your carrier's FXZ. If you use the recovery from the FXZ you should also grab boot.img since we are going to be using it later. So unzip the fastboot files into a folder that you can easily locate. I placed it in C:\ for easy reference. Make sure your recovery and boot.img are in the same folder.

8. Now shutdown your Moto X and boot into the bootloader as we did in step 4. Open your command prompt by going to your start menu clicking run and typing cmd.exe (for windows 8 just use the search in the start screen and search for cmd under apps). This will bring up the command prompt. Now we need to change the directory to the folder you placed the fastboot and recovery files in. To do this type in
Code:
cd C:\ (example: cd C:\fastboot)
9. Make sure you connect your phone to you computer via your data cable and that all the moto drivers are installed. Windows will usually automatically detect them. Once your connected and set to got we are going to type the following command into the command prompt:
Code:
fastboot flash recovery recovery.img (replace recovery.img with recovery-stock.img if you pulled the backup from you device).
Don't exit the command prompt. We will be using it again shortly.

10. So now you are ready to take the OTA Update. Boot your phone up by either choosing Normal Powerup or using the following fastboot command:
Code:
fastboot reboot
Once rebooted flash the OTA Update.

11. Your phone will reboot into recovery for the flash. Once it is complete it will boot up like normal and optimize any changes made to the system. Once this is done SuperSU will try to automatically restore root, but will fail due to booting with write protection enabled. This is where boot.img comes into play

12. Shutdown your Moto X and boot into the bootloader again. Make sure to connect your phone to your computer via you data cable if you disconnected it after flashing recovery. Bring up your command prompt and type the following command:
Code:
fastboot flash recovery boot.img
This will allow you to reboot into android with write protection disabled by hijacking the recovery like JCase did with his original exploit.

13. Now boot into recovery from the bootloader. Once you are booted back up SuperSU will now be able to restore root automatically.

The next set of steps will show you how to pull the new boot.img from your phone so you can flash it to the recovery partition so there are no issues caused by using the old boot.img. These steps are completely optional. If you are uncomfortable doing this I recommend waiting for the fxz file for the update to be released to get the new boot.img.
Note: ADB is required to do this. It is now included with the fastboot files attached to this post.

14. After root access is restored you are going to go back to your command prompt. Type the following commands:
Code:
adb shell
su
dd if=dev/block/mmcblk0p33 of=/mnt/sdcard/boot.img
exit
exit
adb pull mnt/sdcard/boot.img
This will save a copy of the boot.img to the root of your phone and then save it to the directory that your fastboot and adb is in.

15. Now we are going to boot back into the booloader. Refer to step 4 for a reference how. Once booted into the bootloader type the following commands into the command prompt:
Code:
fastboot flash recovery boot.img
Now whenever you boot into recovery your phone will load with the new kernel and you should not have any more issues.

These next set of steps will allow you to fix the issue of the baseband failing to update during the OTA update.

16. If your baseband didn't update with the OTA then you will need to grab the FXZ of the update. Unzip the file NON-HLOS.bin and place it in the folder that contains fastboot.

17. Bring up your command prompt and and type the following commands
Code:
fastboot flash modem NON-HLOS.bin
fastboot erase modemst1
fastboot erase modemst2
Now your baseband will be up to date.
 

Attachments

Last edited:

Dark9781

Senior Member
Apr 21, 2009
803
262
0
Thanks so much for this! Quick question. If I am completely stock (never rooted this device before) I can start on step 2 correct?

Sent from my White Moto X
Yup. Step 1 is only for those that have already rooted and have modded the system files.
 

mmad81

Senior Member
Nov 1, 2010
268
30
48
I'm receiving my Verizon moto x tomorrow so if I read this right I don't except the update, root the moto x continue with these steps, and we will continue to receive updates and maintain root?
 

capathy21

Senior Member
Jul 10, 2011
230
53
0
Pineville,La
Yup. Step 1 is only for those that have already rooted and have modded the system files.
Thanks! One last question I promise. Can I go ahead and go through the process up to step 10 that way I'll be ready when the ota comes, or should I wait till the ota comes then begin the process?

I've always rooted and flashed updates on past devices so I'm not real familiar with ota's and don't want to take it before I'm able to run this process.

Thanks in advance!

Sent from my White Moto X
 

Dark9781

Senior Member
Apr 21, 2009
803
262
0
Thanks! One last question I promise. Can I go ahead and go through the process up to step 10 that way I'll be ready when the ota comes, or should I wait till the ota comes then begin the process?

I've always rooted and flashed updates on past devices so I'm not real familiar with ota's and don't want to take it before I'm able to run this process.

Thanks in advance!

Sent from my White Moto X
Yup. You could do that.
 

Dark9781

Senior Member
Apr 21, 2009
803
262
0
I'm receiving my Verizon moto x tomorrow so if I read this right I don't except the update, root the moto x continue with these steps, and we will continue to receive updates and maintain root?
It should work on Verizon when they release an update. I can't say this will work for future updates or even for 4.3 when it comes around, but for this round of updates it will work to keep root.
 

mj0528

Senior Member
Feb 10, 2011
928
50
0
Austin, Tx
It should work on Verizon when they release an update. I can't say this will work for future updates or even for 4.3 when it comes around, but for this round of updates it will work to keep root.
what has been the success rate of this? I'm surprised more haven't jumped on this! Why are so many trying to unroot to get the camera update?
 

Dark9781

Senior Member
Apr 21, 2009
803
262
0
what has been the success rate of this? I'm surprised more haven't jumped on this! Why are so many trying to unroot to get the camera update?
I thought this method would work when I saw the T-Mobile update come out, but couldn't test it myself until 2 days ago. That's why I released a tutorial last night. For those unroofing to get the update, they were told prior to the release of the tutorial that they will lose root and have to return to stock to run the update. As for success rate I'm not sure how many have successfully done this and kept root. I'll add a poll to get an idea.

Sent from My Moto X
 

rmead01

Senior Member
Sep 6, 2012
1,157
265
0
I thought this method would work when I saw the T-Mobile update come out, but couldn't test it myself until 2 days ago. That's why I released a tutorial last night. For those unroofing to get the update, they were told prior to the release of the tutorial that they will lose root and have to return to stock to run the update. As for success rate I'm not sure how many have successfully done this and kept root. I'll add a poll to get an idea.

Sent from My Moto X
I'm ready to go. Un froze all my apps and just waiting for ATT to push my update. Anything special I have to do to get the OTA or is it just a slow roll out? Also, do I need the default recovery to see the OTA, or will I see the OTA before I change anything to prepare for it?
 
Last edited:

Dark9781

Senior Member
Apr 21, 2009
803
262
0
I'm ready to go. Un froze all my apps and just waiting for ATT to push my update. Anything special I have to do to get the OTA or is it just a slow roll out?
Right now the AT&T version is still in a soak test. A soak test can usually go for 3-7 day. After that there will be an official release. Just need to hang tight until the release. As of right now the saok has been going for about 2 1/2 days.
 

rmead01

Senior Member
Sep 6, 2012
1,157
265
0
Right now the AT&T version is still in a soak test. A soak test can usually go for 3-7 day. After that there will be an official release. Just need to hang tight until the release. As of right now the saok has been going for about 2 1/2 days.
Gotcha. Thought a bunch of people were saying they had the ATT OTA rolling out. Maybe I just misread and it was tmobile or something. I've never actually done an OTA update on any of my android phones. Always running a custom software, so I'm not 100% sure what needs to be setup correctly on the phone to receive it.

As of now, all system files are stock except for the hosts file which is modified from adfree. All apps on the phone are unfrozen and in their default from the store state. I still have the writable system recovery installed because I wasn't going to install the default recovery until I was absolutely ready to flash the OTA. I may still need root until then.
 

jayboyyyy

Senior Member
Oct 26, 2012
947
181
0
Right now the AT&T version is still in a soak test. A soak test can usually go for 3-7 day. After that there will be an official release. Just need to hang tight until the release. As of right now the saok has been going for about 2 1/2 days.
do you have to wait on the official release for this too work? I know some people are putting the soak test build which is most likely the official release on their phone and upgrading from the stock recovery. Basically manually taking the OTA in case I explained that weird. Can you still use your method of keeping root by manually taking the OTA? I am on verizon so I will most likely be manually upgrading when the soak test comes out assuming I can still keep root.
 

Dark9781

Senior Member
Apr 21, 2009
803
262
0
do you have to wait on the official release for this too work? I know some people are putting the soak test build which is most likely the official release on their phone and upgrading from the stock recovery. Basically manually taking the OTA in case I explained that weird. Can you still use your method of keeping root by manually taking the OTA? I am on verizon so I will most likely be manually upgrading when the soak test comes out assuming I can still keep root.
The soak test versions usually end up as the official version. It is rare for a soak test version to not make it to official unless there are detrimental problems discovered during the soak. You can flash the OTA manually and use this method to keep root.
 
  • Like
Reactions: jayboyyyy

docslate

Senior Member
Nov 3, 2010
115
3
0
It should work on Verizon when they release an update. I can't say this will work for future updates or even for 4.3 when it comes around, but for this round of updates it will work to keep root.
Just to confirm. Will this work on Droid Maxx? I haven't purchased yet, but root and tethering ability are very important to me. Also, does anybody know where Verizon is on the OTA schedule for the Maxx?
 

Dark9781

Senior Member
Apr 21, 2009
803
262
0
Just to confirm. Will this work on Droid Maxx? I haven't purchased yet, but root and tethering ability are very important to me. Also, does anybody know where Verizon is on the OTA schedule for the Maxx?
I would think it should work for the Maxx too, but I can't be sure until someone with a Maxx tests it. My sister just got the Ultra while she was on vacation. She'll be home this weekend. I'll see if she would let me play with her phone.
 

mj0528

Senior Member
Feb 10, 2011
928
50
0
Austin, Tx
ready for the OTA and I'll give it a go

so what would the rsdlite to default look like if we took the OTA but then wanted to go back to complete stock one day. Would the rsdlite work since the OTA is installed?
 
Last edited:

jayboyyyy

Senior Member
Oct 26, 2012
947
181
0
ready for the OTA and I'll give it a go

so what would the rsdlite to default look like if we took the OTA but then wanted to go back to complete stock one day. Would the rsdlite work since the OTA is installed?
as long as the file packages are available you will always be able to go back to stock.
 
  • Like
Reactions: mj0528
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone