*** IMPORTANT: These procedure do not works on encrypted device. For encrypted device you need to factory reset the phone to factory state before rooting.
I rooted my Nexus 5 running Android 5.0 with procedures below
I can receive OTA about 5.0.1 but failed to install. Here is my procedures to fix this.
- Check android version, go to Setting > About phone > Build number
- Download factory image according to your build number
- unzip the factory image.
- Power off Nexus 5
- Press and hold volume down and press Power button until Nexus 5 is powered on and entered fast boot mode.
- Connect Nexus 5 to the PC with usb cable. Make sure the usb cable capable to transfer data. (Some usb cable only able to provide power to connected device…)
- Open a command prompt and cd to the directory of where fastboot.exe is located
- Make sure your phone in fast boot mode, with usb cable connected. Input the command below to flash stock recovery
fastboot flash radio c:\Downloads\hammerhead-lrx21o\radio-hammerhead-m8974a-18.104.22.168.22.img
fastboot flash recovery c:\Downloads\hammerhead-lrx21o\image-hammerhead-lrx21o\recovery.img
fastboot flash boot c:\Downloads\hammerhead-lrx21o\image-hammerhead-lrx21o\boot.img
fastboot flash system c:\Downloads\hammerhead-lrx21o\image-hammerhead-lrx21o\system.img
Reboot the phone by command below
*** It is very important keep your phone alone during flashing!!!
Do not touch the phone and the USB cable.
Some USB cable is pretty easy to get disconnected, your phone will be bricked if flashing being interrupted.
Do NOT perform this step with kids around!!!
My console log
Microsoft Windows [Version 6.3.9600] (c) 2013 Microsoft Corporation. All rights reserved. C:\Users\ray>cd android-sdks C:\Users\ray\android-sdks>cd platform-tools C:\Users\ray\android-sdks\platform-tools>dir/w Volume in drive C is OS Volume Serial Number is 7057-CA1E Directory of C:\Users\ray\android-sdks\platform-tools [.] [..] adb.exe AdbWinApi.dll AdbWinUsbApi.dll [api] boot.img dmtracedump.exe etc1tool.exe fastboot.exe hprof-conv.exe NOTICE.txt recovery-clockwork-touch-22.214.171.124-hammerhead.img recovery.img source.properties sqlite3.exe [systrace] 13 File(s) 29,494,151 bytes 4 Dir(s) 97,228,099,584 bytes free C:\Users\ray\android-sdks\platform-tools>fastboot flash radio c:\Users\ray\Downl oads\hammerhead-lrx21o\radio-hammerhead-m8974a-126.96.36.199.21.img target reported max download size of 1073741824 bytes sending 'radio' (45521 KB)... OKAY [ 1.615s] writing 'radio'... OKAY [ 3.144s] finished. total time: 4.762s C:\Users\ray\android-sdks\platform-tools>fastboot reboot-bootloader rebooting into bootloader... OKAY [ 0.001s] finished. total time: 0.002s C:\Users\ray\android-sdks\platform-tools>fastboot flash recovery c:\Users\ray\Do wnloads\hammerhead-lrx21o\image-hammerhead-lrx21o\recovery.img target reported max download size of 1073741824 bytes sending 'recovery' (9552 KB)... OKAY [ 0.413s] writing 'recovery'... OKAY [ 0.812s] finished. total time: 1.227s C:\Users\ray\android-sdks\platform-tools>fastboot flash boot c:\Users\ray\Downlo ads\hammerhead-lrx21o\image-hammerhead-lrx21o\boot.img target reported max download size of 1073741824 bytes sending 'boot' (8852 KB)... OKAY [ 0.388s] writing 'boot'... OKAY [ 0.755s] finished. total time: 1.145s C:\Users\ray\android-sdks\platform-tools>fastboot flash system c:\Users\ray\Down loads\hammerhead-lrx21o\image-hammerhead-lrx21o\system.img target reported max download size of 1073741824 bytes erasing 'system'... OKAY [ 1.176s] sending 'system' (981596 KB)... OKAY [ 30.943s] writing 'system'... OKAY [ 67.135s] finished. total time: 99.257s C:\Users\ray\android-sdks\platform-tools>fastboot reboot rebooting... finished. total time: 0.001s
- After reboot, the phone should be unrooted. All existing apps, configuration, data should be remains here.
- Wait for OTA again. Upgrade to 5.0.1 through OTA.
Root the phone
This time I don’t bother rooting myself, I just download Nexus Toolkit 1.9.9 to root my Nexus 5 with Android 5.0.1. It works. Just one click.