HOW TO UNROOT (ALMOST) ALL ANDROID DEVICES (SIMPLIFIED)
Firstly, in order to unroot your android device, you need:
1) An update available for your phone or an old nandroid backup that has a previous version of your phone android version
2) A nandroid backup done before you attempt the following steps below
Once the above conditions are met, you are ready to UNROOT your phone!
Before you read the procedure, read how it works
below and get a better picture:
HOW
Firstly, one known method of unrooting is to install an available system update. However, stock updates are signed with official keys and custom recoveries only accept updates signed with their custom keys.
So, to unroot, you need to have stock recovery installed. One way to get your phone`s stock recovery back is contained in the update zip.
The update zip is the key, literally. Look through it and you will find (usually in the system folder) a file called recovery.img, which will be used as your new stock recovery.
By flashing in the image into recovery, you can now install updates, keep your previous applications, enjoy being unrooted and updated.
There are other unroot options that tailor to specific android phones and versions, but this solution should work on all android phones.
Why unroot? Because sending in a rooted phone for repair will void your warranty. Also, by having a rooted phone, you run the risk of a rogue rooted application that does unwanted stuff to your phone.
PROCEDURE
Step 1) If you still have your original stock recovery that came with your phone, continue. Else search for my previous thread: "[RECOVERY] Reverting to original(STOCK) recovery" and follow the steps there. You can use the update file you used to revert to stock recovery here as well or vice versa
Step 2) Reboot you phone
Step 3) Check for system updates and download them
Step 4) Wait until phone reboots. All your applications and user settings will be retained.
Step 5a) Open up a terminal emulator on your phone and enter "su" (Check if unroot)
Step 5b) If you cant turn your phone on to check if unrooted, boot into recovery mode, open up adb enter:
Code:
adb shell
su
Step 6) If you get "permission denied" or something like that from step 5a/5b,
CONGRATULATIONS! YOUR PHONE HAS BEEN SUCCESSFULLY UNROOTED!
Step 7) If you don`t want to void your warranty, you should unistall applications that require root, especially Superuser
To date, I have rooted and unrooted my phone (Backflip) 3 times without any problems. In case your phone can`t be booted up, only to the bootloader or recovery, DO NOT WORRY! You can use the adb (android debug bridge) to flash in the stock recovery, push/pull the updates and reboot the phone into recovery mode or normal mode!!!
Useful ADB commands
Reboot Phone
Code:
adb shell
reboot
Reboot Phone into recovery mode
Code:
adb shell
reboot recovery
Flash a new recovery image temporarily (resets when rebooting)
Code:
adb shell
flash_image recovery /sdcard/recovery.img
Flash a new recovery image that does not reset when rebooting
Code:
adb shell
flash_image recovery /sdcard/recovery.img
exit
adb shell
cd system
su
mount -o rw,remount /dev/block/mtdblock1 /system
rm recovery.img
mount -o ro,remount /dev/block/mtdblock1 /system
exit
exit
Push file to sdcard
Code:
adb push file.blah /sdcard/file.blah
Push file to sdcard
Code:
adb pull /sdcard/file.blah file.blah
Here`s wishing you good luck and a belated happy new year!
Err.. Pretty cool info there but what if you don't meet above three requirements? I mean there are noobs like me who'd rather jump onto flashing while forgetting about nandroids etc. I guess there should be a one click unroot utility for all android devices like we have for rooting.
im really confused.
if the phone has been rooted (using fastboot oemunlock - yes) then how can we "unroot" this device? till today there has not been a way to do so.
but if what ur suggesting relocks the bootloader (removes the cross at bootup) then woohoo!
The main point
ok, i think you guys dont understand what my point on unrooting is...
What im trying to say is:
Updating your phone software with an original OTA update on the original rom the came with your phone will automatically reset root. However, custom roms and recoveries dont accept OTA updates, so you need to flash back your original recovery first, nevermind if you have a custom rom.
If you don`t meet the requirements, then i`m sorry, you`ll just have to wait for an available system update like me. However if you get one, be sure to come back here if you want to unroot.
Creating a one/two click-unroot application
Actually, you may be right. The unroot procedures can also be carried out by adb alone , not by user interaction. So a desktop application can be created that automates the process
1) Open adb shell
2) Enter su
3) Pull the update zip from the phone
4) Recursive/y search the zip for the file recovery.img
5) Run 'flash_image recovery recovery.img'
6) Run 'adb reboot' to reboot phone
7) Phone will install update on stock update when rebooting complete
8) When update installed, root will be removed and your phone will be updated as well!
We can send keystrokes to the adb for the adb shell.
siidheesh said:
Actually, you may be right. The unroot procedures can also be carried out by adb alone , not by user interaction. So a desktop application can be created that automates the process
1) Open adb shell
2) Enter su
3) Pull the update zip from the phone
4) Recursive/y search the zip for the file recovery.img
5) Run 'flash_image recovery recovery.img'
6) Run 'adb reboot' to reboot phone
7) Phone will install update on stock update when rebooting complete
8) When update installed, root will be removed and your phone will be updated as well!
We can send keystrokes to the adb for the adb shell.
Click to expand...
Click to collapse
Shouldn't be too hard, probably only a simple script would suffice I'll see what I can come up with (if I can do anything ). Supply the script with your required update zip to make it work in a different way (maybe, I'm not great with details)
Automated Script
Can someone please clarify that this would work (as an unroot script):
1. Opens ADB shell
2. Enters su
3. (User) Supply script with stock update.zip - in case it's not on phone (correct if this is unnecessary)
4. recovery.img extracted from update.zip
5. recovery.img flashed to phone via 'flash_image recovery recovery.img'
6. Reboots phone via 'adb reboot'
That installs stock recovery, but what if there was no OTA update to install for that particular device? That's the only problem I can see with such a script, so I'm hesitant to make it right now (besides, I don't have my Nexus with me at the moment, so I couldn't test it).
Dumb question but would flashing a stock update.zip from the stock recovery remove root? Or does it have to be OTA? Never having done it before I'm not sure.
Edit: If it did have to be OTA, maybe you could find the original update.zip (ie. no updates before it) and flash that, so there would be a higher chance of an OTA update?
Different definitions
Sorry people, when i mean ota update, i dont just over-the-air updates, i am referring to original updates for your original android system that came with your phone.
siidheesh said:
Sorry people, when i mean ota update, i dont just over-the-air updates, i am referring to original updates for your original android system that came with your phone.
Click to expand...
Click to collapse
So just to clarify, you could install any stock ROM for your device and it would remove root? Specifically if it was installed through stock recovery.
Thanks, hopefully I might be able to make some progress after this
not as easy as it seems
jonathongrigg said:
Can someone please clarify that this would work (as an unroot script):
1. Opens ADB shell
2. Enters su
3. (User) Supply script with stock update.zip - in case it's not on phone (correct if this is unnecessary)
4. recovery.img extracted from update.zip
5. recovery.img flashed to phone via 'flash_image recovery recovery.img'
6. Reboots phone via 'adb reboot'
That installs stock recovery, but what if there was no OTA update to install for that particular device? That's the only problem I can see with such a script, so I'm hesitant to make it right now (besides, I don't have my Nexus with me at the moment, so I couldn't test it).
Dumb question but would flashing a stock update.zip from the stock recovery remove root? Or does it have to be OTA? Never having done it before I'm not sure.
Edit: If it did have to be OTA, maybe you could find the original update.zip (ie. no updates before it) and flash that, so there would be a higher chance of an OTA update?
Click to expand...
Click to collapse
You cant make an unroot script that easily. Im halfway working on a .net application that does it on desktop.
Also, almost all great things come with a *catch*. In this case, you need to wait for an ota update to be available. Or if you took a nandroid backup some time back and updated your version, you can revert back to the old verison and update again.
siidheesh said:
You cant make an unroot script that easily. Im halfway working on a .net application that does it on desktop.
Also, almost all great things come with a *catch*. In this case, you need to wait for an ota update to be available. Or if you took a nandroid backup some time back and updated your version, you can revert back to the old verison and update again.
Click to expand...
Click to collapse
Oh well, I didn't realise I figured you could do it all from the command line, so a script of some kind might do. That said I wasn't entirely sure as I couldn't test the theory (no phone )
siidheesh said:
In this case, you need to wait for an ota update to be available. Or if you took a nandroid backup some time back and updated your version, you can revert back to the old verison and update again.
Click to expand...
Click to collapse
Another win for stock Android phones No waiting months for OTA updates! Well good luck on your .NET application, I only know Java and Python, so I can't really help you there, sorry.
dont know
my phone (Backflip) isnt a very popular phone and there`s only one rom for it. to date, i`be only tried unrooting via stock updating. Stock roms may work too, but im not sure...
adb shell
jonathongrigg said:
Oh well, I didn't realise I figured you could do it all from the command line, so a script of some kind might do. That said I wasn't entirely sure as I couldn't test the theory (no phone )
Click to expand...
Click to collapse
actually, i did mention that the unroot procedure can be done entirely from the adb shell, which is also in command line. im just making a program to enter those lines in automatically. normal batch scripts cant write to the adb shell as it is a separate shell in the command prompt...
What about doing a factory reset?
hi, would these unroot methods still work on the new updated highly secured samsung galaxy s2?
because i got the phone simlocked hoping to unlock it for t-mobile so rooted the phone but it was been unsuccessful at taking the sim lock off, so i wanted to make sure that this will still work on this phone.
Also after unroot i assume the yellow triangle will disappear, right?
oh yea thanks for replies and help in advance. Love the site
total noob here, I rooted my tab awhile bk, now needs warranty. I used 'superoneclick', but didnt backup anything first that i know of. U mention nandroid backup, update available for my phone, where do I get that, and how? Embarrassed I know nothing about these terms, trying to learn. Could u help me, please?
where can I find the recovery.img?
thanks
Does this work on all roots?
Hello, all. First thread here on Xda, so I apologize if I missed something.
I own a myTouch 4g 2.3.4 and use an Ubuntu 11.04 desktop. I have the official SDK and ADB installed.
I'm looking to root my myTouch 4g and understand that as of now there is no method available for devices running 2.3.4... This means I need to downgrade in order to root... I've searched and searched and searched but am unable to find any guides on downgrading for those who use Linux.
wiki[dot]cyanogenmod[dot]com/wiki/HTC_Glacier:_Full_Update_Guide
I reviewed the above guide but was faced with quite a few programs in the rooting process that are available only for Windows.
Any help?
Looking to use Cyanogen as my rom, and therefore need to be running Android version 1.17.531.2
Okay, due to me being a noob I quickly discovered after more research that the platform is not a matter of concern when using the guide above.
HOWEVER...
I have a new problem...
Towards the bottom of the first section (this part
"Now that misc version has been downgraded, the HTC Glacier is ready to have the firmware downgraded. On the computer, open terminal and run the following commands:
adb push PD15IMG.zip /sdcard/PD15IMG.zip
adb shell md5sum /sdcard/PD15IMG.zip
NOTE: The md5 should match up the provide the original download location. If not, redownload & try again.
adb reboot bootloader
Use Volume up/down keys on the HTC Glacier for navigation and Power key for confirmation. Select Fastboot to flash the 1.17.531.2 firmware.
Once finished you can can continue to the next section.
I get an error when performing the following command:
adb shell md5sum /sdcard/PD15IMG.zip
md5sum: not found
Any help?
I have installed the 5.5.0.4 recovery from Koush via Rom Manager. That recovery is broken and it will not let me flash another recovery. I am asking someone who knows how to push a different custom recovery ( like rogue recovery http://bit.ly/ADptUO ) to the device using ADB, to write a step by step guide with all the commands and necessary files to do so. This will help many people who are stuck in the same situation that I have found myself in. Any help will be appreciated, thank you.
This might get you part of the way there. There might be something in there about flashing a new recovery too.
http://forum.xda-developers.com/showthread.php?t=1530337
gee one said:
This might get you part of the way there. There might be something in there about flashing a new recovery too.
http://forum.xda-developers.com/showthread.php?t=1530337
Click to expand...
Click to collapse
It says to type the command though ADB while in CWR... my device does not show up in ADB while in recovery.
If you have access to the rom, you can copy your new recovery to the internal sdcard. You can also type the command in the rom with adb or terminal, but be careful since anything that you have in the staging partition will flash after you type the commands and then reboot. So, 1) copy rom to the internal sdcard, 2) reboot to recovery, 3) flash new recovery (nothing will happen yet) 4) reboot to the rom) 5) type commands in adb 6) reboot 7) then make a step by step guide for the next person.
sent from my cyanogen(mod) vision
Hi! I was trying to backup my Orange Monte Carlo following a Portuguese tutorial but I'm stuck in the middle and I've got no help! Hope you can provide some! These are the steps I followed (translated)
1 - Install ADB Made Easy;
2 - Open cmd;
3 - Activate cellphone debug mode;
4 - Connect via usb (without mass storage) and install drivers if request [it was requested and i installed];
5 - Run adb devices, it should show your device [it did];
6 - Run adb reboot bootloader, your cellphone will boot in Fastboot, wich is an Android image without menus [correct until here];
7 - Run fastboot devices, your device yor a question mark(?) should show up (advance to next step), else you miss drivers [step not completed];
cmd says 'fastboot' is not recognized as a command. Now my phone is stuck connected to the computer with an adriod pick and I have no clue on what to do next!
Don't know where you were going with this but to reboot your phone just pull the battery ..
Not bricked
shanman-2 said:
Don't know where you were going with this but to reboot your phone just pull the battery ..
Not bricked
Click to expand...
Click to collapse
Thank you! Do you have any idea why the last command doesn't work? I believe it has something to do with file location... I'm trying to backup my Monte Carlo. Next steps were to "fastboot boot recovery.img" and then backup.
It should be in the platform-tools directory of the android-sdk. Verify that it's there...if so cd to that directory and it should work
I already fixed it for myself, thanks! Now I can't seem to be able to install clockwork!
Doing <<fastboot boot "C:\Users\R&J\Downloads\recovery.img">> reboots the device but doesn't enter recovery.
Doing <<fastboot flash recovery "C:\Users\R&J\Downloads\recovery.img">> , <<fastboot reboot>> and <<adb wait-for-device reboot recovery>> results the phone entering android's default recovery (no acess to backup feature).
Any way to help? Thank you!
The first command <<fastboot flash recovery "C:\Users\R&J\Downloads\recovery.img">> is trying to write the recovery.img you downloaded to a recovery partition on your device. It may not be overwriting the original recovery.
try changing permissions by doing
adb shell
su
chmod 777 /recovery
then try to flash again
Lol it seems like I have been luck enough to solve my own problems, I have sucessfully installed ClockworkMod Recovery 4.0.1.4 unofficial MoDaCo Edition using a bat file . Now I can't seem to find a way to flash recovery back to stock. I though this was an option inside the modded recovery. Any tips? Thanks again!
EDIT: I have the stock recovery file . God... this tutorials I'm folowing aren't that noob friendly...
Hi lovely people,
I'd like to install CM13 on my HTC Desire S S510e. I have found way too many different instructions on how to proceed and I was wondering if there's a simple, step-by-step (I really mean step-by-step) guide on how to do it. By now, as far as I understand I should:
1. S-OFF my phone (although I heard it's possible to install a custom rom even with S-ON?). I've read that you can do it using HTCDev or Alpharev. However the HTC Desire S doesn't appear on the list of supported devices in the first link. Which device should I select from the list? On the other hand, the Alpharev website says that Alpharev is deprecated and one should use Revolutionary but the Revolutionary website is empty. Finally a more general question: what's the benefit of using HTCDev or Alpharev?
2. Flash sagaopt TWRP 2.8.7.1. I use ArchLinux. In Linux I'd have to install android-tools to have adb and fastboot, then do "adb reboot bootloader" followed by "fastboot flash recovery TWRP-recovery-sagaopt-2.8.7.1.img"? Or do I have to first install an older version of TWRP to convert my sdcard to EXT4 to then install the sagaopt 2.8.7.1 version?
3. Use TWRP to convert my sdcard to EXT4.
4. Install cm-13.0-XXXXXXXX-UNOFFICIAL-sagaopt.zip and gapps by putting the files into the sdcard using adb (what's the command to do this?) and then flash the files using TWRP.
What steps am I missing? What are the perils? What should I be particularly careful with?
Please help me understand and condense the heaps of information found in this forum.
Thanks,
Ricardo
rikardo.h said:
Hi lovely people,
I'd like to install CM13 on my HTC Desire S S510e. I have found way too many different instructions on how to proceed and I was wondering if there's a simple, step-by-step (I really mean step-by-step) guide on how to do it. By now, as far as I understand I should:
1. S-OFF my phone (although I heard it's possible to install a custom rom even with S-ON?). I've read that you can do it using HTCDev or Alpharev. However the HTC Desire S doesn't appear on the list of supported devices in the first link. Which device should I select from the list? On the other hand, the Alpharev website says that Alpharev is deprecated and one should use Revolutionary but the Revolutionary website is empty. Finally a more general question: what's the benefit of using HTCDev or Alpharev?
2. Flash sagaopt TWRP 2.8.7.1. I use ArchLinux. In Linux I'd have to install android-tools to have adb and fastboot, then do "adb reboot bootloader" followed by "fastboot flash recovery TWRP-recovery-sagaopt-2.8.7.1.img"? Or do I have to first install an older version of TWRP to convert my sdcard to EXT4 to then install the sagaopt 2.8.7.1 version?
3. Use TWRP to convert my sdcard to EXT4.
4. Install cm-13.0-XXXXXXXX-UNOFFICIAL-sagaopt.zip and gapps by putting the files into the sdcard using adb (what's the command to do this?) and then flash the files using TWRP.
What steps am I missing? What are the perils? What should I be particularly careful with?
Please help me understand and condense the heaps of information found in this forum.
Thanks,
Ricardo
Click to expand...
Click to collapse
3.check android version in system settings if it is lower or lower2.3.X (if its not it could be ****ty) than check bootloader version
3.1 turn off fastboot in battery settings
3.2 power don phone
3.3 boot phone with vol down clicked and if its -REVOLUTIONARY- or if its 0.98.x s-off or 2.0X s-off go to 6
if its 0.98 s-on you go to 5
if its 2.02 ask anyone else on my desires with 2.02 s-off newer worked for me but you can try it (go to 4) or only unlock it
http://www.htcdev.com/bootloader select HTC Desire HD and dont upgrade anything (start at step 1 skip preparation) after that go to 8
if its 2.00 contine
4.download the oldest rom with you branding from http://androidruu.com/?developer=Saga
4.1 http://forum.xda-developers.com/showpost.php?p=18746686 downlad misc_version
4.2 http://forum.xda-developers.com/showthread.php?t=1312859 download DooMLoRD_v4_ROOT-zergRush-busybox-su.zip and extract zergRush
4.3 go to folder with misc_version and zergRush and open cmd there and type
adb push misc_version /data/local/tmp/
adb push zergRush /data/local/tmp/
adb shell
cd /data/local/tmp/
chmod 777 zergRush
chmod 777 misc_version
./zergRush
./misc_version -s 1.27.405.6
exit
exit
exit
4.4 execute the firmware form step 4
5 download and follow http://rev.alpharev.nl
6 follow http://forum.xda-developers.com/showthread.php?t=1679338 (optional)
7 follow B in http://forum.xda-developers.com/showthread.php?t=1858508 (optional)
Installing
1.Flash TWRP 2.8.7.0
2.Format SDcard ext4
3.Flash TWRP 2.8.7.1 sagaopt
4.boot recovery
5.use "adb push your-system-sagaopt.zip /sdcard/"
6.Flash it with TWRP
7.(Optional) download GAPPS pico copy it do "internal storage" and install it with TWRP
for the complete tutorial look at http://forum.xda-developers.com/htc-desire-s/general/trying-to-install-cm13-htc-desire-s-t3414878 page 2 for the first one and page 1 for the second
---------- Post added at 09:36 PM ---------- Previous post was at 09:28 PM ----------
CM13 is to heavy for the phone CM12.1 is stable but slow (sometimes you miss a call because the mobile is too slow) CM11 is fast but old (i used CM12.1 now im using CM11 nightly but the gallery doesnt play videos i deleded it)
Thank you for reposting that guide and for suggesting CM11 instead of CM12.1 or CM13. In that guide it says that unlocking the 2.02 s-on using the htcdev tool doesn't work for him if I understand correctly. Also I went to the htcdev website and they say that the tool will remove all personal data including applications, text messages and personalized settings. However I wanted to install a recovery and make a backup of the phone as it is now and that wouldn't work if everything gets removed before installing the recovery. Is there a way to install a recovery without removing anything?
rikardo.h said:
Thank you for reposting that guide and for suggesting CM11 instead of CM12.1 or CM13. In that guide it says that unlocking the 2.02 s-on using the htcdev tool doesn't work for him if I understand correctly. Also I went to the htcdev website and they say that the tool will remove all personal data including applications, text messages and personalized settings. However I wanted to install a recovery and make a backup of the phone as it is now and that wouldn't work if everything gets removed before installing the recovery. Is there a way to install a recovery without removing anything?
Click to expand...
Click to collapse
I think you can try titanium backup with an oneclickroot (kingroot or framaroot) or unlock it with the risk of loosing data first backup contacts/sms and callhistoy with apps of the playstore and your sdcard isnt affected
Oh i could be that you need the win8+ fastboot fix for htcdev http://forum.xda-developers.com/htc-one-s/general/guide-fix-fastboot-windows-8-1-t2858337
and if it doesnt work use windows 7 (dont forget to install htc sync)
if its 2.00.0002/2.00.2000 you can s-off it if its 2.02.0002 its ****ty
I use linux. It's 2.00.0002 so I guess I should follow step 4, but step 4.4 asks me to execute a window's exe file which I can't execute. What should I do instead? Unlock it using htcdev as if it was 2.02 s-on or will that mess my phone up?
rikardo.h said:
I use linux. It's 2.00.0002 so I guess I should follow step 4, but step 4.4 asks me to execute a window's exe file which I can't execute. What should I do instead? Unlock it using htcdev as if it was 2.02 s-on or will that mess my phone up?
Click to expand...
Click to collapse
sorry for that step you need windows there is no other way
you can only unlock but the best way is to use a windows PC/Laptop of a dude or use a VM with windows 7 or XP with usb pass
google windows 7 iso and look for one you can use in vm
I found this https://code.google.com/archive/p/htc-flasher/wikis/HTCFlasher.wiki
Do you know if it would help?
you can try (you need your rom as NBH and the desire s (saga) isn't supported its risky) it but save is a Virtual Machine with windows and usb passthrough