I use TWRP (TeamWin Recovery Project) on my Nexus 4. Back in the day (read: 3 years ago) I used ClockworkMod Recovery, on my Moto Defy, but have since switched to TWRP. I believe there were some licensing issues that drove a lot of people away from CWM. In any case, you’ll want to install
fastboot before proceeding.
From an Ubuntu distribution (Xubuntu in my case):
sudo apt-get install android-tools-adb android-tools-fastboot
After adb and fastboot have been installed, boot your Nexus 4 into fastboot mode. Just switch your Nexus 4 off, then turn it back on while holding the volume down button. Keep holding the down button until you see a menu (usually with an Android guy somewhere on the screen). Entering fastboot mode may be different for your device, check the TWRP site, they have instructions for a lot of different devices.
Now, make sure your PC sees your device in fastboot mode. In a terminal window, run
fastboot devices. If nothing is printed to the terminal, something is wrong, you probably don’t have fastboot enabled. If you did see some output, you should be good to go.
Download the latest recovery
.img file from the TWRP site. Current version as of this post is 188.8.131.52. To flash it using
fastboot, do this in a terminal:
fastboot flash recovery openrecovery-twrp-184.108.40.206-mako.img
If everything goes well, you should see something similar to this:
sending ‘recovery’ (8130 KB)…
OKAY [ 0.510s]
OKAY [ 0.476s]
finished. total time: 0.987s
If you see something other than
OKAY messages, something is probably wrong, and I have no idea what. If you do see the
OKAY messages, you can either reboot your phone to Android or go to recovery which will take you to TWRP. With TWRP you can make a nandroid backup, flash new roms, flash new gapps, and all kinds of other things.