6
Guide Unlock Bootloader , Install recovery and Root OnePlus 2 using Ubuntu

  1. nirmik379kale
    Gingerbread Sep 15, 2015

    nirmik379kale , Sep 15, 2015 :
    Hello guys,

    So i went through the forum today asa i got my OnePlus 2 and saw there are no posts on rooting etc using Ubuntu. Though it doesn't really differ in the commands or anything, i thought i should just post a proper guide for it. I am using Ubuntu 14.04 LTS for this process
    I Hope it helps you.

    CAUTION: After installing custom recovery, OTA updates dont work out of the box! TWRP cannot install partial OTA zips. So you will need to download and install full zips for updates. So if any updates are pending, do them before proceedings

    Link to all update packages ( ota and full zips ) : https://forums.oneplus.net/threads/oneplus-2-stock-rom-collection-updated-01-09.347627/

    credits for above link : thread owner - @inffy

    -------------------------------------------------------------------
    Install adb-tools and fastboot :

    Code:
    sudo apt-get install android-tools-adb
    sudo apt-get install android-tools-fastboot
    -------------------------------------------------------------------
    On the device :
    • Go to settings
    • tap multiple times on build number to enable developer options
    • go to developer options
    • toggle On OEM Unlocking
    • toggle On advanced reboot
    • toggle On Android debugging

    -------------------------------------------------------------------
    Make Sure:

    • At this point of time, make sure you have taken all the backup of your data. Because, the phone will Factory Reset once we do OEM Unlock. Although data in internal memory is not erased, its safest to take a backup so as to not regret later!
    • Battery is charged around 80% atleast. The phone generally eats up a lot of battery when in recovery mode ( which we will go into later ). So its best to have the phone well charged!
    • Connect the phone to your Ubuntu machine with adb enabled on device. you will see a RSA signature to trust the device connection. Select always trust. To check if device is detected -
    open ubuntu terminal​
    Code:
    change user to root :  sudo -s[/INDENT]
    enter command : adb devices
    you shall see your device listed.

    If you see somethig like
    then either you are not hitting the command as root. If thats not the case, try as root :
    Code:
    adb kill-server ; adb devices
    If your device isnt recognized still, try this :

    This will most probably solve your issue.
    credits for the above solution : @mwayner

    If your phone is still not detected, try the method bellow
    credits for the above solution : @nitramcek

    But, If it still, unfortunately hasn't worked, try this :
    you will need to add the vendor ids in some files. Here is a link to my thread on how to do so which will also solve the problem of detecting the OnePlus 2 as MTP device on Ubuntu :

    https://forums.oneplus.net/threads/detect-oneplus2-in-ubuntu-in-mtp-mode.365343/
    -------------------------------------------------------------------
    Unlock Bootloader (OEM Unlocking) :

    To unlock the bootloader of your op2,

    Reboot to fastboot mode. You can do this in 2 ways :
    1. Connect phone to Ubuntu machine and enter command :
    Code:
    adb reboot-bootloader
    OR
    2. On the phone, log press power button > reboot > bootloader

    After this, you will see a screen with text saying Fastboot Mode.
    Now, check if the Ubuntu machine detects the phone in fastboot mode with command :
    Code:
    fastboot devices
    you will see your phone listed if it is detected.

    If it is dected, enter following command to unlock the bootloader finally!
    Code:
    fastboot oem unlock
    This will take you to a screen with Chinese text on the phone.
    Option 1 means Proceed
    Option 2 means Cancel

    If you are sure you want to proceed, select the 1st option!
    CAUTION : as mentioned earlier, your phone will factory reset at this point if you selected Yes

    To ensure this has succeeded, go back to fastboot mode and enter command :
    Code:
    fastboot oem device-info
    If the output contains something that looks like below, you are successful !!

    -------------------------------------------------------------------
    Install any custom recovery on your OnePlus 2 :

    My Prefered Recovery : https://drive.google.com/file/d/0B98G0KTJwnBFTThnWnFxMDZDWnc/view
    credits for the recovery : heisenberg from xda

    The stock recovery can only flash signed zips, thus rooting etc cannot be done from the stock recovery.

    CAUTION: After installing custom recovery, OTA updates wont work since TWRP , etc cannot flash partial OTA zips. You will need to flash full OS ZIPs to update manually. If your device is still new, I recommend you first do the OTA updates and then proceed.

    • To flash custom recovery, go to the fastboot mode and connect device to ubuntu machine.
    • On the ubuntu machine cd ( change directory ) to the folder where you have downloaded your recovery.
    • when in fastboot mode, on the ubuntu machine, enter command :
    Code:
    fastboot flash recovery <recovery file>
    replace <recovery file> with the .img file of the downloaded recovery you want to use.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    NOTE : This did not work for me, when i rebooted to recovery , it rebooted to stock recovery. This is to do with "Replacing stock recovery with TWRP". I used following method to easily get around


    • first copy the img file to the phone. Then reboot in fastboot mode
    • command :
      Code:
      fastboot boot <recovery img>
    • in my case i was using twrp in above link.
    • Then, phone will boot into TWRP recovery.
    • When in TWRP : Install > select "images" in bottom right, you will see the twrp image in the list to flash > select it > select recovery ( be careful ) > swipe to confirm
    • When rebooting, it will ask to disable stock recovery, swipe and say yes.
    • Reboot to recovery

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    TaDa ... you've successively installed a custom recovery!!

    -------------------------------------------------------------------
    Root Your OnePlus 2 :

    rooting your OnePlus 2 is now just a matter of installing SuperSU.

    Here is the link to superSU zip to flash :
    http://forum.xda-developers.com/showthread.php?t=1538053
    Credits for SuperSU download - Original developer on xda

    • Download the SuperSU zip
    • Copy it to the phone
    • Reboot to Recovery
    • Select Install
    • Choose the SuperSU zip
    • Swipe to confirm
    • Reboot!
    And you have successfully rooted your phone using Ubuntu!!
    Congratulations !

    Note : If i haven't accidentally mentioned credits to someone, please feel free to contact me, i shall do so!
    PS: Don't forget to hit the Like button below if iv'e helped you!
     
    Last edited: Oct 6, 2015

    #1
    muehsi, amb67, Dr. Indest and 3 others like this.
  2. Buzzrr
    Ice Cream Sandwich Sep 19, 2015


    #2
    nirmik379kale likes this.
  3. Buzzrr
    Ice Cream Sandwich Sep 19, 2015


    #3
  4. nirmik379kale
    Gingerbread Sep 19, 2015

    nirmik379kale , Sep 19, 2015 :
    Thats weird.
    I never faced problems with fastboot.
    Could you paste the output of the command (as root) : lsusb

    enter this command when you are connected in fastboot mode
     

    #4
  5. nirmik379kale
    Gingerbread Sep 19, 2015


    #5
  6. nitramcek
    Ice Cream Sandwich Sep 19, 2015

    nitramcek , Sep 19, 2015 :
    Great guide for us with Ubuntu.
    Nicely explained with details and link's.
    So anyone can do it.
     

    #6
    nirmik379kale likes this.
  7. Buzzrr
    Ice Cream Sandwich Sep 19, 2015

    Buzzrr , Sep 19, 2015 :
    Okay I'll try it and get back to u
     

    #7
  8. mwayner
    Lollipop Sep 19, 2015

    mwayner , Sep 19, 2015 :
    Nicely done guide. An alternate, which I used, was Oneplus's stuff. The OP2 comes pre-loaded it's adb drivers, in a drive labeled OnePlus Drivers.
    My steps were:
    1. Copy the adb_config_Linux_OSX.sh file to Desktop
    2. Right-click and check it's Permissions allow it being executable.
    3. Open Terminal and enter:
    Code:
    cd ~/Desktop
    4.
    Code:
    chmod +x adb_config_Linux_OSX.sh
    5.
    Code:
    sh ./adb_config_Linux_OSX.sh
    And it was done. :)
     

    #8
  9. nirmik379kale
    Gingerbread Sep 19, 2015

    nirmik379kale , Sep 19, 2015 :

    hey!
    Thanks a lot!

    i had done this too but it didnt really help me for some reason! it just said adb already exists in home or something... weird... but if its working, thats a great thing. Ill add to the post above!
     

    #9
    mwayner likes this.
  10. nirmik379kale
    Gingerbread Sep 19, 2015

    nirmik379kale , Sep 19, 2015 :
    Thanks a lot friend :)
    Glad it helped !
     
    Last edited: Sep 20, 2015

    #10
    mwayner likes this.
  11. viss
    Cupcake Sep 22, 2015

    viss , Sep 22, 2015 :
    So I'm an idiot, and instead of flashing 'recovery', I accidentally flashed 'boot'. Now my oneplus2 boots into TWRP and not the actual OS.

    Does anybody know where I can find the oneplus2 boot image?
     

    #11
  12. ZLima12
    Gingerbread Sep 22, 2015

    Last edited: Sep 22, 2015

    #12
    nirmik379kale likes this.
  13. nirmik379kale
    Gingerbread Sep 22, 2015

    nirmik379kale , Sep 22, 2015 :
    hey, i have a twrp backup of my boot.img
    i can give you that. idk if its possible to cross restore boot images , but you can try!

    • unzip the given zip
    • when in twrp, connect to Ubuntu machine and copy the extracted folder to location > /sdcard/TWRP/BACKUPS/
    • In TWRP, Restore > select and swipe.
    • This time be sure to select boot ! :p
    https://drive.google.com/file/d/0B_KEE3OamyciUnUwaVdpeF9QQm8/view?usp=sharing
     

    #13
  14. nirmik379kale
    Gingerbread Sep 22, 2015

    nirmik379kale , Sep 22, 2015 :
    you will buddy! soon! :D
     

    #14
  15. nitramcek
    Ice Cream Sandwich Sep 23, 2015

    Last edited: Sep 23, 2015

    #15
    nirmik379kale likes this.
  16. nirmik379kale
    Gingerbread Sep 24, 2015

    nirmik379kale , Sep 24, 2015 :
    thats great man, is adb devices working now?
     

    #16
  17. nitramcek
    Ice Cream Sandwich Sep 24, 2015

    nitramcek , Sep 24, 2015 :
    I didn't try it but when go in recovery (bootloader) with phone then adb works.
    So I did manage do do everything.
    It's just strange that adb didn't work when phone was in normal mode.
     

    #17
  18. nirmik379kale
    Gingerbread Sep 24, 2015

    nirmik379kale , Sep 24, 2015 :
    it sounds stupid, but you sure developer options was on , and android debugging was on too , as well, you had trusted the rsa for your machine?
    sometimes it can happen to the best of us! :p:D
     

    #18
  19. Tirigon
    Froyo Sep 24, 2015

    Tirigon , Sep 24, 2015 :
    Not got any invite yet, but was hoping for a Linux guide like this - thx a lot for your work!
     

    #19
    nirmik379kale likes this.
  20. baulee56
    Ice Cream Sandwich Sep 24, 2015


    #20
    nirmik379kale likes this.