[UNROOT] Unroot any android device

Search This thread

siidheesh

Member
Dec 19, 2010
38
35
28
Singapore
www.sidsoftinc.com
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!
 
Last edited:

aliwaqas

Senior Member
May 25, 2010
83
17
Islamabad
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.
 

Fiddlestix

Senior Member
Aug 1, 2010
75
1
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!
 

siidheesh

Member
Dec 19, 2010
38
35
28
Singapore
www.sidsoftinc.com
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.
 

siidheesh

Member
Dec 19, 2010
38
35
28
Singapore
www.sidsoftinc.com
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.
 
  • Like
Reactions: 0ldFlyer

Jonathon Grigg

Senior Member
Dec 11, 2010
1,226
242
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.

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 :p ). Supply the script with your required update zip to make it work in a different way (maybe, I'm not great with details)
 

Jonathon Grigg

Senior Member
Dec 11, 2010
1,226
242
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?
 
Last edited:

siidheesh

Member
Dec 19, 2010
38
35
28
Singapore
www.sidsoftinc.com
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.
 

Jonathon Grigg

Senior Member
Dec 11, 2010
1,226
242
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.

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 :D
 

siidheesh

Member
Dec 19, 2010
38
35
28
Singapore
www.sidsoftinc.com
not as easy as it seems

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?

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.
 

Jonathon Grigg

Senior Member
Dec 11, 2010
1,226
242
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.

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 :( )
 

Jonathon Grigg

Senior Member
Dec 11, 2010
1,226
242
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.

Another win for stock Android phones :p 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.
 

siidheesh

Member
Dec 19, 2010
38
35
28
Singapore
www.sidsoftinc.com
adb shell

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 :( )

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...
 

ness23

Member
Aug 9, 2011
28
0
London
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?
 

snakeyejake

New member
Sep 23, 2011
2
0
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?:confused:
 

Top Liked Posts

  • There are no posts matching your filters.
  • 25
    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!
    1
    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.
    1
    Requst

    sir i want to know that
    if i root my micromax a87 with software like unlockroot
    and again i unroot it with that software only
    warranty of my phon will lost
    as rooting losts warranty
    can i gain back the warranty by rooting
    or is there software to unroot and gain warranty
    plz repy my request
    yours user