How To Root Google Nexus 4 & Install ClockworkMod Recovery
And just like that, we have rooted the Nexus 4! Running Android 4.2 Jelly Bean, Google’s latest Nexus device by LG has started hitting the shelves in the US and UK, but the remaining parts of the world still hold eager fans who have yet to get there hands on this device. Luckily – as is the case with all that is Nexus – expectant users can now not only root their Nexus 4, but install ClockworkMod recovery on it as well just as soon as they get their hands on it. Having already brought to you an overview of the new features of Android 4.2 Jelly Bean, gaining root access will throw even more fun your way. Wondering why you should root? View our guide on the top 10 reasons to root your Android device. Ready to root and install ClockworkMod? Read on for the detailed instructions.
Update: An all-in-one Nexus 4 toolkit is now available. It allows one-click root, bootloader unlock, easy installation of ADB/fastboot drivers, backup and much more. However, as of this writing, it does not allow flashing ClockworkMod recovery.
We will be providing two different methods here for rooting the Nexus 4:
- Using ClockworkMod recovery to flash a zip file containing root files.
- Booting with an insecure boot image and manually transferring root files to the device via ADB.
Needless to say, rooting using the custom recovery will be the easiest and safest way to go. In addition, we will also be providing instructions for flashing ClockworkMod recovery.
Disclaimer: Follow this guide at your own risk. AddictiveTips will not be liable if your device gets damaged or bricked during the process.
Requirements
- Nexus 4 with unlocked bootloader. For instructions on unlocking the bootloader, refer to our Android bootloader unlock guide.
- ADB with fastboot installed on your system. You should see our guide on what is ADB and how to install it.
- Make sure Android debugging is enabled in Settings > Developer Options. Can’t find Developer Options? Here is how you can unhide Developer Options in Android 4.2.
- ClockworkMod Recovery (Download the latest touch recovery for Google Nexus 4)
- SuperSU Package with Busybox (Required only for ClockworkMod Recovery method)
- Insecure boot.img and Root Files (Required only for Insecure boot.img method)
- Original boot.img and original recovery (Required only for restoring)
For the following steps involving commands, we will assume that you have downloaded the required files to C:\Nexus folder. If you are using another directory for the purpose, change it appropriately in the commands.
Take a Backup (Highly Recommended)
It’s always better safe than sorry, so it’s best to take a backup before proceeding any further. To do so:
- Download the ClockworkMod recovery image from the link given above to your computer and rename it to recovery.img
- If you are going to use the recovery method below for rooting, now would be a good time to also download the ‘SuperSU Package with Busybox’ from the link given above and copy it to your phone’s (internal) SD card.
- Reboot your phone into fastboot mode by powering it off and then pressing and holding volume-down and power buttons.
- Connect the device to your PC via USB.
- Open a command prompt window and enter the following commands to check if the recovery is functioning or not (boots into recovery without flashing it):
cd c:\Nexus fastboot boot recovery.img
- If the recovery boots correctly, you are good to go. Now perform a backup from ‘backup and restore’.
This should give you a safe point to return to in case anything goes wrong. We will also include steps for restoring this backup at the end of this guide.
Root Using ClockworkMod Recovery
This is the recommended method for most users. Unless this method doesn’t work for you or you specifically want to use the insecure boot image method, we recommend that you stick with this one.
- You should still be in recovery mode. If not, get into it using the method provided above.
- Go to ‘install zip from sdcard’ > ‘choose zip from sdcard’ and select the SuperSU zip file.
- Once the file has installed successfuly, reboot the device.
You can now check your app drawer for the SuperSU app. If it is there, your device has been successfully rooted.
Root Using Insecure boot.img
In case you don’t want to use the ClockworkMod recovery method, you can use this alternative method that involves manually copying the required files to the device via ADB, after booting with an insecure boot image that allows full read/write access in ADB.
- If you are currently booted in Android or recovery mode, reboot the device into fastboot mode.
- In the command prompt window, enter the following command to check if the insecure boot.img will work or not. (Note that the command will not permanently flash the boot.img but simply boot the device into it.)
fastboot boot boot.img
If the phone boots properly, you are good to go. If it doesn’t, the boot image didn’t work for you and you should just reboot the device and use the ClockworkMod method above instead.
- Download the Root Files from the link given above and extract the contents of the downloaded zip file to the same C:\Nexus directory.
- Now enter the following commands one by one:
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 phone.
If all goes well, you should now have root access.
Flash Insecure Boot Image (Optional)
Flashing the insecure boot image will give you the ability to run ADB as root and use the ‘adb remount’ to get full read/write access to the entire file system of your phone.
- It is HIGHLY recommended to take a backup before this step. Use the instructions provided above for the purpose. If you have already rooted, you might want to take a backup again so that you wouldn’t have to root again in case things go wrong and you need to restore the backup.
- Make sure you are into fastboot mode. If you aren’t, get back into it as described above.
- Enter the following commands on your PC:
fastboot flash boot boot.img
You should now have the insecure boot image flashed. In case it doesn’t work after flashing, simply restore the backup you took before flashing it using the restore instructions provided below, and things should be back to normal. In case the ClockworkMod backup didn’t work for you, you can always reflash the stock boot image using the direct restoring method provided below.
Install ClockworkMod Recovery (Optional)
Update: The official and fully working version of ClockworkMod recovery is now available. If you want the ability to install recovery-flashable mods, hacks and ROMs to your device, you will want to flash it. If all you need is root access, you don’t need it.
To flash latest ClockworkMod recovery, just follow these steps:
- If you haven’t done so already, download the ClockworkMod recovery image from the link given above and rename it to recovery.img
- Open a command prompt and navigate to the folder where you downloaded the recovery image.
- Put the phone into fastboot mode again and enter the following command:
fastboot flash recovery recovery.img
You should now have ClockworkMod recovery installed and you can boot into it by booting into fastboot mode, selecting ‘Recovery mode’ using the volume keys and pressing the power key to enter it.
Restoring the Backup (If Anything Goes Wrong)
In case you have flashed the insecure boot image and stuck in a bootloop after that, or flashed an unofficial recovery and found yourself unable to boot into it, messed things up in any of the commands, or simply experiencing problems on your device after rooting it, you can always revert back to the backup you took. To do so:
- Boot into recovery using the same method that you used when taking the backup.
- Go to ‘backup and restore’ and restore the backup you had taken from there.
Once the backup has been restored, things will get back to normal. It’s that simple, really.
Directly Restoring Original Boot and/or Recovery Image
In case you have flashed the insecure boot image and stuck in a bootloop after that, or flashed an unofficial recovery and found yourself unable to boot into it, you can revert back to the original boot and/or recovery image as follows:
- Boot your device into fastboot mode.
- Download the original boot image and/or the original recovery image from the links provided above and place them in the same C:\Nexus directory. Make sure to rename the previously downloaded insecure boot.img and/or recovery.img to something else first, since these files are named the same.
- In the command prompt window, enter the appropriate command:
- To restore original boot image:
fastboot flash boot boot.img
- To restore the original recovery image:
fastboot flash recovery recovery.img
If you have flashed both, you can restore both by using the commands one after the other.
- To restore original boot image:
- Reboot the device, and you should be good to go.
For updates and queries related to the boot.img method, head over to the forum thread at XDA-Developers. For any comments or problems regarding the manual rooting method via insecure boot.img, head over to this XDA-Developers thread.
Additionally, you may want check out our compilation of 15 must-have apps for your rooted Android phone.
Zayed Rehman contributed to this post.
I keep getting “can’t Mount /sdcard” error so i installed twrm recovery and wiped data and after 2 or 3 reboot it recognized my sdcard and after that i installed cyanogenmode.
Will rooting the device prevent future official OTA updates from google just like what happens with HTC One X and GSIII?
I’m really trying to get back to normal. I flashed both boot image and stock recovery and my phone still won’t boot past start up screen. Is my device bricked? I’m so frustrated. I only used the phone for a few hours. Please advise me. Thanks
That’s weird; try this: Boot using the clockworkmod recovery (withOUT flashing it), then wipe cache and dalvik cache, and reboot again. If that doesn’t work, visit the XDA developers thread (using the link provided) and go through the posts there; just a few others ran into this issue and some of them posted a way to fix it, I believe.
If all else fails, simply flash the stock factory image provided, and you should be good to go. The device isn’t bricked; any of these issues are fully recoverable by flashing any official factory image for the device. =)
step 4 of root using secure insecure boot.img, your code is cut off and currently only shows:
adb shell mount -o remount,rw /system adb push su /system/bin/ adb push Superuser.apk /s
Thanks for pointing it out; there was a problem with the formatting. I have corrected it.