Root Your Nexus 5 Under Linux [Guide]

I am using Linux Mint for this guide, and unlike Windows, under Linux you do not have to install any additional drivers. If you are using Ubuntu or Fedora, you need to set up some things for ADB to work. You can follow my Ubuntu or my Fedora guide to set up ADB. With Linux Mint you just plug and play, that is the beauty of it 🙂

Now let’s get down to the Nuts and bolts of this guide

[topads][/topads]

WARNING!: Rooting your phone will erase all of your data. So back up first, then root!!

Getting ADB and your Phone Ready

  1. Download the latest Android SDK.
    • Scroll to the bottom of the page: DOWNLOAD FOR OTHER PLATFORMS -> SDK Tools Only -> Linux 32 & 64-bit
  2. Extract the TGZ file to your home/YOUR-USERNAME directory
  3. On your phone, click Settings > Applications > Development and make sure USB Debugging is on.
    • Tap seven times in Build Number: Settings > About Phone > Build Number
    • You will get a message saying you have enabled Developer Options or something like that, go back to Settings and you will see Developer Options in there.
  4. Once you have done the above, you need to add adb to your PATH as environmental variable.
    • Open a terminal window in your home (~) directory and type: sudo vi .bashrc (or sudo gedit .bashrc if you don’t like vi)
    • Add the following line at the end: export PATH=${PATH}:/home/YOUR-USERNAME/android-sdk-linux/platform-tools
    • Save and close the terminal window
  5. You should be ready to go, type in a new terminal window adb devices with your phone plugged in and you should get the below message in your phone. Check Always allow from this computer and press OK
Allow USB Debugging Message
Allow USB Debugging Message
  1. In your terminal you will get the following
esilva@esilva-N56VJ ~ $ adb devices
List of devices attached
063dcadc0ae59d9a device

Unlocking the Bootloader

  1. Turn the phone off. Then boot it into the bootloader/fastboot mode by holding volume down + power
  2. Plug your Nexus 5 into your PC and open Terminal (make sure you log in as root)
  3. cd to /home/YOUR-USERNAME/android-sdk-linux/platform-tools
  4. Type ./fastboot devices
esilva-N56VJ platform-tools # ./fastboot devices
063dcadc0ae59d9a fastboot
  1. If you get an output similar to the one above, proceed to typing ./fastboot oem unlock. You will get an output similar to the one below (Remember that this step will wipe EVERYTHING off the phone)
  2. On the phone a screen should pop up asking whether or not you would like to unlock the bootloader. Use the volume rockers to highlight “Yes” then press power to confirm the action.
esilva-N56VJ platform-tools # ./fastboot oem unlock
...
OKAY [ 23.817s]
finished. total time: 23.818s
  1. After the above command has finished executing, you need to reboot your phone via ./fastboot reboot
esilva-N56VJ platform-tools # ./fastboot reboot
rebooting...

finished. total time: 0.001s
  1. The phone will reboot. Next you will be presented with a screen containing an android logo and a progress bar (this may take up to ten minutes to complete). Wait until the phone has fully booted up into android, then proceed onto the next section of the guide

Installing a Custom Recovery

  1. Download a custom recovery image
  2. Turn the phone off. Then boot it into the bootloader/fastboot mode by holding volume down + power
  3. Still with terminal opened in /home/YOUR-USERNAME/android-sdk-linux/platform-tools
  4. (Most than likely, your custom recovery image will be under your Downloads directory). Type ./fastboot flash recovery recovery.img. You will get the below output
    • Note: recovery.img is name of your downloaded recovery
esilva-N56VJ platform-tools # ./fastboot flash recovery "/home/esilva/Downloads/Nexus 5/Root/recovery.img"
sending 'recovery' (13306 KB)...
OKAY [ 0.619s]
writing 'recovery'...
OKAY [ 1.057s]
finished. total time: 1.676s
  1. On the phone, use the volume buttons to scroll onto “Restart Bootloader” and hit power to select it. After the bootloader reloads, use the volume buttons to scroll onto “Recovery Mode” and power to select it. You should then be greeted with your newly installed custom recovery
  2. Close Terminal

Rooting

  1. Download SuperSU to your Downloads directory
  2. Open a new Terminal window and plug in your phone. You do not need to be logged in a root
  3. Turn the phone off then boot into the bootloader. (volume down + power).
  4. Once in the bootloader use the volume rockers to scroll onto Recovery Mode, then press power to select it. This should bring you into your newly installed custom recovery. Leave the phone at the home page of the custom recovery
  5. Type adb push /home/YOUR-USERNAME/Downloads/UPDATE-SuperSU-vX.XX.zip /sdcard/
  6. This will copy the SuperSU zip onto your phone. Once the command has completed continue with the instructions to use TWRP or CMW

TWRP

  1. Install > browse to SuperSU zip and select the it
  2. Swipe to confirm the installation. Then reboot

CWM

  1. Install zip from sdcard > choose zip from sdcard.
  2. Next, browse to the location where you previously copied the SuperSU zip and select the it.
  3. To confirm the installation, scroll down to “Yes” and select it. The installation shouldn’t take very long, and once it has completed you may reboot

That is it, you now have rooted your Nexus 5 🙂

[bottomads][/bottomads]

Spread the love

8 thoughts on “Root Your Nexus 5 Under Linux [Guide]

  1. Kenneth says:

    This worked great, thanks!

  2. Carlos says:

    Awesome tutorial! Thanks for all the valuable info. You can probably add this how to solve this error that, in my case, happened:

    [carlos@charly platform-tools]$ ./adb push /home/carlos/Downloads/UPDATE-SuperSU-v2.14.zip /sdcard/
    error: insufficient permissions for device

    [carlos@charly platform-tools]$ sudo ./adb start-server
    [sudo] password for carlos:
    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    [hackachals@charly platform-tools]$ ./adb push /home/carlos/Downloads/UPDATE-SuperSU-v2.14.zip /sdcard/
    10028 KB/s (2647622 bytes in 0.257s)

  3. nx5 says:

    Might want to add a big warning that unlocking the bootloader wipes all user data… just lost all my data.

  4. DSP says:

    My Nexus 5 is soft bricked and mt TWRP is also not working.

    I am trying NRT toolkit on my linux mint. However it gives me error that ADB/FASTBOOT device not connected. Is there a way I can install ADB drivers for my NEXUS5?

  5. Nils H. says:

    I’d need some help with the following:

    When I cd to /home/MY-USERNAME/android-sdk-linux/platform-tools

    it says, that the android-sdk-linux/platform-tools was not found. I’m pretty sure I followed the steps above correctly. Could anyone help?

    Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.