Android Lollipop 5.1.1 was recently released for the Nexus 5 as a maintenance update to the latest OTA update of 5.1.0 to fix numerous issues, such as an intermittent non-response camera and excessive memory usage leading to crashing applications.
If you have a rooted phone or a phone with a custom recovery, you may find that the OTA update doesn’t work on your phone – this is because the update process now checksums and verifies partitions such as recovery before performing the update. If the partitions don’t match the expected stock ROM, the update process will terminate. Having a rooted phone (with the su binaries), modified radio, modified recovery, or custom ROM may all contribute to an update failing and bombing out.
The requirements for using this method (which lets you keep all data while using official Google Nexus images) are:
- Must be CURRENTLY rooted – SuperSU
- Must have BootUnlocker installed
- Factory Nexus 5 5.1.1 image downloaded
- Custom recovery of your choice downloaded – ClockworkMod
- Android tools ADB and fastboot installed – Android Studio
Untar the hammerhead-lmy48b-factory-596bb9c1.tgz file somewhere, which will net you a few .img files, a few scripts, and a .zip file that contains more .img files
Unzip the image-hammerhead-lmy48b.zip file somewhere, preferably same place as the above file in Step 1, which will net you the rest of the .img files
Delete everything that isn’t a .img file – you don’t need it. They’re use when you want to do a complete start-from-scratch flash of your phone.
Delete userdata.img – if you flash this file, you will overwrite your data on your phone. We don’t want it, and we don’t need it.
Use BootUnlocker and your root access on your phone to unlock the bootloader without wiping user data.
Reboot your phone into bootloader mode – on the Nexus 5 you do this by powering the phone off, then holding the Volume Down button while pressing the power button.
Once your Nexus 5 is in bootloader mode, flash the .img files:
fastboot flash boot boot.img fastboot flash bootloader bootloader-hammerhead-hhz12h.img fastboot flash radio radio-hammerhead-m8974a-18.104.22.168.26.img fastboot flash cache cache.img fastboot flash recovery recovery.img fastboot flash system system.img
Once your .img files are flashed, reboot your phone and let it boot up completely and finish optimizing all of your applications
Reboot your phone back into bootloader mode and flash your custom recovery:
fastboot flash recovery recovery-clockwork-22.214.171.124-hammerhead.img
There is a script in the official Nexus firmwares that will check the recovery partition – and if it doesn’t match to a known stock recovery, it will overwrite the recovery with a stock recovery. You will need to experiment and reboot a few times to see how many times you need to flash your custom recovery before it “takes” – I usually only have to flash it twice.
Once you are confident that the custom recovery “sticks” – boot into your recovery by first booting into bootloader mode, then using the volume buttons to select recovery, then press the power button to boot into recovery.
These steps to re-root your device are specific for the ClockworkMod recovery. Your process may be different depending on what device you use!
Once you are booted into ClockworkMod, use the volume buttons to select “Install zip” and then select with the power button
Select “install zip from sideload”
On your computer, push the root zip to your phone:
adb sideload UPDATE-SuperSU-v2.46.zip
Once this ZIP file is installed, select “Go Back” twice, then “reboot system now” – ClockworkMod will ask if you want to retain root – select “Yes – Fix root”
Once you reboot, you should have root access again! Use BootUnlocker to re-lock your recovery, and you should be good to go.