[ROOT][CWM] Root Nexus 4 & Install Official ClockworkMod Recovery

Search This thread

HQRaja

Retired News Writer
Jan 27, 2008
491
433
Islamabad
hqraja.com
I originally posted this method at AddictiveTips. The method I posted there is targeted at everyone including the absolute beginners and I have also included instructions there for setting up the required tools, and for reverting back to the original recovery and boot image in case anything goes wrong. All external credits should be given to that guide (it does link back to this thread). Here is the link: How To Root Nexus 4 and Install ClockworkMod Recovery on it.

To my knowledge, this is the first confirmed working rooting method for Nexus 4 posted here at XDA. Though my knowledge is limited, so please correct me if I am wrong.


UPDATE: There is an official ClockworkMod recovery for Nexus 4 now available directly by Koush, so this should all be easy as pie now and you can now safely install CWM too. I am updating the CWM method with the updated instructions.

This method requires an unlocked bootloader. You can find instructions for unlocking it at XDA, or at the AddictiveTips guide linked above (the link to the bootloader unlock guide is in the requirements section there).

UPDATE 2: If your device does NOT get wiped after unlocking the bootloader, fret not. While this isn't expected behavior, several users have experienced the same on the Nexus 4. This could be due to some error at Google's end, but unlocking still works perfectly fine.

That said, let's get on with rooting and flashing CWM.

ClockworkMod Recovery Method:

  1. Download the latest official ClockworkMod recovery from CWM website and rename it to recovery.img
  2. Enable Android Debugging from Settings > Developer Options. (If you can't find developer options, go to 'About' and tap 'Build number' seven times.)
  3. Connect the device to your computer via USB, and install the required drivers.
  4. Download the recovery flashable SuperSU package with Busybox and transfer it to your phone's internal SD card.
  5. Reboot into fastboot/bootloader:
    Code:
    adb reboot bootloader
    You can also power off the phone and then use power + volume-down key combination to get into bootloader.
  6. Unlock the bootloader if you haven't done so already. WARNING: This command will wipe all data on your device.
    Code:
    fastboot oem unlock
  7. Enter this command in a command prompt to flash the ClockworkMod recovery (making sure you are in the directory where you downloaded the recovery file):
    Code:
    fastboot flash recovery recovery.img
    OR

    If you simply want to root without flashing a custom recovery and want to stick to your stock recovery, simply boot this recovery once using this command:
    Code:
    fastboot boot recovery.img
  8. If you flashed the recovery in the previous step, you can now boot into recovery by pressing volume-up or volume-down twice to select the recovery option, and then the power button to enter it. If you simply booted into the recovery file without flashing it in the previous step, you should already be in recovery now.
  9. Once in recovery, take a backup to be on the safe side.
  10. Flash the downloaded SuperSU and busybox package zip file from recovery.
  11. Clear cache and dalvik cache just in case (not required but won't hurt).
  12. Reboot the device.

ADB and Insecure Boot Image Method:

  • Grab the insecure boot image from this thread.
  • Also download these root files. This package includes the latest SuperSU 0.98, latest su binary that comes with it, and working busybox (not sure if latest).
  • Extract the contents of the downloaded zip file to your computer.
  • Enable Android Debugging from Settings > Developer Options. (If you can't find developer options, go to 'About' and tap 'Build number' seven times.)
  • Connect the device to your computer via USB, and install the required drivers.
  • Reboot into fastboot/bootloader:
    Code:
    adb reboot bootloader
    You can also power off the phone and then use power + volume-down key combination to get into bootloader.
  • Unlock the bootloader if you haven't done so already. WARNING: This command will wipe all data on your device.
    Code:
    fastboot oem unlock
  • Get back into bootloader mode and boot into the downloaded insecure boot image:
    Code:
    fastboot boot boot.img
    Don't worry, this will not replace your existing boot image and will only boot from the insecure one once.
    If it does NOT work for you and you get stuck in a boot loop, simply reboot your phone into bootloader and use the above command again. Some users had issues with booting from it the first time, but a second attempt worked.
  • Once booted into Android successfully using the insecure boot image, simply enter these commands one by one in command prompt (making sure you are in the directory where you downloaded the files):
    Code:
    adb shell mount -o remount,rw /system
    adb push su /system/bin/
    adb push Superuser.apk /system/app/
    adb push busybox /system/xbin/
    adb shell
    chmod 06755 /system/bin/su
    chmod 0644 /system/app/Superuser.apk
    chmod 04755 /system/xbin/busybox
    cd /system/xbin
    busybox --install /system/xbin/
    exit
    exit
  • Reboot your device.

You will now have root access. Tested and confirmed working by Stryder5 and many others.

Credits:

Stryder5 for testing, confirming, tipping me about working CWM, providing the required drivers, and helping others on the thread. :highfive:
Harry GT-S5830 for the insecure boot image.
fkrone for his recovery revert disabler script and his unofficial working CWM before an official one became available.
Kstarz for posting this same recovery method with his own working CWM in this thread before an official one was out.
evaradar for informing about the release of official ClockworkMod recovery.
Koush for developing ClockworkMod recovery.
Chainfire for developing SuperSU.
Everyone else on this thread for testing, providing feedback and hitting the 'THANKS' button. =)

I have tried my best to give everyone the due credit but if I have missed out on anyone, please do remind me.
 
Last edited:

Stryder5

Senior Member
Mar 2, 2009
3,353
1,145
Texas
BTW can you confirm me the insecure boot.img you used? I just provided the link to the thread by Harry GT-S5830 but there were multiple ones posted in that thread, so I'm thinking of adding the direct link to the one confirmed working.

I'm pretty sure I used the one Harry GT-S5830 provided.
 
  • Like
Reactions: StickyEyez

StickyEyez

Senior Member
Aug 12, 2007
174
33
San Diego
I used the one in the OP of that thread.. is there a different one I'm supposed yo use?

Sent from my SGH-T999 using Tapatalk 2

---------- Post added at 06:41 AM ---------- Previous post was at 06:23 AM ----------

It works :)

Sent from my SGH-T999 using Tapatalk 2
 

HQRaja

Retired News Writer
Jan 27, 2008
491
433
Islamabad
hqraja.com
when I boot the boot.img. It rebooted and got stuck at the nexus boot animation for a long time. Does it suppose to do that?
Nope, it isn't. Try again...it's safe to try as many times as you want since we're not flashing the boot image; merely booting from it, which is temporary and doesn't last after reboot. Hope it works on the next try.
 

resynx

Senior Member
Jun 14, 2010
3,233
1,288
After step 8 we boot up the phone normally and then start running those adb commands? I'm assuming that's what you mean by "Once booted into Android successfully..." right? Sorry if it's an obvious question, just making sure!
 

0.0

Senior Member
Jan 12, 2010
6,829
3,275
quick question to ease my mind: if i needed to return this device for warranty purposes, how would i revert all of this back to stock? i know its something to do with the stock factory image, or am i wrong?
 

HQRaja

Retired News Writer
Jan 27, 2008
491
433
Islamabad
hqraja.com
After step 8 we boot up the phone normally and then start running those adb commands? I'm assuming that's what you mean by "Once booted into Android successfully..." right? Sorry if it's an obvious question, just making sure!
Step 8 itself will boot up the phone normally into Android, just using that insecure boot image instead of the stock one. And yes, you then just start entering those adb commands. =)
 

HQRaja

Retired News Writer
Jan 27, 2008
491
433
Islamabad
hqraja.com
quick question to ease my mind: if i needed to return this device for warranty purposes, how would i revert all of this back to stock? i know its something to do with the stock factory image, or am i wrong?
Best way would be to grab a stock factory image and flashing it. I recently wrote a post on the portal with the links: http://www.xda-developers.com/android/android-4-2-images-for-galaxy-nexus-nexus-7-4-and-10/
The method can be found at the factory images download page, and is as easy as extracting the image and running the included .bat file while your phone is connected to PC in fastboot mode.
 
  • Like
Reactions: 0.0

0.0

Senior Member
Jan 12, 2010
6,829
3,275
Best way would be to grab a stock factory image and flashing it. I recently wrote a post on the portal with the links: http://www.xda-developers.com/android/android-4-2-images-for-galaxy-nexus-nexus-7-4-and-10/
The method can be found at the factory images download page, and is as easy as extracting the image and running the included .bat file while your phone is connected to PC in fastboot mode.

so i extract the "occam-jop40c-factory-cd3dc140.tgz" file, then double-click the "flash-all.bat" file?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 154
    I originally posted this method at AddictiveTips. The method I posted there is targeted at everyone including the absolute beginners and I have also included instructions there for setting up the required tools, and for reverting back to the original recovery and boot image in case anything goes wrong. All external credits should be given to that guide (it does link back to this thread). Here is the link: How To Root Nexus 4 and Install ClockworkMod Recovery on it.

    To my knowledge, this is the first confirmed working rooting method for Nexus 4 posted here at XDA. Though my knowledge is limited, so please correct me if I am wrong.


    UPDATE: There is an official ClockworkMod recovery for Nexus 4 now available directly by Koush, so this should all be easy as pie now and you can now safely install CWM too. I am updating the CWM method with the updated instructions.

    This method requires an unlocked bootloader. You can find instructions for unlocking it at XDA, or at the AddictiveTips guide linked above (the link to the bootloader unlock guide is in the requirements section there).

    UPDATE 2: If your device does NOT get wiped after unlocking the bootloader, fret not. While this isn't expected behavior, several users have experienced the same on the Nexus 4. This could be due to some error at Google's end, but unlocking still works perfectly fine.

    That said, let's get on with rooting and flashing CWM.

    ClockworkMod Recovery Method:

    1. Download the latest official ClockworkMod recovery from CWM website and rename it to recovery.img
    2. Enable Android Debugging from Settings > Developer Options. (If you can't find developer options, go to 'About' and tap 'Build number' seven times.)
    3. Connect the device to your computer via USB, and install the required drivers.
    4. Download the recovery flashable SuperSU package with Busybox and transfer it to your phone's internal SD card.
    5. Reboot into fastboot/bootloader:
      Code:
      adb reboot bootloader
      You can also power off the phone and then use power + volume-down key combination to get into bootloader.
    6. Unlock the bootloader if you haven't done so already. WARNING: This command will wipe all data on your device.
      Code:
      fastboot oem unlock
    7. Enter this command in a command prompt to flash the ClockworkMod recovery (making sure you are in the directory where you downloaded the recovery file):
      Code:
      fastboot flash recovery recovery.img
      OR

      If you simply want to root without flashing a custom recovery and want to stick to your stock recovery, simply boot this recovery once using this command:
      Code:
      fastboot boot recovery.img
    8. If you flashed the recovery in the previous step, you can now boot into recovery by pressing volume-up or volume-down twice to select the recovery option, and then the power button to enter it. If you simply booted into the recovery file without flashing it in the previous step, you should already be in recovery now.
    9. Once in recovery, take a backup to be on the safe side.
    10. Flash the downloaded SuperSU and busybox package zip file from recovery.
    11. Clear cache and dalvik cache just in case (not required but won't hurt).
    12. Reboot the device.

    ADB and Insecure Boot Image Method:

    • Grab the insecure boot image from this thread.
    • Also download these root files. This package includes the latest SuperSU 0.98, latest su binary that comes with it, and working busybox (not sure if latest).
    • Extract the contents of the downloaded zip file to your computer.
    • Enable Android Debugging from Settings > Developer Options. (If you can't find developer options, go to 'About' and tap 'Build number' seven times.)
    • Connect the device to your computer via USB, and install the required drivers.
    • Reboot into fastboot/bootloader:
      Code:
      adb reboot bootloader
      You can also power off the phone and then use power + volume-down key combination to get into bootloader.
    • Unlock the bootloader if you haven't done so already. WARNING: This command will wipe all data on your device.
      Code:
      fastboot oem unlock
    • Get back into bootloader mode and boot into the downloaded insecure boot image:
      Code:
      fastboot boot boot.img
      Don't worry, this will not replace your existing boot image and will only boot from the insecure one once.
      If it does NOT work for you and you get stuck in a boot loop, simply reboot your phone into bootloader and use the above command again. Some users had issues with booting from it the first time, but a second attempt worked.
    • Once booted into Android successfully using the insecure boot image, simply enter these commands one by one in command prompt (making sure you are in the directory where you downloaded the files):
      Code:
      adb shell mount -o remount,rw /system
      adb push su /system/bin/
      adb push Superuser.apk /system/app/
      adb push busybox /system/xbin/
      adb shell
      chmod 06755 /system/bin/su
      chmod 0644 /system/app/Superuser.apk
      chmod 04755 /system/xbin/busybox
      cd /system/xbin
      busybox --install /system/xbin/
      exit
      exit
    • Reboot your device.

    You will now have root access. Tested and confirmed working by Stryder5 and many others.

    Credits:

    Stryder5 for testing, confirming, tipping me about working CWM, providing the required drivers, and helping others on the thread. :highfive:
    Harry GT-S5830 for the insecure boot image.
    fkrone for his recovery revert disabler script and his unofficial working CWM before an official one became available.
    Kstarz for posting this same recovery method with his own working CWM in this thread before an official one was out.
    evaradar for informing about the release of official ClockworkMod recovery.
    Koush for developing ClockworkMod recovery.
    Chainfire for developing SuperSU.
    Everyone else on this thread for testing, providing feedback and hitting the 'THANKS' button. =)

    I have tried my best to give everyone the due credit but if I have missed out on anyone, please do remind me.
    6
    Yep, worked like a charm. Got Titanium running and restored all my apps :)

    Btw, check your PM.
    5
    For the people who get this far looking for a fix to the infinite boot animation (particularly if you used the CWM method):
    hold power + down vol twice until you get back to the fastboot screen
    fastboot boot cwm-recovery-mako.img
    clear cache + dalvik cache
    unplug from pc
    reboot from within CWM

    That's how I got out of the loop :) hope it helps
    3
    Checked...thanks. =) Added the links.
    3
    Need help... followed the CWM procedure to gain root, flashed CWM also. But it seems to be not persistent. When I tried to boot into recover, I just see the green android lying down with the exclamation mark. After a while it boots normally. What should I do now? Was trying to flash another ROM...

    Thanks!

    in your System/ folder there is a recovery-from-boot.p file. rename that to recovery-from-boot.bak and reflash cwm. it shouldnt delete itself now