Disable [DM-Verity]/[Force Encryption] [OnePlus 3T/3] for [PIE] Oxygen OS

Search This thread

Xennet

Senior Member
Nov 21, 2016
735
2,263
Oneplus has released the PIE Oxygen OS for Oneplus 3T and 3.

This thread is only for OOS PIE. For disabling Dm-Verity and force Encryption in NOUGAT OOS ROMs refer to my thread here:https://forum.xda-developers.com/oneplus-3t/how-to/rom-dm-verity-force-encryption-disabled-t3618232 and for OREO OOS refer to my thread here:https://forum.xda-developers.com/oneplus-3t/how-to/disable-dm-verity-force-encryption-op3t-t3688748

Disclaimer: I am not responsible for any damage or data loss that happens to your device on embarking this procedure. This is a just released version of OOS and so expect the unexpected. Back up all your data and valuables before you go on and don't blame me if you or your device commits suicide..

THE DETAILS....
After a thororugh initial analysis of the PIE installation zip file for Oneplus 3/3T, I found that there has not been much hell of a difference in the protection schema related to Dm-verity and force encryption. Hence most of the procedure remains the same...As mentioned this is relatively new build and probably existing Twrp may need upstream fixes or other changes to accommodate PIE related commits before encrypting, decrypting and flashing...I have no intention of flashing the PIE build unless it gets stable and have a lot of time to spare so that if things get rough i can dive into it..So its untested from my side but its ought to work same as before. ..

So in a nut shell, to disable DM-Verity you will need to flash the patched Boot Images and to disable force encryption you will have to flash the force encryption disabler zip - The links of which are provided below. Do refer to the correct procedure explained in detail before attempting to do anything...

For all those who need an in-depth reading of the nature of patching the fstab in dtb file and my work you can refer here:
https://forum.xda-developers.com/showpost.php?p=74326761&postcount=3

THIS METHOD WILL WORK FOR BOTH ONEPLUS 3 T AND ONEPLUS 3...

FOR THOSE WHO HAVE ALREADY TRIGGERED DM-VERITY ON OOS PIE FOLLOW THE STEPS IN POST 2 IN THIS THREAD TO GET RID OF DM-VERITY BEFORE PROCEEDING...

Nothing has been changed....
It is 100% stock boot image except that the DM-Verity Flag has been patched...

Links:

For ONEPLUS 3T


STABLE OOS Boot Images



BETA OOS Boot Images




For OnePlus 3

STABLE OOS Boot Images




BETA OOS Boot Images




STEPS: This is applicable only to people who have their data currently ENCRYPTED and needs the procedure only for NOT TRIGGERING DM-VERITY
USAGE FOR STOCK OOS:
1. Flash the downloaded boot-patched.img file corresponding to the Model and OOS version in TWRP immediately after flashing the Stock ROM zip in TWRP before doing anything (even before restarting or applying any patches, root, kernels, etc.)
2. Restart back to TWRP Recovery.
3. Done.
4. Now do whatever you want like usual.. Flash root, kernel, mods or anything as usual
5. You dont have to worry about triggering DM-Verity again and any changes made to system via TWRP will not be reverted back..



The 2 Prodeures given below: This is applicable only to those people who needs the procedure for getting rid of FORCE ENCRYPTION AND PREVENT TRIGGERING DM-VERITY

PROCEDURE 1: This is applicable only to people who have their data currently NOT ENCRYPTED AND KEEP IT DECRYPTED
First of all Backup your data preferably to and usb otg or a PC for later restore. You may lose your data from your phone following this procedure...
1. Format SYSTEM, DALVIK, CACHE and then only Flash the Full Rom Pie OOS zip file in TWRP.
2. DON'T REBOOT
3. Flash the downloaded boot-patched.img file corresponding to the Model and OOS version in TWRP immediately after flashing the Stock ROM zip.
4. DON'T REBOOT TO SYSTEM
5. REBOOT TO TWRP.
6. In TWRP, MOUNT SYSTEM, GO TO ADVANCED > TERMINAL and Type "df system"(without quotes) and enter. The details of the system partition will be shown. Look at the Use% and Free Space. Make sure you have atleast 100MB free space in System before you go to the next step. If you don't have enough free space then mount system in TWRP, go to file manager and free some space in system by deleting some unwanted apps (in system/app folder like duo, google drive, hangouts,etc. which you can later reinstall via google play as it is not mandatory for them to run as system apps)...If there is low space on your system partition that fstab file flashing fails resulting in blank fstab file and you will end up in bootloop.
7. Once you have confirmed that you have atleast 100MB of free space left in system partition. REBOOT BACK TO TWRP.
8. Flash "Force Encryption Disabler For OOS Pie v1.zip" in TWRP.
9. Flash SuperSuSR5 / Magisk 18+
10. Done.
11. Reboot to System.

NB:f you have bootloop go back to TWRP by keep holding the power button to power off and powering on and rebooting to TWRP via the volume buttons, mount system, go to file manager and free some space in system by deleting some unwanted apps (in system/app folder like duo, google drive, hangouts,etc. which you can later reinstall via google play as it is not mandatory for them to run as system apps) and reflash the disabler zip and reboot..It is due to low space on your system partition that fstab file flashing fails resulting in blank fstab file. But if you followed Steps 6 and 7 carefully you wont end up here.


PROCEDURE 2: This is applicable only to people who have their data currently ENCRYPTED AND NEEDS TO GET IT DECRYPTED and PREVENT TRIGGERING DM-VERITY
First of all Backup your data preferably to and usb otg or a PC for later restore. You will lose your data from your phone following this procedure...
1. Go to Bootloader...
2. Connect to your PC..Type "fastboot format userdata" without quotes and press enter. (You will lose your data, do back up if you need something.)
3. Don't reboot to system...Using volume buttons select boot to recovery and Reboot to TWRP.....(Very Important)
4. Flash the downloaded boot-patched.img file corresponding to the Model and OOS version in TWRP immediately after flashing the Stock ROM zip.
5. DON'T REBOOT TO SYSTEM
6. REBOOT TO TWRP
7. In TWRP, MOUNT SYSTEM, GO TO ADVANCED > TERMINAL and Type "df system"(without quotes) and enter. The details of the system partition will be shown. Look at the Use% and Free Space. Make sure you have atleast 100MB free space in System before you go to the next step. If you don't have enough free space then mount system in TWRP, go to file manager and free some space in system by deleting some unwanted apps (in system/app folder like duo, google drive, hangouts,etc. which you can later reinstall via google play as it is not mandatory for them to run as system apps)...If there is low space on your system partition that fstab file flashing fails resulting in blank fstab file and you will end up in bootloop.
8. Once you have confirmed that you have atleast 100MB of free space left in system partition. REBOOT BACK TO TWRP.
9. Flash "Force Encryption Disabler For OOS Pie v1.zip" in TWRP.
10. Flash SuperSuSR5 / Magisk 18+
11. Done.
12. Reboot to System.

NB: If you have bootloop go back to TWRP by keep holding the power button to power off and powering on and rebooting to TWRP via the volume buttons, mount system, go to file manager and free some space in system by deleting some unwanted apps (in system/app folder like duo, google drive, hangouts,etc. which you can later reinstall via google play as it is not mandatory for them to run as system apps) and reflash the disabler zip and reboot..It is due to low space on your system partition that fstab file flashing fails resulting in blank fstab file. But if you followed Steps 7 and 8 carefully you won't end up here.


Rooting:
For Rooting use only SuperSu 2.82 SR5 or Magisk 18 or above seems to work for root...


FAQs:

Q: Is the boot.img file altered in anyway?
A: As mentioned above its 100% stock boot image except that the DM-Verity Flag has been patched in the device tree blobs (dtb)...

Q: My phone is already encrypted, will I lose encryption on flashing the zip?
A: No. It only disables force encryption. That means if you have already disabled encryption in your phone it will prevent the phone from getting encrypted when you flash a stock OOS ROM..

Q: I happen to lose TWRP and revert to stock recovery every time I update OOS, I happen to lose changes made to system via TWRP or lose data/apps accidentally while updating OOS...Can this be corrected by using this method?
A: Definitely. Follow the steps correctly. Each time while updating the OOS, after flashing the Full OOS ROM.zip, immediately flash the patched boot.img of the corresponding OOS given in this thread and then restart back to TWRP recovery. Done. You will never lose TWRP again..

Q: I am Rooting my phone using Magisk/Supersu then why do i need this?
A: Its optional.. If you are rooting phone using Magisk/Supersu it patches the stock boot.img. But in case you have problems flashing Magisk/Supersu after flashing the STOCK ROM zip this can come in handy or as an insurance policy just flash this patched boot.img before doing anything. But is very helpful to those people out there who doesn't root their phone but has unlocked their phone or installed TWRP for other purposes..

Q: How to flash the patched boot.img in TWRP?
A: Default flash option is for zip files in TWRP. Select the flash image option in TWRP. Then select the downloaded patched boot.img file and among from the partition option (boot, recovery and system) select the boot option and then flash it.

Q: What is "-Xn" seen after the OOS Version in the settings menu?
A: That's just my signature -Xn that I had put there to make sure that you have correctly done the procedure and the boot image that is currently in use is my patched boot image and to ensure you that you are 100% safe from DM verity...

Q: Where to find downloads and queries regarding the Stock OOS ROM and Beta OOS?
A: @Siddk007 has been maintaining Stock and Beta OOS threads were you can find relevant information.


Hope you find it useful...
Will update this OP as newer OOS versions come....



HIT THANKS IF I HELPED YOU. IT DOESN'T COST YOU ANYTHING, BUT IT MEANS A LOT TO ME...

AND IF YOU DO APPRECIATE MY WORK DONATIONS ARE ALWAYS WELCOME...
 

Attachments

  • Force_Encryption_Disabler_For_OOS_Pie_v1.zip
    127 KB · Views: 4,493
Last edited:

Xennet

Senior Member
Nov 21, 2016
735
2,263
THIS IS FOR PEOPLE WHO HAVE TRIGGERED DM-VERITY AND NEEDS TO GET RID OF THE DM-VERITY MESSAGE PERMANENTLY ON OOS PIE ROMs. ...

THIS IS FOR ONEPLUS 3T AND FOR ONEPLUS 3 but be careful in using the correct files corresponding to the OOS version and your MODEL

READ ALL THE STEPS AND DOWNLOAD ALL REQUIRED FILES BEFORE PROCEEDING. FOLLOW THE STEPS EXACTLY AND 100% THE DM-VERITY MESSAGE WILL BE GONE WITHOUT ANY DATA LOSS OR ANY OTHER HARM!!!


Prerequisite : Install ADB for windows from here: [url]https://forum.xda-developers.com/showthread.php?t=2588979[/URL]

1)
2) Flash the downloaded 4.0.2 firmware OnePlus 3.zip or 4.0.2 firmware OnePlus 3T.zip file in TWRP.
3) DONT REBOOT TO SYSTEM. REBOOT TO BOOTLOADER FROM OPTION IN TWRP.
4) Connect your phone to the pc
5) Press windows button + X
6) Open Command prompt
7) Type "fastboot oem disable_dm_verity" without quotes and press enter
8) Type "fastboot oem enable_dm_verity" without quotes and press enter
9) DONT REBOOT TO SYSTEM. REBOOT TO TWRP RECOVERY.
10) 11) DONT REBOOT!!!!
12) VERY IMPORTANT: WITHOUT REBOOTING, Flash the downloaded boot-patched.img file corresponding to the OOS version and phone model(either stable or beta) in TWRP from post 1...

13) Reboot..The DM-verity message is gone forever...

VERY IMPORTANT:
1. If you need to keep your phone un-encrypted flash Force Encryption Disabler For OOS PIE.zip immediately after step 12 and then only reboot.
2.If you are attempting this method on a a CUSTOM ROM then after Step 12 flash the full CUSTOM ROM zip file + latest gapps again without doing any sort of wipes in TWRP immediately and then only reboot....


Enjoy!!!


FAQs...

Q: Will I lose any data after I do these steps?
A: Never. There will be no data loss or any untoward effects of the procedure. Your data and phone will be in the exact same state as it was a before except for the fact that the damn dirty Dm-Verity message will be gone forever!!!

Q: Will this work on CUSTOM ROMs?
A: Of course. It has been tested to be perfectly working on even CUSTOM ROMs. Just follow the instructions in this post carefully where specific steps for CUSTOM ROMs are mentioned.


HIT THANKS IF I HELPED YOU. IT DOESN'T COST YOU ANYTHING, BUT IT MEANS A LOT TO ME...
 
Last edited:
Thanks for your work! :cowboy:

I have a question. Is there anyway to prevent OOS Pie Community Build from corrupting the /data partition on Unlocked Bootloaders with Encrypted /data partition? They specifically designed the builds to do so. It doesn't cause it if the device is locked. Can the boot image be patched for that too?

Sent from my #FlagshipKiller3T using Tapatalk
 

Xennet

Senior Member
Nov 21, 2016
735
2,263
Thanks for your work! :cowboy:

I have a question. Is there anyway to prevent OOS Pie Community Build from corrupting the /data partition on Unlocked Bootloaders with Encrypted /data partition? They specifically designed the builds to do so. It doesn't cause it if the device is locked. Can the boot image be patched for that too?

That is the duty of twrp (recovery) I suppose because with stock recovery it doesn't seem to happen and it probably doesn't have anything to do with boot image as such...but u can very well try with the patched boot image..either u can flash the patched boot image immediately after flashing the zip file and try rebooting back to twrp and see

Or replace the boot image in the OOS zip file with mine and try flashing...but no guarantees buddy...

ALWAYS BACKUP BEFORE DOING ANYTHING...THIS IS A NEW OS ANS WE ARE STILL LEARNING...
 
That is the duty of twrp (recovery) I suppose because with stock recovery it doesn't seem to happen and it probably doesn't have anything to do with boot image as such...but u can very well try with the patched boot image..either u can flash the patched boot image immediately after flashing the zip file and try rebooting back to twrp and see

Or replace the boot image in the OOS zip file with mine and try flashing...but no guarantees buddy...

ALWAYS BACKUP BEFORE DOING ANYTHING...THIS IS A NEW OS ANS WE ARE STILL LEARNING...
Alright thanks! :)

Let's see if anyone tries it out [emoji14]
I'm not in the urge of risking getting my /data wiped as of now ;)

Sent from my #FlagshipKiller3T using Tapatalk
 

a0879

Senior Member
Apr 29, 2016
124
61
Nagpur, MS
Screenshot_20190418-160116.jpgthanks @Xennet ...:good::)
I followed all the steps from procedure 1 ( PROCEDURE 1: This is applicable only to people who have their data currently NOT ENCRYPTED AND KEEP IT DECRYPTED ) and for everyone out there who are confused or fear of loosing data , I successfully booted OOS Pie beta/community build without loosing any of my data/internal storage (everything regarding data is intact).
 

Attachments

  • Screenshot_20190418-153916.jpg
    Screenshot_20190418-153916.jpg
    178.1 KB · Views: 624
  • Screenshot_20190418-153936.jpg
    Screenshot_20190418-153936.jpg
    113.2 KB · Views: 616
  • Screenshot_20190418-153958.jpg
    Screenshot_20190418-153958.jpg
    113.5 KB · Views: 614
Last edited:
  • Like
Reactions: Xennet and Rammit

Yudh

Senior Member
Dec 19, 2015
993
484
Mumbai
Alright thanks! :)

Let's see if anyone tries it out [emoji14]
I'm not in the urge of risking getting my /data wiped as of now ;)

Sent from my #FlagshipKiller3T using Tapatalk

Don't try because if your data is encrypted and you follow the old steps with pie files for just not triggering dm-verity

Twrp cannot decrypt the data if you reboot after flashing oos community beta and then immediately patched boot image for pie


Luckily i saved myself (from loosing data) by not booting into system and again dirty flashing stable oreo rom using the guide for oreo and patched oreo boot image.


I had to dirty flash OREO Rom patched boot image and magisk all using OTG since i couldn't access data partition.
 

Xennet

Senior Member
Nov 21, 2016
735
2,263
thanks @Xennet ...:good::)
I followed all the steps from procedure 1 ( PROCEDURE 1: This is applicable only to people who have their data currently NOT ENCRYPTED AND KEEP IT DECRYPTED ) and for everyone out there who are confused or fear of loosing data , I successfully booted OOS Pie beta/community build without loosing any of my data/internal storage (everything regarding data is intact).


Did u have your bootloader unlocked and on what OOS were u on, before u upgraded...
 

Xennet

Senior Member
Nov 21, 2016
735
2,263
Don't try because if your data is encrypted and you follow the old steps with pie files for just not triggering dm-verity

Twrp cannot decrypt the data if you reboot after flashing oos community beta and then immediately patched boot image for pie


Luckily i saved myself (from loosing data) by not booting into system and again dirty flashing stable oreo rom using the guide for oreo and patched oreo boot image.


I had to dirty flash OREO Rom patched boot image and magisk all using OTG since i couldn't access data partition.


That's in line....
Hmmmmmm it's a Twrp problem...the problem is with decryption of pie data by twrp...as stated earlier by @a0879, the patched boot image works perfectly with already decrypted data partitions without losing data...

But @Yudh, the patched boot image did it's work by not letting twrp being overwritten by the stock recovery or else you would have been in trouble...
 
Last edited:
  • Like
Reactions: Yudh

a0879

Senior Member
Apr 29, 2016
124
61
Nagpur, MS
Did u have your bootloader unlocked and on what OOS were u on, before u upgraded...

Yes, my bootloader is unlocked from time immemorial and i was on havoc 2.4, twrp 3.2.3-10, magisk v18.1 just before flashing oos pie beta today.
Earlier i tried the leaked version and the one3tos also a few days back which ultimately wiped whole of my data/internal (though i backed it on pc) and replaced it with the stock recovery, i was unable to do anything other than just using it as it was but then also my bootloader was unlocked.
So i was searching for how to use pie by remaining non encrypted and not formatting internal storage and saving then Finally after going through your post i decided to follow each and every step as told, and "B A N G" !!:) , it worked as told by you !
thanks again..:good:
 
  • Like
Reactions: Xennet

Yudh

Senior Member
Dec 19, 2015
993
484
Mumbai
Did u have your bootloader unlocked and on what OOS were u on, before u upgraded...

I had my bootloader unlocked.
I was on oos 5.0.8 latest stable build.

Also i discovered a workaround.

Steps below to keep your app data, unlocked bootloader and update to pie.

1)First upgrade the twrp to latest 3.3.0-1
2)remove any kind of lock in the system.

{otherwise it creates issues at the last point by not allowing us to enter the phone past lock screen.
[ If forgot to do so like me Workaround(perform after step 14 only) is to reboot to twrp and deleting the file located at /data/system/locksettings.db using twrp file manager (trick picked from OnePlus official rooting guide).
Then reboot into system and create the same locking method to retain fingerprints and facelock]
But for some people it would be better to remove locks in the first place from system before taking a full backup using twrp because you can always forget which file needs to be deleted or bymistakely if wrong file is deleted then it will cause issues}


3) reboot to twrp and take a COMPLETE BACKUP IN AN EXTERNAL DEVICE . Internal backup won't help.
It would be better if you don't compress it.(in rare cases it led me to corrupted backup in the past with previous twrp versions)

4)after taking backup don't go out of twrp and using MTP
Copy the whole internal storage to pc .

Bellow part isn't necessary but it would be better if you do it.
Also check the twrp backups digest for each created partition just to be on safer side.( It's better to be safe than sorry.)
So that you can make sure that your backup isn't corrupted.

5) download the community pie beta build and patched boot image for pie on the external storage like an otg (which i used).

Sha256 for OnePlus 3T beta build is

837d0f972ce7a10e422ddbf4d96d37cf3d84422ee5717c37a0ee5c3e1419d3c0

Also sha256 for OnePlus 3T patched boot image is
e2619b029e2f14f8cbe3c3b9306181e6688f038f39e8fcd4d5dea823360dcce0

6)wipe everything in twrp using format data option.

7) reboot to recovery again immediately using twrp otherwise twrp won't be able to access data partition afterwards.

8)flash the community beta build and immediately after that the patched pie boot image.

9) reboot to twrp again

10)flash magisk if you want.

11) reboot to system. After the system is started don't enter anything.
Instead again reboot to twrp.

12)while in twrp connect the mobile to pc and delete all the new folders and files in new internal storage.
After that copy the old internal storage contents to your mobile.

Just wait even i was exhausted. But it worked out well.

13)after that restore only the data partition from the nandroid backup which you made using twrp in the start of this guide

14) reboot to system and your data is still there in your mobile with pie community beta build and also unlocked bootloader
 
Last edited:

Yudh

Senior Member
Dec 19, 2015
993
484
Mumbai
Proof that i succeeded

Now its time for me to enjoy my pie and go to sleep.

For you it's time to prepare your own pie
 

Attachments

  • Screenshot_20190419-020118.jpg
    Screenshot_20190419-020118.jpg
    113 KB · Views: 353

Yudh

Senior Member
Dec 19, 2015
993
484
Mumbai
That's in line....
Hmmmmmm it's a Twrp problem...the problem is with decryption of pie data by twrp...as stated earlier by @a0879, the patched boot image works perfectly with already decrypted data partitions without losing data...

But @Yudh, the patched boot image did it's work by not letting twrp being overwritten by the stock recovery or else you would have been in trouble...

The problem isn't with twrp i think because
After rebooting to recovery after flashing the pie beta and patched boot image
Even the system couldn't access the data partition it asked me to reset my phone by saying the data partition is corrupted (which in reality wasn't because i was able to recover the data)
So after i formatted it via twrp and rebooted again into twrp
Both the system and twrp were able to decrypt it.

I think something about encryption is changed in pie in oos
 

xarrismoto

Senior Member
Jul 13, 2015
218
116
I successfully flash the open beta pie following the op's instruction.! Decrypted with no dm-verity message! Thank you Xennet!
I was on Aosip before and I didn't loose my data!
 

Attachments

  • Screenshot_20190419-091229.jpg
    Screenshot_20190419-091229.jpg
    240.4 KB · Views: 238
  • Screenshot_20190419-091229.jpg
    Screenshot_20190419-091229.jpg
    240.4 KB · Views: 240
Last edited:
  • Like
Reactions: Xennet

Xennet

Senior Member
Nov 21, 2016
735
2,263
As @a0879 and @xarrismoto have provided proof it's 100% clear that the patched boot image and force encryption disabler zip is able to update Oreo to pie without losing data if the phone is in DECRYPTED STATE ...

Now the problem is for encrypted phones...
Now as @Yudh mentioned it is definitely due to a change in the encryption in pie the data wipe is happening..that's sure..
But the question is if you have a locked bootloader and stock recovery, you are able to update from Oreo to pie without lose of data??...but with twrp you can't....
So the question is, whether the problem of encryption is not handled by twrp or by the system in pie itself....
 
Last edited:
  • Like
Reactions: xarrismoto

MirzaAwais

Senior Member
Feb 20, 2014
1,028
769
I successfully flash the open beta pie following the op's instruction.! Decrypted with no dm-verity message! Thank you Xennet!
I was on Aosip before and I didn't loose my data!
Can you please elaborate a bit more and it will be most helpful post of the day. As i was on closed beta and lost my data on flashing closed beta however afterwards i flashed custom roms and now my device is encrypted and locked bootloader having TWRP running Colt PIE OS. If i flashed decryption zip and modified boot then my data will be wiped or not? If not then please share your steps. Thanks

Sent from my ONEPLUS A3003 using Tapatalk
 
Last edited:

xarrismoto

Senior Member
Jul 13, 2015
218
116
Can you please elaborate a bit more as its most helpful post of the day. As i was on closed beta and lost my data on flashing closed beta however afterwards i flashed custom roms and now my device is encrypted and locked bootloader having TWRP running Colt PIE OS. If i flashed decryption zip and modified boot then my data will be wiped or not? If not then please share your steps. Thanks
I don't think it will work for you as you are encrypted!
I was decrypted before and I stay decrypted after I flash Pie rom. I use latest TWRP 3.3.0.1 and magisk v19.0,also my bootloader is unlock
I followed the instruction from Op which is PROCEDURE 1: This is applicable only to people who have their data currently NOT ENCRYPTED AND KEEP IT DECRYPTED


Sent from my OnePlus 3T using XDA Labs
 

Top Liked Posts

  • There are no posts matching your filters.
  • 39
    Oneplus has released the PIE Oxygen OS for Oneplus 3T and 3.

    This thread is only for OOS PIE. For disabling Dm-Verity and force Encryption in NOUGAT OOS ROMs refer to my thread here:https://forum.xda-developers.com/oneplus-3t/how-to/rom-dm-verity-force-encryption-disabled-t3618232 and for OREO OOS refer to my thread here:https://forum.xda-developers.com/oneplus-3t/how-to/disable-dm-verity-force-encryption-op3t-t3688748

    Disclaimer: I am not responsible for any damage or data loss that happens to your device on embarking this procedure. This is a just released version of OOS and so expect the unexpected. Back up all your data and valuables before you go on and don't blame me if you or your device commits suicide..

    THE DETAILS....
    After a thororugh initial analysis of the PIE installation zip file for Oneplus 3/3T, I found that there has not been much hell of a difference in the protection schema related to Dm-verity and force encryption. Hence most of the procedure remains the same...As mentioned this is relatively new build and probably existing Twrp may need upstream fixes or other changes to accommodate PIE related commits before encrypting, decrypting and flashing...I have no intention of flashing the PIE build unless it gets stable and have a lot of time to spare so that if things get rough i can dive into it..So its untested from my side but its ought to work same as before. ..

    So in a nut shell, to disable DM-Verity you will need to flash the patched Boot Images and to disable force encryption you will have to flash the force encryption disabler zip - The links of which are provided below. Do refer to the correct procedure explained in detail before attempting to do anything...

    For all those who need an in-depth reading of the nature of patching the fstab in dtb file and my work you can refer here:
    https://forum.xda-developers.com/showpost.php?p=74326761&postcount=3

    THIS METHOD WILL WORK FOR BOTH ONEPLUS 3 T AND ONEPLUS 3...

    FOR THOSE WHO HAVE ALREADY TRIGGERED DM-VERITY ON OOS PIE FOLLOW THE STEPS IN POST 2 IN THIS THREAD TO GET RID OF DM-VERITY BEFORE PROCEEDING...

    Nothing has been changed....
    It is 100% stock boot image except that the DM-Verity Flag has been patched...

    Links:

    For ONEPLUS 3T


    STABLE OOS Boot Images



    BETA OOS Boot Images




    For OnePlus 3

    STABLE OOS Boot Images




    BETA OOS Boot Images




    STEPS: This is applicable only to people who have their data currently ENCRYPTED and needs the procedure only for NOT TRIGGERING DM-VERITY
    USAGE FOR STOCK OOS:
    1. Flash the downloaded boot-patched.img file corresponding to the Model and OOS version in TWRP immediately after flashing the Stock ROM zip in TWRP before doing anything (even before restarting or applying any patches, root, kernels, etc.)
    2. Restart back to TWRP Recovery.
    3. Done.
    4. Now do whatever you want like usual.. Flash root, kernel, mods or anything as usual
    5. You dont have to worry about triggering DM-Verity again and any changes made to system via TWRP will not be reverted back..



    The 2 Prodeures given below: This is applicable only to those people who needs the procedure for getting rid of FORCE ENCRYPTION AND PREVENT TRIGGERING DM-VERITY

    PROCEDURE 1: This is applicable only to people who have their data currently NOT ENCRYPTED AND KEEP IT DECRYPTED
    First of all Backup your data preferably to and usb otg or a PC for later restore. You may lose your data from your phone following this procedure...
    1. Format SYSTEM, DALVIK, CACHE and then only Flash the Full Rom Pie OOS zip file in TWRP.
    2. DON'T REBOOT
    3. Flash the downloaded boot-patched.img file corresponding to the Model and OOS version in TWRP immediately after flashing the Stock ROM zip.
    4. DON'T REBOOT TO SYSTEM
    5. REBOOT TO TWRP.
    6. In TWRP, MOUNT SYSTEM, GO TO ADVANCED > TERMINAL and Type "df system"(without quotes) and enter. The details of the system partition will be shown. Look at the Use% and Free Space. Make sure you have atleast 100MB free space in System before you go to the next step. If you don't have enough free space then mount system in TWRP, go to file manager and free some space in system by deleting some unwanted apps (in system/app folder like duo, google drive, hangouts,etc. which you can later reinstall via google play as it is not mandatory for them to run as system apps)...If there is low space on your system partition that fstab file flashing fails resulting in blank fstab file and you will end up in bootloop.
    7. Once you have confirmed that you have atleast 100MB of free space left in system partition. REBOOT BACK TO TWRP.
    8. Flash "Force Encryption Disabler For OOS Pie v1.zip" in TWRP.
    9. Flash SuperSuSR5 / Magisk 18+
    10. Done.
    11. Reboot to System.

    NB:f you have bootloop go back to TWRP by keep holding the power button to power off and powering on and rebooting to TWRP via the volume buttons, mount system, go to file manager and free some space in system by deleting some unwanted apps (in system/app folder like duo, google drive, hangouts,etc. which you can later reinstall via google play as it is not mandatory for them to run as system apps) and reflash the disabler zip and reboot..It is due to low space on your system partition that fstab file flashing fails resulting in blank fstab file. But if you followed Steps 6 and 7 carefully you wont end up here.


    PROCEDURE 2: This is applicable only to people who have their data currently ENCRYPTED AND NEEDS TO GET IT DECRYPTED and PREVENT TRIGGERING DM-VERITY
    First of all Backup your data preferably to and usb otg or a PC for later restore. You will lose your data from your phone following this procedure...
    1. Go to Bootloader...
    2. Connect to your PC..Type "fastboot format userdata" without quotes and press enter. (You will lose your data, do back up if you need something.)
    3. Don't reboot to system...Using volume buttons select boot to recovery and Reboot to TWRP.....(Very Important)
    4. Flash the downloaded boot-patched.img file corresponding to the Model and OOS version in TWRP immediately after flashing the Stock ROM zip.
    5. DON'T REBOOT TO SYSTEM
    6. REBOOT TO TWRP
    7. In TWRP, MOUNT SYSTEM, GO TO ADVANCED > TERMINAL and Type "df system"(without quotes) and enter. The details of the system partition will be shown. Look at the Use% and Free Space. Make sure you have atleast 100MB free space in System before you go to the next step. If you don't have enough free space then mount system in TWRP, go to file manager and free some space in system by deleting some unwanted apps (in system/app folder like duo, google drive, hangouts,etc. which you can later reinstall via google play as it is not mandatory for them to run as system apps)...If there is low space on your system partition that fstab file flashing fails resulting in blank fstab file and you will end up in bootloop.
    8. Once you have confirmed that you have atleast 100MB of free space left in system partition. REBOOT BACK TO TWRP.
    9. Flash "Force Encryption Disabler For OOS Pie v1.zip" in TWRP.
    10. Flash SuperSuSR5 / Magisk 18+
    11. Done.
    12. Reboot to System.

    NB: If you have bootloop go back to TWRP by keep holding the power button to power off and powering on and rebooting to TWRP via the volume buttons, mount system, go to file manager and free some space in system by deleting some unwanted apps (in system/app folder like duo, google drive, hangouts,etc. which you can later reinstall via google play as it is not mandatory for them to run as system apps) and reflash the disabler zip and reboot..It is due to low space on your system partition that fstab file flashing fails resulting in blank fstab file. But if you followed Steps 7 and 8 carefully you won't end up here.


    Rooting:
    For Rooting use only SuperSu 2.82 SR5 or Magisk 18 or above seems to work for root...


    FAQs:

    Q: Is the boot.img file altered in anyway?
    A: As mentioned above its 100% stock boot image except that the DM-Verity Flag has been patched in the device tree blobs (dtb)...

    Q: My phone is already encrypted, will I lose encryption on flashing the zip?
    A: No. It only disables force encryption. That means if you have already disabled encryption in your phone it will prevent the phone from getting encrypted when you flash a stock OOS ROM..

    Q: I happen to lose TWRP and revert to stock recovery every time I update OOS, I happen to lose changes made to system via TWRP or lose data/apps accidentally while updating OOS...Can this be corrected by using this method?
    A: Definitely. Follow the steps correctly. Each time while updating the OOS, after flashing the Full OOS ROM.zip, immediately flash the patched boot.img of the corresponding OOS given in this thread and then restart back to TWRP recovery. Done. You will never lose TWRP again..

    Q: I am Rooting my phone using Magisk/Supersu then why do i need this?
    A: Its optional.. If you are rooting phone using Magisk/Supersu it patches the stock boot.img. But in case you have problems flashing Magisk/Supersu after flashing the STOCK ROM zip this can come in handy or as an insurance policy just flash this patched boot.img before doing anything. But is very helpful to those people out there who doesn't root their phone but has unlocked their phone or installed TWRP for other purposes..

    Q: How to flash the patched boot.img in TWRP?
    A: Default flash option is for zip files in TWRP. Select the flash image option in TWRP. Then select the downloaded patched boot.img file and among from the partition option (boot, recovery and system) select the boot option and then flash it.

    Q: What is "-Xn" seen after the OOS Version in the settings menu?
    A: That's just my signature -Xn that I had put there to make sure that you have correctly done the procedure and the boot image that is currently in use is my patched boot image and to ensure you that you are 100% safe from DM verity...

    Q: Where to find downloads and queries regarding the Stock OOS ROM and Beta OOS?
    A: @Siddk007 has been maintaining Stock and Beta OOS threads were you can find relevant information.


    Hope you find it useful...
    Will update this OP as newer OOS versions come....



    HIT THANKS IF I HELPED YOU. IT DOESN'T COST YOU ANYTHING, BUT IT MEANS A LOT TO ME...

    AND IF YOU DO APPRECIATE MY WORK DONATIONS ARE ALWAYS WELCOME...
    22
    Update....
    Don't know what's in this update for OnePlus3T/3 other than a security update.

    Here are the download links to the patched boot images for Stable OOS 9.0.4 for OnePlus 3T and 3...

    Oneplus 3T --> Download (md5 - 764CBF251B54A4B9604EF2DE3A837989)
    Oneplus 3 --> Download (md5 - DB675369D8EABA523C38A1BEB1E7A0B5)


    Force_Encryption_Disabler_For_OOS_Pie_v1.zip will work well these stable updates too...


    OP Updated Accordingly...

    Ok Guys...

    Happy Flashing....

    NB: If you like my work Donations are always welcome....
    21
    So Xdiians...

    Probably the final update from Oneplus for 3/3T...


    Here are the download links to the patched boot images for Stable OOS 9.0.2 for OnePlus 3T / 3....

    Oneplus 3T --> Download (md5 - 0E5355450E8DCE89E0740C1A37104177)

    Oneplus 3 --> Download (md5 -
    de5ee4c7b1abb0d7ef8325b050f73080)

    Force_Encryption_Disabler_For_OOS_Pie_v1.zip will work well these stable updates too...


    OP Updated Accordingly...


    Ok Guys...

    Happy Flashing....

    NB: If you like my work Donations are always welcome....
    19
    THIS IS FOR PEOPLE WHO HAVE TRIGGERED DM-VERITY AND NEEDS TO GET RID OF THE DM-VERITY MESSAGE PERMANENTLY ON OOS PIE ROMs. ...

    THIS IS FOR ONEPLUS 3T AND FOR ONEPLUS 3 but be careful in using the correct files corresponding to the OOS version and your MODEL

    READ ALL THE STEPS AND DOWNLOAD ALL REQUIRED FILES BEFORE PROCEEDING. FOLLOW THE STEPS EXACTLY AND 100% THE DM-VERITY MESSAGE WILL BE GONE WITHOUT ANY DATA LOSS OR ANY OTHER HARM!!!


    Prerequisite : Install ADB for windows from here: [url]https://forum.xda-developers.com/showthread.php?t=2588979[/URL]

    1)
    2) Flash the downloaded 4.0.2 firmware OnePlus 3.zip or 4.0.2 firmware OnePlus 3T.zip file in TWRP.
    3) DONT REBOOT TO SYSTEM. REBOOT TO BOOTLOADER FROM OPTION IN TWRP.
    4) Connect your phone to the pc
    5) Press windows button + X
    6) Open Command prompt
    7) Type "fastboot oem disable_dm_verity" without quotes and press enter
    8) Type "fastboot oem enable_dm_verity" without quotes and press enter
    9) DONT REBOOT TO SYSTEM. REBOOT TO TWRP RECOVERY.
    10) 11) DONT REBOOT!!!!
    12) VERY IMPORTANT: WITHOUT REBOOTING, Flash the downloaded boot-patched.img file corresponding to the OOS version and phone model(either stable or beta) in TWRP from post 1...

    13) Reboot..The DM-verity message is gone forever...

    VERY IMPORTANT:
    1. If you need to keep your phone un-encrypted flash Force Encryption Disabler For OOS PIE.zip immediately after step 12 and then only reboot.
    2.If you are attempting this method on a a CUSTOM ROM then after Step 12 flash the full CUSTOM ROM zip file + latest gapps again without doing any sort of wipes in TWRP immediately and then only reboot....


    Enjoy!!!


    FAQs...

    Q: Will I lose any data after I do these steps?
    A: Never. There will be no data loss or any untoward effects of the procedure. Your data and phone will be in the exact same state as it was a before except for the fact that the damn dirty Dm-Verity message will be gone forever!!!

    Q: Will this work on CUSTOM ROMs?
    A: Of course. It has been tested to be perfectly working on even CUSTOM ROMs. Just follow the instructions in this post carefully where specific steps for CUSTOM ROMs are mentioned.


    HIT THANKS IF I HELPED YOU. IT DOESN'T COST YOU ANYTHING, BUT IT MEANS A LOT TO ME...
    15
    So Xdiians...

    This was a surprise release from OnePlus. Still vague about the features in the update other than the security patch update. So thought it prudent to wait for atleat 24 hours before I do my work to release the patched boot images, as (it has happened before) the update may be pulled off. So far so good...

    So.....

    Here are the download links to the patched boot images for Stable OOS 9.0.5 for OnePlus 3T / 3....

    Oneplus 3T --> Download (md5 - FDE28B3CD09EE1B81EB062126613A09C)

    Oneplus 3 --> Download (md5 - 82CDC70832076020B69520704AC9BC02)


    Force_Encryption_Disabler_For_OOS_Pie_v1.zip will work well these stable updates too...


    OP Updated Accordingly...


    Ok Guys...

    Happy Flashing....

    NB: If you like my work Donations are always welcome....