Categories
Android

Updating to Android 5.0.1 on rooted Nexus 5

OTA (over-the-air) updating in rooted Nexus land has never been the most elegant process. But, prior to Android 5.0 Lollipop, at least it worked as expected, with the main irk being that you’d need to re-root your device afterwards.

While trying to update to Android 5.0.1 on my rooted Nexus 5 via OTA today, I discovered that things are now even less clear-cut and that the update itself will now fail during the recovery phase. Thankfully, there’s a (relatively) pain-free way of getting around this, providing your comfortable with fastboot at the command line.

This guide presumes you’re using either Linux or Mac, with the appropriate Android tools (adb and fastboot) installed, although the Windows method should be much the same. For the purposes of this example, I’ll assume this is the Android 5.0.1 update for Nexus 5 (hammerhead-lrx22c), but the instructions should be similar for future releases.

Note: This will not wipe your device. However, it is always a good idea to back up, as things can always go wrong.

First, download the appropriate Android factory image from the Google Developers site. Uncompress the archive, as well as the archive contained within it, as below:

$> tar -zxf hammerhead-lrx22c-factory-0f9eda1b.tgz
$> cd hammerhead-lrx22c
$> unzip image-hammerhead-lrx22c.zip

Next, make sure your device is in fastboot mode (hold VolUp, VolDown and Power button from a powered-off device). Verify your device can be picked up by running fastboot devices, then run the following commands:

$> fastboot flash radio radio-hammerhead-m8974a-2.0.50.2.22.img
$> fastboot reboot-bootloader
$> fastboot flash recovery recovery.img
$> fastboot flash boot boot.img
$> fastboot flash system system.img

If all goes well, your device will be flashed with the latest version of Android.

Bonus – re-root your device: grab the appropriate version of CF-Auto-Root for your device, extract it and run the correct root script contained within. Your device will need to be in fastboot mode for this to work.

Credit to /u/laxor09 on Reddit for much of this information.

70 replies on “Updating to Android 5.0.1 on rooted Nexus 5”

This is not the OTA being offered on my phone then., and instead a downloaded version of OTA?

Any idea why the prompt to install OTA will not work anymore? I don’t have anything custom on my phone, except for Root, which I have since uninstalled using SuperSU. I have also re-installed my stock recovery, thinking that somehow it’s files might have been modified by SuperSU root, but the OTA install still fails.

It’s just the standard factory image Google use to flash their Nexus devices. I’m not sure exactly why it doesn’t work anymore, but I just read some threads on Reddit (r/Nexus5 and r/Android) saying that any modification of the base system can now cause OTAs to fail, which is a head-wrecker to say the least.

When you root your device it makes various changes to system users and files. Un-rooting your phone reverses these changes, but leaves traces that the system has been tampered with (file modification times, etc.)

With Lollipop, Google has changed the way that their OTA system updates are applied. The update now checks the various partitions for hints of tampering and fails to install if it detects anything other than a pristine image.

Thanks for that information, Mike! A hassle for those of us who like to hack our phones, but not the end of the world.

I figured this would work too. In any case, I’ll be re-flashing TWRP/MultiROM as my recovery. Cheers!

I just wanted to mention a few key points. Most importantly, this will only work on devices that have had their bootloader unlocked. If your bootloader is still locked you will be forced to perform a factory reset which will wipe your system. This is a security precaution implemented by Google to prevent unauthorized access to personal user data on the device.

In this case you should prepare a full set of system backups which will have to be restored once the device is unlocked.

Unlocking your bootloader can be accomplished through fastboot with the command:
$> fastboot oem unlock

The other point I want to make is regarding rooting/re-rooting your device. If you use SuperSU it is now possible to root your device by simply installing the .zip package through a custom recovery. No need to flash the cf-auto-root image.

Those who don’t wish to flash a custom recovery can temporarily boot into a custom recovery image instead! This is the method I’ve used, since I like leaving my device as close to stock as possible.

Simply download the recovery image to your computer and run the command:
$> fastboot boot path/to/custom-recovery.img

Cheers for those points, Mike. This blog post was aimed at people who already had their bootloader unlocked. Am I right to assume that the bootloader needs to be unlocked in order to successfully root?

Not necessarily, but don’t quote me on this, as I haven’t kept up with the scene and I don’t have a device to test with.

Per my second point, it’s possible to boot into a custom recovery without having to flash. It’s then possible to run the root scripts using that recovery to root the device.

Unlocking the device is necessary if you’re flashing images to the device (whether they are official factory images, like the ones indicated in your post, or custom roms)

It’s also possible to re-lock the bootloader after flashing. I don’t know why anyone would do that, but subsequent unlocks also require a factory reset.

There were exploits in previous versions of Andriod that that allowed rooting without unlock. These were a common way of rooting the stock image on a device.

I can not thank you enough for this information! Been trying to figure out how to upgrade my rooted Nexus 5 from 5.0 to 5.01 without losing my data for days now. I followed you simple instructions and everything appears to be working perfectly.

I also have a few notes for anyone else that might come across this page…

I used a Windows machine and the WugFresh Toolkit. In the advanced utilities option, there are selections for each of the 4 files that need to be flashed. I simply followed the order listed in the instructions and let the toolkit do the work. Then used the toolkit to root again.

I did do a full backup using the toolkit prior to starting as I was very nervous, but things couldn’t have gone smoother. I’ll be bookmarking this site as I fully expect to use this process for all updates going forward.

Again, thanks for making this simple and painless.

Delighted to hear, Topshelf! Thanks for the information about WugFresh too. Should be handy for Windows users.

Haha, one of the reasons I decided to write this post was because I knew I’d forget this for the future. I was going to just write a note in Google Keep, but then decided I could smarten it up a bit and make it useful for others. Cheers again!

Excellent instructions, but on Linux, some people may get an error when trying to run their script for rooting:

unable to execute tools/fastboot-linux: No such file or directory

Anyone that gets this message can always manually load the image by using:

fastboot boot CF-Auto-Root-hammerhead-hammerhead-nexus5.img

I ran into this, but since I know my Nexus is already unlocked, I didn’t really need to run the script anyways so I just went ahead and flashed accordingly.

Odd… that definitely hasn’t happened to me with CF-Auto-Root, but good advice for others if they run into it. Nonsensical “No such file or directory” errors are always the most frustrating. Thanks Peter!

this error comes due to the fact that the CF-Auto-Root binaries are 32 bit but your OS is probably 64 bit 😉 Just install the appropriate 32 bit libraries and you’re good to go

thanks for the tutorial, worked for my rooted nexus 5
it’s mostly annoying, that OTA don’t work anymore..

Hello Aaron,

thank you very much for this post, it was really easy to use, just fantastic ! I’m going to add your post at my favorites.

Thanks a lot Aaron !

I’ve been able to upgrade to 5.0.1 on a rooted nexus 5 following your steps using “nexus root tool kit”

I get the following error when I try to execute “fastboot flash radio radio-hammerhead-m8974a-2.0.50.2.22.img”

“error: cannot load ‘radio-hammerhead-m8974a-2.0.50.2.22.img’: no error”

I have placed that file in the dir “C:\Program Files\Minimal ADB and Fastboot”

Can you advise how to proceed?

Awesome! Thank you so much for this straight-forward tutorial. I was a bit confused at first because the OTA was ~13 MB while the image from Google was the full system (~580 MB). I had to re-read your paragraph above to assure myself the phone wouldn’t be wiped.

It’s very frustrating that OTAs do not work on rooted devices anymore. I can understand Google’s reasoning behind it, but it makes the process for us a bit more convoluted.

Anyways, thanks again!

-Ben

Hi
Is there any chance that you could upload those .img files?
Internet is not cheap where I live and It would be hard for meto download the whole image

Hi Saied. I’m afraid the total size of the image files on their own is still over 1.2GB and the excess files only make up a small portion of this. In this regard, you would be just as suited downloading the whole image. My apologies.

Quite simply the BEST instructions around.
Simple to follow for those with very little, but some, experience.
Many Thanks!

TWRP problem
So I updated to 5.0.1 from 5.0 by first reflashing the stock boot and system img files then installing the OTA on my phone and it worked like a charm. When to go to flash twrp 2.8.1.0 it flashes then immediately after i try to install zip….I enter recovery mode and twrp asks for password….I hit cancel then go to the install option but no files show up and i mean NONE at all. It just gives me the option to select directories and no zip files are found (i put the supersu zip file on by phone btw). So I restart my phone and try again but twrp disappears and stock recovery is back.

Any help with this problem???

Oh man, I have no idea Clay. I decided to flash the stock recovery for this, as per u/laxor09’s original instructions on Reddit. I figured it would be possible to do it your way too, but I decided I’d rather just re-flash TWRP (since it’s easy to do with MultiROM) afterwards. Maybe try asking on r/Android on Reddit?

sorry to hear you ran into trouble clay.

for others with a custom recovery, my first attempt was to follow aaron’s steps and just skipped flashing the recovery entirely, hoping that my TWRP install would remain intact.

although i didn’t have any trouble rerooting and the phone ran fine, when i tried to launch recovery afterward i encountered a little android laying on its side.

flashing the stock recovery using fastboot wasn’t enough to solve the problem. i had to each of aaron’s steps one by one from scratch. after reflashing everything in the download package and rerooting my Nexus 5, i was finally able to install the latest version of TWRP and ensure that everything was as it should be.

thanks for the blog Aaron!

Great, cheers for that bit of information, John! I’ll refer anyone with similar issues to your comment.

Also, you’re more than welcome! Happy Holidays!

Thanks,thanks,thanks… Xmas with Lollipop 5.0.1 rooted and all data and setting keeped!!! This is the ONLY guide i’ve found on internet all around the world. Dummy’s proof. Merry Xmas and happy new year!

Thanks a lot! I was desperate what to do and I didn’t want to re-install the whole system. I was going to live with the annoying system update notification but your article saved me! Again thanks for sharing it.

My Device was Factory reset, even though it had been previously unlocked and rooted, I do not understand why?

Finally got around to upgrading my phone from 5.0 to 5.0.1. Thanks a lot for this easy-to-follow guide. Worked like a charm.

Hey Matt. Funnily enough, I’m just about to put up an updated post about this. Glad I could help you out!

Cheers!

Thanks a lot, instructions worked like a charm. I already tested upgrading Android 5.01 to 5.1 and it works well.

Hi Aaron, i have a rooted nexus 5 with custom recovery and kernel. I wanted to update to 5.1.1 and so i reflashed the stock kernel and recovery. Now when i sideload the ota, it fails at the system partition check. Can i use the above method directly with a factory image of 5.1.1

Hi Faizan,

Apologies for the late response. I haven’t had time to check this procedure with 5.1.1, so I can’t say for certain.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.