1 Answer
1

Disclaimer: By attempting ant of the processes listed below, you accept full responsibility for your actions. I will not be held responsible if your device stops working, catches fire, or turns into a hipster and claims to have been modified before it is cool. Make sure you read the whole article and fully understand it BEFORE attempting it.

If you are experienced in unlocking & flashing recovery & rooting, here are the resources you need.

1. Unlock Bootloader (Skip if unlocked already)

First make sure you have installed adb and fastboot on your PC (or Mac). Ensure that your phone has at least 60% battery remaining, and that your PC is plugged in and won't shut down spontaneously during the process. The procedure doesn't take very long , but it‘s best to have enough charge in case something goes wrong.

Backup (Optional): Unlocking the bootloader will completely wipe all data from the device. This includes apps, settings and even the contents of the internal sdcard (pictures, music, etc.). Copy all important files off the phone onto a PC or upload them to a cloud.

Enable OEM Unlocking: On your phone go to Settings > Developer options. Then enable the OEM Unlocking option. Also,a free advice, make sure that from now on, OEM unlocking option is enabled before you reboot. Because sometimes it might get disabled itself. Yeah that's weird so be careful.

Turn the phone off. Then boot it into fastboot mode by holding volume up + power or select reboot to bootloader if advanced reboot is activated via developer options. The phone will display "fastboot" text indicating that it has successfully entered fastboot mode.

Warning: By proceeding this step, you will lose ALL data on your phone, including apps, games, musics, photos and everything else! Make proper backup before proceeding. Your warranty may also void, depending on your local law restriction and EULA.

Plug the phone into your PC, then open a command prompt (or a terminal on Mac/Linux) and run

fastboot oem unlock

You would be greeted with a Unlock Bootloader Warning page, Hit the Vol button to select Yes and turn it Blue and Hit the Power Button to Execute the selection

Your device will reboot, showing you a Secure Boot Warning. Reboot into stock recovery and wipe all data. Once done, your phone will reboot into the OS. Continue to the next step to install Custom Recovery.

2. Install TWRP

Download TWRP (.img) and SuperSU (.zip) from the top of this article if you haven't had them yet. Place them on the phone internal memory or a USB stick as per convenience.

PS: Flash DM Verity and format data only if you want to stay unencrypted, else you may just skip and continue with flashing SuperSU.

Without leaving TWRP, transfer the no-verity-opt-encrypt zip to your device over MTP and flash it or select it from internal as placed before, or use a USB stick (via OTG) and flash it (This will also allow you to use Format Data to completely disable your encryption if desired).

Bueno! Congratulations! Your OnePlus 5 now has an unlocked bootloader, has a custom recovery installed and is rooted. Enjoy!!

Credits: This post is mostly copied from the original post on XDA Developers Forum. I changed a few details so that it fits better on Android Enthusiasts Stack Exchange. Thanks to the original author (Funk Wizard on XDA)!

after doing this will i still be able to enable and use OS phone encryption (settings > security & lock screen > encrypt phone)? is there a better way to encrypt the device? from your answer it would seem that the OS after root will be the same OxygenOS from oem. is that correct? if not is it possible to keep OxygenOS after root and OTA updates? i ask because i had cyanogen on a previous phone and did not like it, but do like oxygenos quite a bit.
– brnnnrsmssnFeb 9 '18 at 19:38

1

@brnnnrsmssn Rooting does not change your OS. And of course, you can still opt-in to use /data encryption, which won't make anything wrong afterwards. If you update the OS via OTA, you must flash the SuperSU ZIP every time you update (but not the other steps like unlocking bootloader - those only needs to be done once).
– iBugFeb 9 '18 at 22:52

so SuperSU manages root access for installed apps. unlocking the bootloader allows install of of custom images through twrp and the image is what is allowing root? did i get that all correct?
– brnnnrsmssnMar 2 '18 at 19:23

@brnnnrsmssn Unlocking bootloader allows you to flash a 3rd-party recovery like TWRP, and it's TWRP that allows you to flash custom images. Other than that, you got it all right.
– iBugMar 3 '18 at 0:39