1 May 2015 8:32 PM (android)
DISCLAIMER: I'm not responsible for what happens to your phone if you decide to proceed with the instructions below.
Are you experiencing:
Boot loop with Lollipop (Android 5.x).
Have downgraded to Kitkat (Andorid 4.x) and there's no service, camera crashes, google play store crashes, google earth tells you it needs SD internal storage and crashes.
At this point the phone seems practically unusable except wifi and only with Kitkat, Lollipop doesn't even boot.
It might be that the /persist partition is corrupted. So, don't despair, here's how I fixed it after looking around a bit:
Download adb and fastboot. On Ubuntu this is:
$ sudo apt-get install android-tools-adb android-tools-fastboot
Power off your phone.
Connect your phone to your computer through USB.
Boot into the bootloader by pressing volume down and power buttons at the same time.
$ fastboot oem unlock
On the phone you must select the option to wipe everything. WARNING: This will wipe all contents on the device.
Download TWRP (an improved recovery mode).
$ fastboot flash recovery openrecovery-twrp-22.214.171.124-hammerhead.img
Reboot again into the bootloader.
Once in the bootloader, choose the Recovery mode. It will then start TWRP.
On your computer you now type:
$ adb shell
If everything went well this should give you a root prompt.
Fix /persist partition.
# e2fsck -y /dev/block/platform/msm_sdcc.1/by-name/persist
Re-create /persist file system.
# make_ext4fs /dev/block/platform/msm_sdcc.1/by-name/persist
Exit the adb shell.
Download the latest Nexus 5 factory image and untar it.
Finally,inside the untared directory run:
Your phone should be fixed!
As a last step you might want to lock it again. So, go into the booatloader again and this time run:
$ fastboot oem lock
These are the couple of websites I used. Thank you to the guys who wrote it!