A few months back, I rooted my Nexus 5 using Towelroot, installed TWRP and ElementX Kernel. Now as the Android Lollipop update is around the corner, I don't think I'll be able to install OTA update because of rooted phone and custom recovery. In some forums, I even read that it might mess up my phone.

So now, I want to know what is the safest way to get the official Android Lollipop update, I don't mind losing root, custom kernel and all that, I even searched going all stock, but that seems like a cumbersome solution with many risks. One easy way I was thinking of is downloading the Android Lollipop System image (tgz file) when Google uploads it and flashing that into my phone using TWRP.

However, I don't know how and can't find anything about how to flash a tgz file. Can I do it by placing it in the memory, booting into recovery/install/AndroildL.tgz. Will that do it? If yes, then what changes will it make> will my custom kernel and root be gone or not? Thank you

  • To install OTA revert back to stock with the factory image. You will go back to Stock Kernel and recovery. It's the best way. Or wait til someone builds a pre-rooted stock ROM and flash that, or a custom Lollipop ROM once they start getting released.
    – RossC
    Nov 6, 2014 at 11:38
  • "revert back to stock with factory image" can you please tell me how to do it using TWRP? or is their any other step by step guide available? Nov 6, 2014 at 12:04
  • Cool, consider it done! And now it is done!
    – RossC
    Nov 6, 2014 at 14:31

4 Answers 4


I think your best bet is to unroot your device and restore it to stock. This means stock ROM, recovery and kernel, and you will be unrooted. This is often referred to as "flashing a factory image", sometimes incorrectly. But that's what we're going to do!

Note: This process will wipe your phone completely. Backup your storage before you continue. I am also not responsible if anything goes wrong. Ensure you verify this is the correct device and code name (hammerhead) before you proceed.

From this excellent XDA thread:

For this process, you will need to:

Install adb and fastboot drivers. To do this, use this simple program

For MAC users *Note: MAC users will have to write ./ before every command in this thread. For example : ./fastboot flash recovery recovery.img

Linux users should know their stuff

Download the latest factory images from here

Extract the archive you downloaded (Use WinRAR). It should look like this: enter image description here

Unlock your bootloader (In case you haven't already) Link here

Flashing the factory images

  • Power off your phone.

  • Boot it in by pressing and holding Power Button + Volume Down at the same time.

  • Connect your phone to your PC through your USB cable.

  • Execute the flash-all.bat script (for Windows) or flash-all.sh(for MAC and LINUX) in the folder where you extracted the factory images. !! For MAC: You'll have to edit the flash-all.sh, and add "./" before every fastboot command.

  • Wait for everything to flash.

  • After everything finished, select "Recovery" using the volume buttons.

  • When a small dead Android appears, press Power Button + Volume UP.

  • Select "Wipe data/factory data reset"

  • Reboot. Your phone should be stock.

Note: The XDA Thread has further detail on re-locking the device and resetting the tamper flag should you need to claim warranty. It's a bit outside the scope of this answer, but it might be of use!

Note 2: Some Nexus devices will show as having 16 Gb after this on the 32 Gb model. The below is a fix via cmd:

fastboot erase boot
fastboot erase cache
fastboot erase recovery
fastboot erase system
fastboot erase userdata

fastboot flash bootloader C:/image-hammerhead-krt16m/bootloader.img
fastboot reboot-bootloader
fastboot flash radio C:/image-hammerhead-krt16m/radio.img
fastboot reboot-bootloader
fastboot flash system C:/image-hammerhead-krt16m/system.img
fastboot flash userdata C:/image-hammerhead-krt16m/userdata.img 
(Note: this command will wipe your device (including /sdcard), EVEN if your bootloader is already unlocked.)

fastboot flash boot C:/image-hammerhead-krt16m/boot.img
fastboot flash recovery C:/image-hammerhead-krt16m/recovery.img
  • Maybe a stupid question, but wouldn't performing a factory reset also do the trick?
    – s427
    Nov 20, 2014 at 22:29
  • @S427 as far as I know you need a stock recovery at least on the device to install an OTA, but normally a stock kernel / recovery. Either way a factor reset won't reset the kernel or the recovery on the device so a factory image won't install on the custom setup. Thanks for the edit, dont' know what I did there :|
    – RossC
    Nov 21, 2014 at 10:13
  • 1
    I know the credit belongs to XDA, but thank you for posting the guide here - it helped me unbrick my Nexus 5 after it self-bricked (yes, turns out that happens too) Dec 19, 2014 at 21:15

Another option, without wiping any data, is to

  • when an OTA update is available, get the direct link and download the zip file to your PC,
  • download the latest image version of your custom recovery (eg TWRP) and the latest SuperSU zip to your PC
  • connect your device to your PC and reboot into bootloader mode
  • then dirty flash the stock boot, recovery & system partitions of your current Android version,
  • in stock recovery mode, install the OTA zip via adb sideload update.zip,
  • reboot into bootloader mode
  • flash back your custom recovery image
  • (alternatively) flash your custom kernel
  • reboot into recovery mode
  • in the custom recovery mode, root the device via adb sideload UPDATE-SuperSU-vX.X.zip
  • now clear cache and dalvik-cache and reboot the system

Done. OTA applied and you can just pick up from where you left.

This is not the only method, of course, and is not recommended for major version updates. But for minor version updates, this is, IMHO, preferable to dirty flashing the new system and to any method that require a data wipe.

A very detailed step-by-step version of this solution can be found here: https://gist.github.com/eyecatchup/ec0a852428c19705380e


I wanted to keep my userdata, so I followed the directions provided by Mistywing and it seemed to work well going from 5.0.1 to 5.1.1. on my Nexus 5. For the complete instructions, check out the Mistywing post: http://www.reddit.com/r/Android/comments/36n4va/nexus_5_511_ota_from_lmy47d/crg3jza

Here are the highlights. I lost root and TWRP, but wasn't too worried about that at this point.

I got adb and fastboot working on my Mac. I downloaded the image from Google, I backed up my data, restarted in bootloader and ran these commands in order. I was careful to omit flashing the userdata file, which would wipe my data.

fastboot flash bootloader [bootloader file].img

fastboot reboot-bootloader

fastboot flash radio [radio file].img

fastboot reboot-bootloader

fastboot flash recovery [recovery file].img

fastboot flash system [system file].img

fastboot flash cache [cache file].img

fastboot flash boot [boot file].img

I restarted using the bootloader controls (used volume to get the green START option and then power to activate it). The startup after this took quite a long time "optimizing" my apps.

The OTA update notification went away and the OS seems much more responsive.


Install Multi ROM Manager, And install Lollipop image on it.

  • 2
    Could you provide a link and explain how to do that? Nov 21, 2014 at 5:54
  • Installing multi rom manager needs custom kernel/recovery on stock so that doesn't help anyway. I currently have 3 roms on my phone and unable to install the ota.
    – user99703
    Mar 26, 2015 at 5:24

You must log in to answer this question.

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