Requirements & preparation
- OnePlus 5 phone, duh!
- running stock/default OxygenOS system (updated to latest version)
- ..which is based on Android 9 Pie (check Settings > About phone)
- not rooted
Make sure all of your data on your OnePlus 5 are properly backed up - everything will be erased in this process (you have been warned)!
If you have custom ROMs (other than stock OxygenOS), this guide won’t work for you, sorry.
- Settings > About phone > keep tapping on “Build number” until you get a notification that “You’re a developer”
- Settings > System > Developer options - enable these:
- OEM unlocking
- Advanced reboot
- USB debugging
Download and save these for later
- TWRP 3.2.3 Recovery - feel free to download the newest or the most popular file
Transfer this file to your phone (ie. connect your OnePlus phone via USB to your PC, enable File transfer and copy the files over to your Internal storage).
You can probably skip steps 1-3 by installing
android-sdk-platform-toolsfrom Arch’s AUR, though I haven’t tested it myself
- Go to Android Studio - Command line tools only and download
sdk-toolsfor your OS
- Extract it and navigate to SDK Manager - on Linux: in
- Install SDK Platform Tools:
$ ./sdkmanager "platform-tools"
- Connect your OnePlus 5 via USB cable to your PC
- Navigate to newly created
platform-toolsfolder (should be on the same level as
toolsfolder from step 2, ie. go up 2 directories) and check if ADB recognizes your phone:
$ cd ../../platform-tools/ $ ./adb devices
No permissions errror? If you’ll get an error about “no permissions” and not being a member of pludgev group, fix it by
sudo usermod -aG plugdev $LOGNAME. Be sure to logout and login back in after that.
Wrong udev rules error? Install
android-udevpackage (Arch) or
adb(Ubuntu) - both of these should contain maintained udev rules for Android under Linux. Restart udevd afterwards:
$ sudo systemctl restart systemd-udevd.
If all goes right, you should see something like this (instead of “xxxxxxxx” you’ll see a different string ~ your serial number):
$ ./adb devices List of devices attached xxxxxxxx device
- Restart your OnePlus 5 phone into Bootloader - long press power button and select Bootloader.
- When you’ve booted into the Bootloader (“FastBoot mode”), go back to your terminal and enter:
$ ./fastboot devices xxxxxxxx fastboot
As before, if all goes right, you will see your serial number (here “xxxxxxxx”) and “fastboot”. If you don’t see this, make sure you have the udev rules correctly set-up.
- Unlock bootloader (finally!) - in Terminal:
$ ./fastboot oem unlock
Your OnePlus 5 will switch screen to a friendly disclaimer - use your volume keys to navigate and power button to confirm that you indeed want to unlock the bootloader. After all, you’ve come all this way, right?
Now the device will flash and clean, then restarts itself. At this point, your OnePlus 5 will act as a brand new phone, greeting you with the configuration wizard.
Once you’re done with initial setup, head over again to Settings and repeat steps necessary to enable developer mode, Advanced boot and USB debugging (see Requirements & preparation > Phone at the beginning of this guide).
Installing TWRP Recovery on OnePlus 5
- Download TWRP for Oneplus 5 - be sure to choose the one for Android 9.x (requires Pie firmware) - there are 2 download links available
- Reboot to Bootloader (~ FastBoot) again by holding down power button - keep your phone connected to PC
- When rebooted into FastBoot, switch over to your Terminal and run fastboot again (still in the
platform-toolsfolder as before):
$ ./fastboot devices xxxxxxxx fastboot
- Copy downloaded TWRP file into the same folder as
fastbooton your PC (ie. into
- Flash TWRP to your phone via Terminal (if you’ve downloaded newer version of TWRP, make sure to adjust file name accordingly):
$ ./fastboot flash recovery twrp-3.2.3-0-20190311-codeworkx-cheeseburger.img Sending 'recovery' (30448 KB) OKAY [ 0.722s] Writing 'recovery' OKAY [ 0.286s] Finished. Total time: 1.019s
- When flashing completed successfully, use the volume keys on your OnePlus again to select “Recovery mode” and confirm via power button - this will take you to your fresh TWRP recovery
- TWRP will ask you if you will allow it to modify system partition - go ahead and swipe at the bottom to confim
Congrats! That’s it, your bootloader is unlocked and the custom TWRP Recovery installed.