Restoring Nexus 4 Factory Image

Something terribly went wrong during Android 5.1.1 Over The Air (OTA) update. The Nexus 4 mobile phone stuck in the boot loop after update. Perhaps the update failed to download the files or the device ran out of disk space. For those of you who like to debug such problems, I captured some logs for analysis with 'adb logcat' here (1,2,3,4).

Caution: Flashing a new factory image deletes all user data. Be certain to first backup any personal data such as photos.

Tools: What do you need to restore the phone?

For this tutorial I'll use a gnu/Linux computer with Android SDK Stand-alone Tools installed. We'll use the 'fastboot' program to flash the Android Nexus 4 devices with factory images from

  1. Download Android SDK Stand-alone tools from
  2. Uncompress the Android SDK to your /opt/android-sdk-linux directory.
  3. Add Fastboot to your system path
    $ ln -sf /opt/android-sdk-linux/platform-tools/fastboot /usr/local/bin/fastboot
  4. To get Fastboot working on gnu/Linux I added the follow line to /etc/udev/rules.d/51-android.rules .
    $ sudo nano /etc/udev/rules.d/51-android.rules 
    # adb protocol on mako (Nexus 4 debug)
    SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1",ATTR{idProduct}=="4ee2", MODE="$
  5. Restart udev service.Connect the Nexus 4 device to computer with USB cable and see fastboot can access it.
    $ sudo service udev restart 
    $ sudo fastboot devices
  6. Unlock the Nexus 4 phone (Optional step). The phone will reboot and follow the instructions on the phone screen to unlock the phone.
  7. $ fastboot oem unlock 
  8. Let's put the Nexus 4 in recovery mode so that we can flash the new factory image. You can use 'adb' command or press hold volume up + volume down + power buttons during the phone bootup.
    $ adb reboot bootloader
  9. Download the Nexus 4 factory image from I have downloaded the Android 5.1.0 (LMY47O) factory image. Uncompress it the downloaded file and excute the '' script to flash the factory image.
    $ tar zxvf occam-lmy47o-factory-cae68e81.tgz 
    $ cd occam-lmy47o/ 
    $ sudo ./ 

Whew! That's all folks! Now you get enjoy the Nexus device with brand new factory image.

No comments:

Post a Comment

You can leave a comment here using your Google account, OpenID or as an anonymous user.