The new Android 5.0 update brings some new security enhancements at the kernel level. With this new Android OS update, SELinux is now set to enforcing (permission denied automatically for 3rd party apps) which is supposed to be good for the Android ecosystem. This new permission is causing new problems in rooting our Nexus 5. While it is possible to set the SELinux back to permissive mode, it can’t be achieved without modifying the kernel.
From security point of view, enforced permission is best for SELinux, thus, Chainfire, a legend in the field of rooting, has provided us with modified kernel which makes the SELinux for Nexus 5 permissive only within the scope of rooting, not system wide. Thus, this way of rooting is more secure since Chainfire’s custom kernel sets the SELinux permission to permissive, partially thus retaining the security of most of the system as default enforcing.
May be in future Chainfire will provide us with a way to root our Nexus 5 without modifying the kernel. But until then, all we can do to root Nexus 5 running Android 5.0 Lollipop is to flash the modified kernel on our device, then flash the SuperSU app (in a zip) via a custom recovery (TWRP).
Following this procedure may void your warranty. You yourself are responsible for your device. We can’t be held responsible for what happens to your device.
Before you begin following this guide, make sure that you read the following points. They are essential and you must follow them.
Things to remember
- 1Install Device drivers
This procedure requires you to connect your device on your PC. Thus, it is essential that your device is recognized properly by your computer. If your device isn’t detected by your PC or you don’t know how to install the drivers on your pc then follow our guide to install Nexus 5 ADB and Fastboot drivers.
- 2Unlock your Bootloader
Your Nexus 5’s Bootloader must be unlocked to flash the modified kernel image onto your device. Without unlocked bootloader, you can’t run any Fastboot commands needed to flash the kernel. We have created a guide to unlock Nexus 5 Bootloader, just follow it carefully to unlock your Nexus 5 bootloader.
Skip, if your device’s bootloader is already unlocked.
- 3Install TWRP Custom Recovery
Install TWRP custom recovery to flash the SuperSU binary files and app on your device. Installing the SuperSU app, allows/deny you to grant root permissions to 3rd party apps easily. Follow our guide to install Nexus 5 TWRP recovery on your Nexus 5.
- 4Maintain proper battery level
This procedure could go horribly wrong if your device’s or PC’s battery dies suddenly in the middle. Thus, make sure that both your device and PC has atleast 50% battery level before you try to root your device.
Guide – Root Nexus 5 Running Android 5.0 Lollipop
- 1Download and transfer the SuperSu zip (UPDATE-SuperSU-v2.14.zip) file to your device’s internal memory.
- 2Download and extract the ADB-Fastboot-Files.zip to a separate folder on your PC.
- 3Download and extract the nexus5-hammerhead-lpx13d-kernel.zip on your PC, you’ll find a boot.img file inside the extracted folder. Copy this file to the extracted folder in Step 1.
- 4Follow steps below to enable USB debugging on your device.
- Enable Developer Options – Go to Settings > About Phone and tap on the build number seven times.
- Enable USB Debugging – Now a new Developer Options menu should appear at the bottom of the Settings menu. Open Developer Options and tick the USB debugging box (under Debugging section).
- 5Open the folder where you extracted the ADB-Fastboot-Files.zip file. Press Shift + Right click on any empty space inside the folder, a new context menu should open, select Open command window here.
- 6Now connect your device to PC via USB cable. A popup menu will appear on your device asking for permission to allow USB debugging option. Tick the Always allow from this computer and then press OK.
- 7To ensure that your device is detected on your PC, in command prompt, type in the following command
If your device doesn’t appear on the list of available device then there is a communication problem between your device and your PC. Read our guide to install the Nexus 5 device driver once again and make sure that you are following the guide properly. If the issue still persist, post a comment below.
- 8Boot your device in Bootloader Mode by typing in the following command on command prompt
adb reboot bootloader
- 9Now flash the modified Nexus 5 boot image (kernel) on your device by typing in the following command on the command prompt.
fastboot flash boot boot.img
- 10Once boot.img is successfully on your device, your Nexus 5 is not rooted. Congrats, but we still have to flash SuperSu App on your device. To do so, press the Volume Down button twice followed by Power button, this will enter your device into TWRP recovery.
- 11Once in TWRP recovery, follow the following procedure to flash the SuperSU zip on your device.
- On main menu, select Install.
- Browse the folder where you save the UPDATE-SuperSU-v2.14.zip file on your device and select it.
- Swipe on Swipe to Confirm Flash button to confirm the flashing of the SuperSU zip file.
- Once the flashing procedure is complete, select Reboot System.
Done! Your Nexus 5 is now rooted.
If you have faced any problems while following this tutorial or want any clarification, feel free to mention in the comment below. We would also love to hear some success stories from you.