yashsingh1/xdaforums huggingface dataset:
[OnePlus 5T  Guides, News, & Discussion] Dazed No More:
Flashing Oreo beta is the only way to get it back as myself and others have found in the thread that was started on the subject. I hadn't seen that initially when I posted in here.

I was hopeful that following your method to a T would get me my wifi back on 4.7.6 but it wasn't meant to be. Absolutely nothing I have tried in the last 24 hours has worked to get it working on 4.7.6 including multiple clean and dirty flashes of the full 4.7.6 zip, twrp, stock recovery, restoring multiple backups, restoring EFS, factory reset, wipes, etc.

You might want to add that to the OP that if you revert to 4.7.6 that wifi will not work.
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
Thank you, and done. :good:
[OnePlus 5T  Guides, News, & Discussion] forty9er:
I restored to 4.76 no wifi then I upgraded to the ob2 and wifi works then back down 4.76 and boom WiFi on hit again thanks was coming from 8.1
[OnePlus 5T  Guides, News, & Discussion] Dazed No More:
Finally got wifi working in 4.7.6

https://xdaforums.com/showpost.php?p=75260726&postcount=25
[OnePlus 5T  Guides, News, & Discussion] melmarPH:
Thank you so much for this amazing write up good Sir. I flashed a rom earlier today and I had to do factory reset and my phone became decrypted. I have TWRP installed still,, just that it won't accept all my rom files apart from the one that requires a decrypted device. Now I'm stock with a decrypted device with only one rom available with it. I know that your post is the solution to get out of this problem but before I proceed, I just wanna ask. If I use a modified rom based on OB2 instead of the stock non-modified oreo rom to restore encryption, is it going to work? I wanna used the "theOne5TOS" rom.. and I'm just curious if that would work the same as the stock one. Hope to hear from you. Thanks a lot!
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
It should work fine.
[OnePlus 5T  Guides, News, & Discussion] melmarPH:
Great! Thank you for the confirmation..
[OnePlus 5T  Guides, News, & Discussion] Harthouse:
You can use "sideload" command to directly flash stock ROM.
[OnePlus 5T  Guides, News, & Discussion] Dazed No More:
I like using MTP to drag and drop which is why I use fastboot to boot a twrp.img.....its much faster than adb push as well.
[OnePlus 5T  Guides, News, & Discussion] Jamie_oppo:
Very well written. It worked perfectly thanks

Also Instead of adb push I used otg cable or mtp. I think these are easier options.
[OnePlus 5T  Guides, News, & Discussion] bkeaver:
after going to OB2 and then going to a 8.1 ROM I successfully reverted back to stock both 4.7.6 and OpenBeta , well kind of.. everything works except now android auto wont launch and I can't stream to my car stereo via bluetooth or android auto.. android auto doesn't even recognized I'm plugged into my port.. very strange.. everything else works perfectly.. :-/
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
"Works" but has some issues related to the radio seems to be the recurring theme. I'd bet a cup of coffee that your firmware didn't downgrade with the ROM.
[OnePlus 5T  Guides, News, & Discussion] swapavi:
That's not quite correct... I've gone back to 4.7.6 numerous times without any issues..

From ob1 back to nougat, from ob2 back to nougat, from Omni/Phoenix back to nougat, etc..

I actually just rolled back to 4.7.6 earlier today coming from codename phoenix and wifi is working perfectly.

So I'm not sure what's going on for you.
[OnePlus 5T  Guides, News, & Discussion] Dazed No More:
Consider yourself lucky since there are multiple people who experienced the same issue with WiFi connectivity when going back to 4.7.6 from the OOB. Just because it worked for you doesn't mean it works for everybody.

https://xdaforums.com/oneplus-5t/help/wifi-issues-rolling-to-stock-oos-t3730017
[OnePlus 5T  Guides, News, & Discussion] :
I recently tried to return to OOS from 8.1. Somewhere along the way, TWRP stopped accepting the encryption password that i used.

Is there any way to make a backup of sdcard data without decrypting from TWRP?
[OnePlus 5T  Guides, News, & Discussion] bkeaver:
I will take that coffee black, no sugar please [emoji16]. I flashed the firmware separately as part of the install process. Also I will add there are no other issues besides no sound coming from Bluetooth stream to car and Android auto doesn't recognize the USB plugged in. Bluetooth connects to the car stereo and I can call people and they hear me and I hear them just fine. No issues with WiFi either .
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
No coffee for you yet. You flashed what firmware separately, OOS 4.7.x?

Did this ever work before you flashed Oreo Beta 1/2?
[OnePlus 5T  Guides, News, & Discussion] bkeaver:
Yes firmware 4.7.6. Yes this all worked previously in all versions until OB2
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
That's not what I'd call a successful downgrade.
[OnePlus 5T  Guides, News, & Discussion] bkeaver:
I successfully went from OB1 back with no issues. OB2 is the issue. And I'm get that but his question wasn't if I thought this time was a successful down he asked if I have went back successfully and I have. Until OB2
[OnePlus 5T  Guides, News, & Discussion] goran_oh:
Good job thank you.
[OnePlus 5T  Guides, News, & Discussion] AndroidGX:
Good job [MENTION=4385555]the Doctor[/MENTION] ! you saved my OP5T :highfive:

Thank you very much! appreciated ;)
[OnePlus 5T  Guides, News, & Discussion] corybucher:
If I'm on android 8.0 and just want to get phone back to factory everything will this work for me? I mean lock bootloader and all because I'm selling my phone unfortunately
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
Yes.
[OnePlus 5T  Guides, News, & Discussion] tweeny80:
[MENTION=4385555]the Doctor[/MENTION]

I'm on 8.1 custom rom, and wish to flash 5.04 Stable OOS.

Still want twrp and root so plan to:

1. Flash codeworx recovery for 8.0

2. Reboot recovery and wipe system & data.

3. Flash full OOS ROM 5.04

4. FLASH MAGISk to retain twrp and gain root.

5. Profit

I'm on right track?
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
TWRP will not restore factory encryption key storage. If you want that you must use stock recovery following the guide above. But you'll loose /sdcard.

If you don't care about restoring factory encryption and want to follow the steps you've posted above, use the new TWRP posted by codeworkx yesterday instead. Your device will still be encrypted.

And you should boot into the ROM once before flashing Magisk no matter how you do it. You'll have to re-flash recovery after every reboot until Magisk is flashed because unrooted OOS always restores stock recovery.
[OnePlus 5T  Guides, News, & Discussion] tweeny80:
OK understood thanks

What are the drawbacks of not being encrypted by stock method (but still encrypted using latest codeworx recovery?).
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
Just to be clear, all since Nougat use the same encryption method - FBE or file based encryption. The difference is how the encryption keys are stored.

After an AOSP/LineageOS-based ROM gets flashed and OOS is restored through TWRP, for some reason TWRP cannot read OOS encryption keys anymore. I don't know why. I also suspect that this has been fixed with the Feb security update in codeworkx latest TWRP posted yesterday.

IMO, give it a go with codeworkx latest TWRP. Then let us know if it can or can't decrypt with your PIN/password in place after restoring OOS. :good:
[OnePlus 5T  Guides, News, & Discussion] tweeny80:
[MENTION=4385555]the Doctor[/MENTION]

everything went well until I booted into OOS 5.04 ROM :-\

My steps:

from CRDroid 8.1, I did:

reboot into codeworx's older recovery

Wiped system, data,

installed Codeworx latest recovery,

rebooted recovery,

flashed OOS 5.04

it boots fine, goes to Setup Wizard then continually hangs after selecting system language.

then I rebooted (into stock recovery now) & 'reset factory settings' or similar. It wiped internal date etc, fine I had copied everything.

Reboot into OOS, same problem - setup wizard hangs after selecting system language.

It says "Just a sec..." forever and ever.

****, any suggestions where I go to from here? I have stock recovery, OOS 5.04 is installed but can't get past setup wizard after selecting system language.

Damn.

-----

OK - so I started your Guide from the beginning, followed all steps.

Finally got 5.04 installed. Still have stock recovery but I can sort that easily.

Basically, the OS wouldn't boot to 'desktop' until I used correct 'reset' setting in stock recovery. Then it was smooth sailing.

Your guide & help appreciated.
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
In stock recovery you need to go into Wipe data and cache and do both Reset system setting and Erase everything(Music, pics, etc.).

If you did that (or try it) and it still doesn't work, do it again, copy OOS...zip to the phone per the instructions in the OP, flash the ROM with stock recovery, and try it again.
[OnePlus 5T  Guides, News, & Discussion] tweeny80:
yup, as I explained at end of my post I finally am operational. Got TWRP & Magisk sorted.

Cheers
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
:good: Misread your post. Cheers, mate.
[OnePlus 5T  Guides, News, & Discussion] kousarali:
Is TWRP necessary?

hello,

thank you for the guide [MENTION=4385555]the Doctor[/MENTION].

i just wonder if TWRP use is necessary in the guide?

we can transfer the rom zip file from a pc to the phone internal storage using stock recovery too, right?

and we can also flash the rom file through stock recovery ?
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
When I first wrote the guide (just after the OP5T was released) I couldn't get ROM...zip to push to /sdcard with ADB in stock recovery even though ADB debugging was enabled and my computer authorized. That's why I had to use TWRP which worked perfectly. After pushing the file in TWRP, stock recovery couldn't find and flash it, so I had to flash it with TWRP as well.

Things may have changed since then. If pushing the file works now with a newer stock recovery, let me know and I'll update the guide accordingly. That is the way its supposed to work.
[OnePlus 5T  Guides, News, & Discussion] sytayeth:
Maybe a stupid question, but here it go.

In the number 5, you say to move the OOS zip into the phone. Can I flash the OOS zip in TWRP with a OTG pendrive??

Thanks
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
I haven't done it but I don't see why not, as long as OTG is functioning properly in your version of TWRP.
[OnePlus 5T  Guides, News, & Discussion] sytayeth:
Thanks
[OnePlus 5T  Guides, News, & Discussion] Dior DNA:
[MENTION=386689]doctor[/MENTION]

In OP post are links to stock recovery (which is is needed for necessary step)

OOS 4.7.6 stock recovery

OOS Beta (Oreo) stock recovery

Suppose one want to revert to OOS 5.0.4 (Oreo), then which one of the two stock recovery does one need to use?

Also, suppose one has a TWRP OOS 5.0.4 nandroid backup, then, I suppose, once one is reverted to clean OOS 5.0.4, then can one restore that backup once reverted back to OOS 5.0.4?

Thanks

update

post #14 seems to answer my question
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
Thanks for the heads-up, the OP has been updated.

If you want to restore a nandroid backup, I suggest only restoring data. Make sure that cache/art-dalvik gets wiped at some point as well.
[OnePlus 5T  Guides, News, & Discussion] nazimzer:
hi guys i have a big problem

ive formated all the files form twrp

now when i try to fast boot to the stock ROM i have this message in powershell :

PS D:\OnePlus 5 Root> fastboot flash recovery "D:\OnePlus 5 Root\OnePlus5TOxygen_43_OTA_035_all_1805230242_8fe38c528fc40

.zip"

target reported max download size of 536870912 bytes

Invalid sparse file format at header magi
[OnePlus 5T  Guides, News, & Discussion] Dior DNA:
OnePlus5TOxygen_43_OTA_035_all_1805230242_8fe38c528fc40.zip is a ROM archive (OOS 5.1.2) not a recovery image.

Use a TWRP image to flash (or boot from) instead.

Good luck
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
First things first:

1. This is not a thread about how to flash ROMs, recoveries or use Android SDK and ABD or fastboot commands. If you have questions about the basics, please keep them in [MENTION=6143932]Funk Wizard[/MENTION]'s excellent thread created for that purpose:

OnePlus 5T: Unlock Bootloader | Flash TWRP | Root | Nandroid & EFS Backup & More !!

2. This thread is not the place to discuss the merits of encryption or decryption.

3. I'm not responsible for what you do to your own device. Read, think, read more, re-think, wipe, flash in that order.

4. This OP and the following posts will be updated as the discussion develops, so please check back here from time to time.

Now on to the discussion

There has been a lot of talk lately about encryption, decryption and the benefits and liabilities of each. Obviously having your device encrypted is a gain for security, something we should try to keep if possible. But encryption methods can vary, which is a problem for flashaholics like myself. When you flash a new ROM that cannot read the encryption of the previous ROM, /data must be formatted, causing the loss of /sdcard - pictures, music, files, etc.

Understanding the Problem

The issue seems to revolve around Qualcomm's "KeyMaster" encryption keys. While both Nougat and Oreo use FBE (File Based Encryption), by default they use different encryption keys, as pointed out by dev [MENTION=3208754]codeworkx[/MENTION] -- Nougat and Oreo 8.0 use KeyMaster 1 while Oreo 8.1 uses KeyMaster 3. So when an Oreo 8.1 ROM is flashed, it either can't access /data (requires decryption or formatting /data) or the ROM reformats /data itself, like early beta Lineage 15.1 builds. Likewise, reverting to a Nougat or Oreo 8.0 build will cause the same problem. Apparently, moving to KeyMaster 1 to 3 works (ie, flashing from OOS to Omni/Lineage) but reverting from Keymaster 3 back to 1 doesn't. When this happens, OOS can still decrypt with your PIN/password but TWRP can't.

One solution is to run unencyrpted, for which you may find threads in the How-To section. This discussion is about how to stay encrypted and flash back & forth between ROMs without loosing all of your data.

Links on the subject:

https://source.android.com/security/encryption/file-based

I look forward to your contribution to this discussion! :good:
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
Reserved
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
Just dropping this here:
[OnePlus 5T  Guides, News, & Discussion] mad-murdock:
Yes, NOW I have seen this thread. Thanks for mentioning.

Seems useful.

After a bit of google kicking, I found this: https://source.android.com/security/encryption/file-based

Seems a good start on the topic. Maybe add it to a list of (hopefully growing) links?
[OnePlus 5T  Guides, News, & Discussion] mad-murdock:
Wow. Seems like this didn't work out that well.
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
1. Rather than understand and deal with it, lots of people decrypt.

2. The issue hasn't gone away. Give it time.
[OnePlus 5T  Guides, News, & Discussion] LeoPosas:
Great information to those who recently owned an OP even if they have knowledge how to flash ROMs. (Including me)

Thanks!
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
I've stumbled across another issue for investigation. While experimenting yesterday, I discovered that [MENTION=3208754]codeworkx[/MENTION] TWRP 3.2.1-0 for Oreo (8.0 and 8.1) is able to read stock OOS/OOS B1 encryption until it is backed up in TWRP, an Oreo 8.1 ROM is flashed (eg, Omni, Lineage), and OOS is restored. After that, TWRP cannot decrypt /data with the correct PIN/password of the restored OOS ROM or "default_password". It doesn't matter if the nandroid was taken with or without a PIN/password, if the PIN/password is removed from the Oreo 8.1 ROM before restoring the nandroid, etc. Codeworkx suspects it has to do with how the passwords are being stored between 8.0 and 8.1.

And before you ask, I never formatted /data or decrypted & re-encrypted. The contents of /sdcard survived every flash and nandroid restore. Every ROM flashed was able to access /data with the correct PIN/password including the restored OOS. Only TWRP can't read /data with the correct password.

Also, I've left recovery systemless. That means my nandroid backups are only of data, and I restore by flashing the stock OOS ROM and only restoring the data nandroid. So zero changes have been made to system.
[OnePlus 5T  Guides, News, & Discussion] shail139:
:confused::confused:

""And before you ask, I never formatted /data or decrypted & re-encrypted. The contents of /sdcard survived every flash and nandroid restore. Every ROM flashed was able to access /data with the correct PIN/password including the restored OOS. Only TWRP can't read /data with the correct password""

So Do you mean to say I can revert back to OOS OB-1 by flashing it over Omni/LOS/etc via TWRP without formatting Data, and later on restoring Nandroid data of OOS OB-1.
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
Yes, but obviously TWRP would not be able to decrypt with a PIN/password set by OOS. That just means you would have to disable lockscreen protection in the ROM before going into TWRP.
[OnePlus 5T  Guides, News, & Discussion] shail139:
By that way the steps to restore should be...

1. Backup of OOS OB-1 in TWRP should be taken post removal all securities PIN/PASSWORD/etc (On external drive/OTG)

2. Flash OOS OB-1 normally, clean flash, boot to system, no security should be set

3. Boot to TWRP, restore OOS OB-1 Backup Only "Data" should be checked via OTG drive

4. Reboot to system

"twrp-3.2.1-0-universal-codeworkx-dumpling" will be the TWRP to be used

Correct me if I am wrong in steps
[OnePlus 5T  Guides, News, & Discussion] gorillaCF:
so in this case, am i right to say that, so long i dont do nandroid restore, i wouldnt have problem with encryption/decryption regardless of what rom i'm flashing using codeworkx's universal TWRP?

usually i always clean flash new roms and i'm ok to go through the 'hassle' of reinstalling stuffs. if i want to go back to the previous rom, i'll just do a clean flash of the previous rom instead of reverting back via nandroid.

so technically so long i'm on the right TWRP, i'm fine with switching roms am i right?

thanks for sharing the findings as well!
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
I tried a clean flash of OOS from TWRP as well, but even that didn't work. I think you'd have to restore factory encryption per this guide to get TWRP to be able to decrypt OOS again:

[How To] Revert to 100% stock OOS from Oreo 8.1 | Restore factory encryption

Again, you can flash, backup and restore in TWRP even if you don't. It just won't be able to decrypt /data with your OOS PIN/password, so you'd have to remove lockscreen security first.
[OnePlus 5T  Guides, News, & Discussion] Chaplan:
Formating /data is the only way to go back to 8.0 crypto (after booting fully stock) and then you can use you Nandroids from OOS to restore /data with PIN, face unlock all ON.

Been there, done that from 8.1 custom to OOS N.

Didn't use stock recovery, didn't use revert builds, there actually were none at the time, but I think they are unneeded anyway.

It's a cumbersome process because backing up internal storage and restoring it is a pain when you have a lot of data to carry around.

But it's pretty straight forward.

All this done on blu_spark TWRP.
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
The problem I noted above wasn't that OOS couldn't read or encrypt /data properly after the nandroid backup--TWRP couldn't read OOS's PIN/password. I had no problems restoring and running OOS after running Omni/Lineage. After I restored OOS, on first boot I entered the PIN and found that my fingerprints and face unlock still worked. But when I booted back into Codeworkx TWRP neither the PIN or "default_password" worked. I didn't try Blu_Spark.

IMO, what we ultimately want is an official TWRP that can decrypt without workarounds so we can avoid the cumbersome process or formatting /data and moving everything back to /sdcard.

Edit: Here is the exact sequence of what happened:

I came from OOS OB1 with /data formatted by the stock recovery, encrypted, with PIN/fingerprints/face unlock.

I booted Codeworkx recovery, entered the PIN, it decrypted properly, I did a nandroid backup of the Data partition.

Still in recovery, I wiped Dalvik-Art/Cache/System/Data, then flashed Omni, gapps, Magisk.

I ran Omni for a while, moved to Lineage using the same process as above.

I never removed the PIN

, and Codeworkx TWRP had no problems decrypting with it in Omni or Lineage.

After running Lineage for a while, I went back into Codeworkx TWRP, decrypted with my PIN (it worked), wiped as above, flashed OOS OB1 with the factory zip, wiped the Data partition, restored Data from nandroid, flashed Magisk, rebooted.

On first boot OOS asked for a PIN. I entered my PIN and found my fingerprints & face unlock still working.

VVV HERE IS THE PROBLEM STARTED VVV

When I booted back into Codeworkx TWRP it could not decrypt with my PIN. I booted back into OOS and removed my PIN, set lockscreen protection to "None". TWRP still could not decrypt /data. I tried "default_password" but no dice.

Revert back to Omni, remove PIN, reboot TWRP, still can't decrypt. :mad:

So something changed between when I restored OOS OB1 (TWRP could decrypt with the PIN) and after first boot (TWRP couldn't decrypt with the PIN). Also, why could TWRP decrypt with OOS OB1's PIN to do the nandroid backup from a clean flash and to restore the same backup after being on Omni/Lineage, but couldn't decrypt with it after the first boot of the OOS nandroid backup?

Again, formatting /data again is not an acceptable workaround. I think we want to understand what changed and solve the problem.
[OnePlus 5T  Guides, News, & Discussion] Chaplan:
The mentioned /data format is not a workaround per se, it's the only working workflow to get things going once you find the need to get back to OOS for the time being.

Accepting that is part of the process!

Users should know this upfront so they don't find out the hard way.
[OnePlus 5T  Guides, News, & Discussion] Macusercom:
I'm currently running OxygenOS 5.0.3 and my understanding is that it uses Keymaster1. If I'm now upgrading to LineageOS 15.1 it'd change to Keymaster3 but without the need of formatting.

However, if I'd want to revert to OxygenOS 5.0.3 with Keymaster1 I would have to format /data. Is my understanding correct?
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
My experience has been that the ROM can decrypt without any issues, but TWRP can't decrypt without formatting /data with the stock recovery.
[OnePlus 5T  Guides, News, & Discussion] wunderdrug:
As previous posters have alluded to, use "twrp-3.2.1-0-universal-codeworkx-dumpling.img". This is able to decrypt 5.0.3.
[OnePlus 5T  Guides, News, & Discussion] the Doctor:
Right. Flash Omni or Lineage, then go back OOS and try it again as Macusercom says in the post I quoted.
[OnePlus 5T  Guides, News, & Discussion] Macusercom:
Will the Keymaster version change according to the ROM or are you "stuck" but ROMs and Codeworkx's TWRP can decrypt everything or is Keymaster up-/downgraded depending on the ROM?