[OnePlus 3 Guides, News, & Discussion] dbabaev21:
[GUIDE] OOS v4.0.3 ---> FLASH & ROOT STOCK -OR- CUSTOM ROM WITH EASE & CORRECTLY

If you think that I need to add more information to this guide, please post your request. I'm not able to guess what you want from me to add to this guide.

Thank you!

INTRODUCTION:

This guide is mainly for users who tried flashing OxygenOS v4.x.x the easy and short way (like in post #9 in this thread), which had issues in the process.

I covered the most common issues with flashing OOS v4.x.x in this guide. However, you can use this guide to flash OxygenOS (latest Stable and Beta versions)

and root them OR flash your custom ROM. Just follow the instructions.

Now, you ask “why I decided to write this guide?”. Well here’s my story:

I had FreedomOS v1.7 with Google apps installed (including Dialer and Contacts from OpenGApps), encrypted, official twrp (v3.0.2-1), Xposed (v3.1.1), framework (v87),

AdAway v3.2, YouTube AdAway and SuperSU v2.79 (stable). Also, stock kernel, no Dolby ATMOS or A.R.I.S.E apps.

So, when OOS v4.0 came out, I waited for FreedomOS v2.0 to come out too. Once it did, I downloaded the ROM, OpenGApps, modified twrp .28 and started

the flashing process (I backed up my data first).

First, I flashed twrp .28 (had no problems booting into it), and clean flashed FOS v2.0. I selected “Yes” in “Pin/Pattern backup in data partition”, so I wouldn’t have issues with encryption. I selected the regular apps (for OOS to work properly) and installed the OS.

When it was done, I rebooted the device to the OS. I was confused with the new “dm-verity” message popping from nowhere, but the OS booted successfully.

When I rebooted to the twrp (to install OpenGApps), it asked for a password. I couldn’t enter the right password, because it wouldn’t accept any and it blocked

my access to my internal storage.

I started panicking, looking for answers, and I was afraid that I bricked my phone. However, after some research, I calmed down. I realized that my bootloader was still working and could roll back to OOS v3.2.8 (with stock recovery), which I did. From there I flashed FOS v1.7 and waited for more information about the new Nougat update for OnePlus 3.

Now, I’m using Stock OygenOS v4.0.3 with Stock Kernel (see FAQ #16) and so far, no issues (no dm-verity message or password upon entering modified twrp).

I tried to repeat the dm-verity issue and fixed it (see FAQ #6). I was so frustrated that no one posted a proper guide on how to fix these issues, or they were too advanced. I didn’t want to mess around with the core of the system too much. Therefore, I decided to post a simple-to-follow guide.

DISCLAIMER & IMPORTANT:

I am not responsible for any damages done by this guide. You are tinkering with your phone and held responsible for that. This is not an advanced guide. Therefore, I will refer you to the advanced guides when needed. Furthermore, this guide is based on the issues that I and other users encountered while

flashing OOS v4.x.x ------------>***BACK UP PERSONAL DATA BEFORE PROCEEDING ANY FURTHER***

This guide is intended for owners of OnePlus 3. But, after some poking in OnePlus 3T forums, you can use this guide. The only differences the OnePlus 3T

have are a newer processor, newer front camera and a different color from OnePlus 3. Make sure to use the appropriate tools (Stock recovery, TWRP,

OxygenOS v4.0.3, etc.) for OnePlus 3T. Again, I will not be responsible for any damages caused by this guide.

Please follow this guide to get rid of: dm-verity, encrypted twrp, encrypt or decrypt your device (as OnePlus 3 comes encrypted by default), change your file system from EXT4 to F2FS (vice versa as well). Also, flash a Marshmallow or Nougat Stock OOS (Stable or Beta versions), root them OR unroot your device, OR flash a custom ROM.

As far as I know, tested and read in forums, Android v6.0.1 (OxygenOS v3.x.x) supports only EXT4 file system, and Android v7.0 (OxygenOS v4.x.x) supports both EXT4 and F2FS file systems. However, F2FS is recommended for Android v7.0 (OxygenOS v4.x.x). When you perform, a full factory reset in OxygenOS v4.x.x, the file system changes from EXT4 to F2FS. ONLY “Data (userdata)” is affected by this. If you want to go back to Marshmallow, OxygenOS v3.x.x will change your file system from F2FS to EXT4 when you sideload it.

OxygenOS v4.0.3 still comes with some issues, bugs, and some rooting services are not fully supported yet (i.e. Xposed for Nougat). Luckily, OnePlus released kernel sources of Nougat, and we need to wait a little longer for Xposed and other rooting services to be supported. Therefore, I advise staying away from it,

for a little while, until those issues are fixed, and new ones don’t pop up. Also, until rooting apps are fully supported. Follow OnePlus community forums and

XDA forums for updates, troubleshooting, and solutions for your issues. MAKE SURE TO BACK UP YOUR PERSONAL DATA, time to time.

Before posting questions or issues or requests, check FAQ and posts in this thread. Thank You!

WHAT WILL YOU NEED?

You don't need to download everything in this section, only what you prefer to roll with.

ADB drivers installed on your computer (I have version 1.0.32 installed)

Unlocked bootloader (if you haven't done it yet, follow this guide: https://xdaforums.com/oneplus-3/how-to/oneplus-3-how-to-unlock-bootloader-t3398733)

DiskInfo app from the Play Store:

https://play.google.com/store/apps/details?id=me.kuder.diskinfo&hl=en

OxygenOS v3.2.8 OTA:

http://downloads.oneplus.net/oneplus-3/oneplus_3_oxygenos_3.2.8/

OxygenOS v4.0.3 OTA:

https://www.androidfilehost.com/?fid=457095661767136075 OR http://otafsc.h2os.com/patch/amazon...ygen_16_OTA_041_all_1702081756_0f1e56a75f.zip

*** Download speeds might be slow. Be patient. ***

OxygenOs Beta 11 (Nougat):

http://downloads.oneplus.net/oneplus-3/oneplus_3_oxygenos_openbeta_11/

Stock Recovery v2.0 (compatible with OOS v3.x.x and OOS v4.x.x):

http://oxygenos.oneplus.net.s3.amazonaws.com/recovery_op3.img

Official TWRP (v3.0.2-1 for OxygenOS v3.x.x ; v3.0.3-0 for OxygenOs v4.x.x):

https://twrp.me/devices/oneplusthree.html

Unreleased Official TWRP v3.0.4-1 for Nougat (OxygenOS v4.x.x): *** Recommended for Nougat ***

https://xdaforums.com/oneplus-3/development/recovery-official-twrp-oneplus-3-3t-t3543391

Unofficial TWRP (v3.0.3-0 for LineageOS v14.1):

https://xdaforums.com/oneplus-3/development/recovery-twrp-3-0-2-0-touch-recovery-t3402999

Modified TWRP v3.0.3-x blu_spark v16 from [MENTION=3873953]eng.stk[/MENTION]:

https://xdaforums.com/devdb/project/dl/?id=23082

SuperSu v2.79 (Stable):

https://xdaforums.com/apps/supersu/stable-2016-09-01supersu-v2-78-release-t3452703

OpenGApps (latest version):

http://opengapps.org/

Your desired custom ROM (I tested FreedomOS v1.7 and v2.3 and v2.4-CE, Experience ROM v10.1 [Stable and Beta 11], LineageOS v14.1):

https://xdaforums.com/oneplus-3/development/rom-freedomos-1-0-t3409348 (FreedomOS - Stable [v1.7 - OOS v3.2.8 ; v2.3 - OOS v4.0.2])

https://xdaforums.com/oneplus-3/development/rom-freedomos-ce-1-7-t3470660 (FreedomOS - Beta [v2.4-CE - OOS Beta 11])

https://xdaforums.com/oneplus-3/development/rom-experience-rom-v1-0-t3522259 (ExperienceOS - Stable and Beta 11 [v10.1])

https://xdaforums.com/oneplus-3/development/rom-cyanogenmod-14-1-oneplus-3-t3496850 (LineageOS v14.1 - based on Andriod v7.1.1)

[I][SIZE="4"][B] * I'LL BE USING OOS v4.0.3, OFFICIAL UNRELEASED TWRP v3.0.4-1 AND FreedomOS
v2.3 AS AN EXAMPLE FOR THIS GUIDE. OTHER VERSIONS OF OOS AND TWRP
(PROVIDED) ARE APPLICABLE TO BE USED IN THE GUIDE (ONLY WHAT I TESTED).
[COLOR="Red"][I] * If you don't have dm-verity issue, file system change issue or password
upon entering TWRP, then go to Section C (FLASHING YOUR CUSTOM ROM)
-OR- Section D (FLASHING AND ROOTING STOCK OOS OR UNROOT).
* If you do have dm-verity issue, file system change issue or password upon
entering TWRP, then continue to Section A (DM-VERITY).[/I][/COLOR]
[/B][/I][/SIZE]

A - PROCEDURE (DM-VERITY):

[I][SIZE="4"][CENTER][B]***** Check FAQ #5 before proceeding any further! *****[/B][/CENTER][/I][/SIZE]

Boot to bootloader by holding Volume Up and Power buttons.

Connect the phone to the computer via USB cable.

Go to your ADB folder (for me it is C:\Android\). Press “Shift” and click the right mouse button. Click on “Open command window here”.

In the console write “fastboot devices” to see if your computer recognizes your OnePlus 3.

When you could see that your device is recognized, write “fastboot flash recovery recovery_op3.img” to flash Stock Recovery of OxygenOS.

Disconnect the device, press volume up once, then press the power button once to turn off the phone.

Boot into recovery by holding Volume Down (-) and Power button down for a few of seconds.

Now, for some people, it will ask a password. If not, continue to #9 and ignore #8. If it asks you to enter a password to decrypt your data, choose “Forgot password” and let it erase all your data and let it reboot. (MAKE SURE YOU BACKED UP YOUR PERSONAL DATA BEFOREHAND). Most likely, it will reboot to the OS, so boot it to recovery again. Go to #10.

For those who doesn’t have to enter a password, press “English”. Press “Wipe data and cache” > “Erase everything (Music, pics, etc.)” > “This cannot be undone, continue?”. Moreover, let it wipe your data. Most likely, it will reboot to the OS, so boot it to recovery again. Go to #10.

[CENTER][I][SIZE="4"][B]AT THIS POINT IF YOU HAD DM-VERITY ERROR/ISSUE, IT SHOULD BE FIXED AND GONE.
IF IT STILL APPEARS, DON'T WORRY IT WILL BE GONE AFTER #12
IT CAME BACK TO ME ONE MORE TIME, BUT I GOT IT FIXED.

***** Check FAQ #6 for more information *****[/B][/I][/SIZE][/CENTER]

Select “English” > “Install from ADB” > “Ok”. Connect your phone to your computer. Go to your ADB folder (for me it is C:\Android\). Press “Shift” and click the right mouse button. Click on “Open command window here”.

In the console, write “adb devices” to see if your computer recognizes your OnePlus 3.

When you could see that your device is recognized, write “adb sideload OnePlus3Oxygen_16_OTA_041_all_1702081756_0f1e56a75f.zip”

to flash OxygenOS v4.0.3. (See FAQ #4 and #17 if you have issues)

Reboot and you have OxygenOS v4.0.3!

Sign-in into your Google account and Download the “DiskInfo” app from the Play Store. Launch it, and press “Data (userdata)”. You should see:

-	Encrypted: yes

-	Decrypted block device: /dev/block/dm-1

-	Mount point: /data

-	File system: f2fs

A. If you see that it is in F2FS file system format, proceed to Section C (FLASHING YOUR CUSTOM ROM) OR Section D (FLASHING AND ROOTING STOCK OOS OR UNROOT).

B. However, for some people (for some reason) it does not happen. You would see that your file system format (for userdata) is still on EXT4. Don’t be frustrated. A little bit more work needed to be done. Therefore, go to Section B (CHANGING FILE SYSTEM FORMAT AND ENCRYPTING OR DECRYPTING YOUR DEVICE). It will solve that problem.

[I][SIZE="4"]* Your phone needs to be encrypted by default. It comes like that from the
manufacturer. See the following links:
1. [url]https://forums.oneplus.net/threads/encrypted-oneplus-3.452572/page-2[/url]
2. [url]http://www.androidpolice.com/2015/10/19/android-6-0-will-finally-require-manufacturers-to-enable-full-disk-encryption-by-default-on-new-devices/[/url]
3. [url]http://arstechnica.com/gadgets/2015/10/android-6-0-re-implements-mandatory-device-encryption-for-new-devices/[/url]
4. [url]https://source.android.com/security/encryption/[/url]
5. [url]http://www.howtogeek.com/141953/how-to-encrypt-your-android-phone-and-why-you-might-want-to/[/url]
6. [url]http://www.extremetech.com/mobile/216560-android-6-0-marshmallow-makes-full-disk-encryption-mandatory-for-most-new-devices[/url]
[/I][/SIZE]

B - PROCEDURE (CHANGING FILE SYSTEM FORMAT AND ENCRYPTING OR DECRYPTING YOUR DEVICE):

Go to: Settings > Security & fingerprint > Encryption (located at the bottom). Make sure it says “Encrypt phone (Encrypted)”. To make sure

you will need to do a factory reset.

Now go to: Settings > Backup & reset > Factory data reset. In “Optional” select “Erase internal storage” and press “RESET PHONE”. Confirm by pressing “ERASE EVERYTHING”.

It will reboot to Stock Recovery and wipe your data. When it’s done, it will reboot to the OS.

Again, download the “DiskInfo” app from the Play Store. Launch it, press “Data (userdata)”. Now you should see (it wouldn’t show “Encrypted: yes” at all):

-	Mount point: /data

-	File system: f2fs

Now go to: Settings > Security & fingerprint > Encryption (located at the bottom). Make sure it says “Encrypt phone” and that you can press it. (DON’T ENCRYPT YOUR PHONE WITH THAT OPTION)

Now you successfully changed your file system to F2FS and decrypted your phone!

[I][SIZE="4"] * With Official TWRP v3.0.3-0 and modified TWRP v3.0.3-x v16 (from [MENTION=3873953]eng.stk[/MENTION])
you are able to use the phone in encrypted mode, password request at
boot up and with Stock or rooted OOS v4.0.3 (Also, I tested it myself).
* Therefore, I will ask you to encrypt the phone back again. Proceed with
the following instructions:

[CENTER]***** Check FAQ #9 for more information *****[/CENTER][/I][/SIZE]

Reboot to Stock recovery v2.0

Select “English” > “Install from ADB” > “Ok”. Connect your phone to your computer. Go to your ADB folder (for me it is C:\Android\). Press “Shift” and click the right mouse button. Click on “Open command window here”.

In the console, write “adb devices” to see if your computer recognizes your OnePlus 3.

When you could see that your device is recognized, write “adb sideload OnePlus3Oxygen_16_OTA_041_all_1702081756_0f1e56a75f.zip”

to flash Oxygen OS v4.0.3. (See FAQ #4 and #17 if you have issues)

Reboot your device. Now you back to being encrypted and “userdata” was changed successfully to F2FS file format on Stock Oxygen OS v4.0.3!

Go to Section C (FLASHING YOUR CUSTOM ROM) to properly flash your custom ROM. *** IT’S YOUR CHOICE ***

OR Go to Section D (FLASHING AND ROOTING STOCK OOS OR UNROOT) to remain in stock, root or unroot. *** IT’S YOUR CHOICE ***

C - PROCEDURE (FLASHING YOUR CUSTOM ROM):

Boot to bootloader by holding Volume Up and Power buttons.

Connect the phone to the computer via USB cable.

Go to your ADB folder (for me it is C:\Android\). Press “Shift” and click the right mouse button. Click on “Open command window here”.

In the console write “fastboot devices” to see if your computer recognizes your OnePlus 3.

When you could see that your device is recognized, write “fastboot flash recovery twrp-3.0.4-1-oneplus3.img” to flash Official Unreleased TWRP v3.0.4-1.

Disconnect the device, press volume up once, then press the power button once to turn off the phone.

Boot into the TWRP by holding Volume Down (-) and Power button down for a few of seconds.

It takes a little bit more time to boot to blu_spark’s, Official and Unofficial TWRPs. Be patient.

[I][SIZE="4"] * The “PASSWORD UPON ENTERING TWRP” should not be an issue any longer (only
if you followed the whole guide). It is caused by the TWRP being modified
(has an issue with encryption), not being officially released and fully
supported for the Nougat update. Versions “.28”, “.22” and “.19” are known
for that issue. Therefore, DO NOT USE THEM. If one of them works for
you, then use it at your own risk.

[CENTER]***** Check FAQ #9 for more information *****
[/CENTER][/I][/SIZE]

Press “Wipe” > “Advanced Wipe”, and select “Dalvik / ART Cache”, “System”, “Data” and “Cache”. Then swipe “Swipe to Wipe” for a clean flash.

After it’s done, go back to the main menu. Press “Install” and look for your desired custom ROM and press on the zip file to install it.

* I used FreedomOS v2.3 as an example and I didn't have any battery drain issues. (For more information, see FAQ #10)

D - PROCEDURE (FLASHING AND ROOTING STOCK OOS OR UNROOT):

[I][SIZE="4"][COLOR="Red"][I] * If you don't have dm-verity issue, file system change issue or password
upon entering TWRP, then go to #1.
* If you came from having dm-verity issue, file system change issue or
password upon entering TWRP (solved by using Procedure A and/or B),
then go to #12.
[/I][/COLOR][/I][/SIZE]

Boot to bootloader by holding Volume Up and Power buttons.

Connect the phone to the computer via USB cable.

Go to your ADB folder (for me it is C:\Android\). Press “Shift” and click the right mouse button. Click on “Open command window here”.

In the console write “fastboot devices” to see if your computer recognizes your OnePlus 3.

When you could see that your device is recognized, write “fastboot flash recovery recovery_op3.img” to flash Stock Recovery of OxygenOS.

Disconnect the device, press volume up once, then press the power button once to turn off the phone.

Boot into recovery by holding Volume Down (-) and Power button down for a few of seconds.

Select “English” > “Install from ADB” > “Ok”. Connect your phone to your computer. Go to your ADB folder (for me it is C:\Android\). Press “Shift” and click the right mouse button. Click on “Open command window here”.

In the console, write “adb devices” to see if your computer recognizes your OnePlus 3.

When you could see that your device is recognized, write “adb sideload OnePlus3Oxygen_16_OTA_041_all_1702081756_0f1e56a75f.zip”

to flash OxygenOS v4.0.3. (See FAQ #4 and #17 if you have issues)

Reboot and you have OxygenOS v4.0.3!

A.

UNROOT

- At this point, if you want to unroot and go back to completely stock, then use this guide: https://forums.oneplus.net/threads/guide-how-to-unroot-your-oneplus-3-and-go-back-completely-to-stock.456232/

*** Most of the procedures for unrooting you have already done. Only locking bootloader is left. Good Luck! (YOU CAN STOP HERE)

B.

ROOT

- Continue to #13

Boot to bootloader by holding Volume Up and Power buttons.

Connect the phone to the computer via USB cable.

Go to your ADB folder (for me it is C:\Android\). Press “Shift” and click the right mouse button. Click on “Open command window here”.

In the console write “fastboot devices” to see if your computer recognizes your OnePlus 3.

When you could see that your device is recognized, write “fastboot flash recovery twrp-3.0.4-1-oneplus3.img” to flash Official Unreleased TWRP v3.0.4-1.

Disconnect the device, press volume up once, then press the power button once to turn off the phone.

Boot into the TWRP by holding Volume Down (-) and Power button down for a few of seconds.

It takes a little bit more time to boot to blu_spark’s, Official and Unofficial TWRPs. Be patient.

Connect you OnePlus 3 to your computer and copy the SuperSU v2.79 (Stable) to your device.

Pick up your phone. From the main menu, press “Install” and look for the SuperSU v2.79 (Stable zip file). Press it to install the root and after it's done, reboot to the OS.

That's it! Everything should be working properly

(except the bugs and issues on OxygenOS Nougat update).

ENJOY!​

CREDITS:

[MENTION=5767887]NevaX1[/MENTION] --------------> For FreedomOS ROM

[MENTION=3068641]jamal2367[/MENTION] -----------> For ExperienceOS ROM

[MENTION=5376694]cpt.macp[/MENTION] ------------> For in depth dm-verity remover guide

[MENTION=6560166]Adithya R[/MENTION] -----------> For in depth file system formating from EXT4 to F2FS guide

[MENTION=3873953]eng.stk[/MENTION] --------------> For modified TWRP that supports F2FS file format

[MENTION=5285184]LELBOT[/MENTION] --------------> For in depth dm-verity remover and file system formating from EXT4 to F2FS guides

[MENTION=5641921]Naman Bhalla[/MENTION] ------> For in depth bootloader unlocking, flashing TWRP, rooting, nandroid backup guide

[MENTION=4463364]calvinistmac[/MENTION] --------> For providing an unroot for OnePlus 3 guide

[MENTION=7110443]Nishidh[/MENTION] --------------> For providing OxygenOS v4.0.3 and Beta 11 OTA download links

[MENTION=5672995]jcadduono[/MENTION] ----------> For providing Official TWRP

[MENTION=5091734]dianlujitao[/MENTION] ----------> For providing Unofficial TWRP and LineageOS 14.1 ROM

[MENTION=3878912]th3g1z[/MENTION] ---------------> For providing an easy solution for Dm-verity issue

--------------------------> OnePlus Community and XDA forums for providing with issues, solutions and requests