Updated (2015-05-29) – I have tested this method successfully with Android 5.1.1 and have updated the post title/content to reflect this.
Does this post look familiar?
I wrote a post back in December 2014 solving this same problem for Android 5.0.1, whereby a rooted Nexus device will not update via over-the-air (OTA). Rather than go over everything again, I’ll cut straight to the chase of how to update your rooted Nexus 5 to Android 5.1.0/5.1.1 via fastboot.
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.1.0/5.1.1 update for Nexus 5 (hammerhead-lmy47d), 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-lmy48b-factory-596bb9c1.tgz $> cd hammerhead-lmy48b $> unzip image-hammerhead-lmy48b.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-126.96.36.199.26.img $> fastboot reboot-bootloader $> fastboot flash recovery recovery.img (above recovery step is optional - will overwrite custom recovery) $> 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.