FORUMS

[How-To] Restore OOS from Oreo 8.1 | Restore factory encryption | Re-lock bootloader

4,621 posts
Thanks Meter: 4,999
 
By the Doctor, Retired Senior Moderator on 6th January 2018, 07:59 AM
Post Reply Email Thread
You need to do this if you've flashed an Oreo 8.1 ROM and find that you can't get back to OOS because...
  • The ROM can't read /data so it hangs on the boot animation or reboots to recovery, even on a clean flash.
  • TWRP won't recognize your PIN/password or "default_password".
  • You've tried re-formatting /data from TWRP several times and it doesn't solve your problem.
Here is how to get back to 100% stock and/or restore factory encryption, which is different than Oreo 8.1 encryption:


1. Back up /sdcard to your PC as it will be erased with all of your files, pictures, music, etc.

2. Flash the stock recovery from bootloader.
Code:
fastboot flash recovery stock_recovery.img

3. Restore system setting in recovery.
This step is necessary to restore factory formatting and encryption of /data.
If a password/PIN is set, click “I forgot my password.”
Boot into stock recovery. Once there, go to Wipe data and cache > Reset system setting and Erase everything(Music, pics, etc.).
Note: If you don't do the "Erase everything..." option, factory encryption will not be reset.


4. Boot TWRP from bootloader.
You could flash TWRP and reboot to recovery, but TWRP will get overwritten with the stock recovery when OOS boots anyway. It's faster just to boot TWRP from a command prompt. Use the command:
Code:
fastboot boot twrp-recovery.img
I recommend using using:

5. While in TWRP, move “OOS...ROM.zip” to the SD card.
In Windows File Explorer, copy OOS...ROM.zip to the device.

Alternately, you may use the following ADB command from a command prompt
Code:
adb push OOS...ROM.zip /sdcard/
Since OOS is a very large file (1.6GB), this will take 5-10 minutes.
6. Flash OOS...ROM.zip from TWRP.

7. Reboot system.
Your device will be formatted, encrypted and loaded with the stock recovery and ROM as it came from the factory. You may need to find the OOS...ROM.zip you pushed to /sdcard and delete it from emulated storage (/storage/emulated) if you don't see it at /sdcard after booting the ROM.

8. Optional: To re-lock your your bootloader, follow these additional steps:
This can only be done from a factory-supplied OOS ROM (including Oreo) with no modifications or the phone will not boot!
  • Enable USB debugging under Developer options.
  • Reboot to bootloader.
  • Unlock the bootloader with the following command:
    Code:
    fastboot oem lock
  • Return to Developer options and turn off "OEM unlocking"
The Following 39 Users Say Thank You to the Doctor For This Useful Post: [ View ] Gift the Doctor Ad-Free
6th January 2018, 08:13 AM |#2  
Funk Wizard's Avatar
Forum Moderator
Flag New Delhi
Thanks Meter: 17,377
 
More
Thank you for the write up .. nicely done

Sent from my OnePlus5T using XDA Labs
The Following 2 Users Say Thank You to Funk Wizard For This Useful Post: [ View ] Gift Funk Wizard Ad-Free
6th January 2018, 10:19 AM |#3  
Senior Member
Flag Somewhere in NYC
Thanks Meter: 531
 
More
It gave me an error 1 in TWRP. I had to do the following:
Quote:

1) Make sure the bootloader remains unlocked
2) Back your apps up in TitaniumBackup
3) Back your /sdcard partition up on your computer so you don't lose anything
4) Reflash stock recovery in the bootloader
5) Boot into stock recovery and hit "forgot password" when it asks for your lock code
6) Boot back into bootloader and reflash TWRP
7) Place stock OOS zip onto the /sdcard partition
8) While you're in TWRP, flash stock recovery through its image flasher then reboot into recovery
9) Flash stock OOS, reboot, and then mod however you want

The Following 6 Users Say Thank You to blackknightavalon For This Useful Post: [ View ] Gift blackknightavalon Ad-Free
10th January 2018, 09:15 AM |#4  
shail139's Avatar
Senior Member
Flag Kolkata
Thanks Meter: 249
 
More
Quote:
Originally Posted by blackknightavalon

It gave me an error 1 in TWRP. I had to do the following:

Will in 9th last step restoring from nandroid OB-1 work ?
It should I guess

Sent from my ONEPLUS A5010 using Tapatalk
11th January 2018, 04:01 AM |#5  
the Doctor's Avatar
OP Retired Senior Moderator
Flag In the TARDIS
Thanks Meter: 4,999
 
More
Bump!

I made a big update to the OP today with more explanation, more detail and download links.
The Following 4 Users Say Thank You to the Doctor For This Useful Post: [ View ] Gift the Doctor Ad-Free
14th January 2018, 12:06 PM |#6  
devil188's Avatar
Senior Member
Flag Right behind you
Thanks Meter: 289
 
Donate to Me
More
Thanks buddy, that tutorial worked perfectly!
The Following User Says Thank You to devil188 For This Useful Post: [ View ] Gift devil188 Ad-Free
14th January 2018, 03:00 PM |#7  
Senior Member
Thanks Meter: 57
 
More
The other way is to flash rollback image to Nougat in stock recovery.
https://goo.gl/YRyrt6
The Following 2 Users Say Thank You to daviddem For This Useful Post: [ View ] Gift daviddem Ad-Free
16th January 2018, 05:59 AM |#8  
Senior Member
Flag Singapore
Thanks Meter: 54
 
More
there are no other ways to revert back to stock OOS without affecting internal sd /sdcard ?

thanks for the guide above.
17th January 2018, 11:48 PM |#9  
Ippolito1971's Avatar
Senior Member
Flag OZARK
Thanks Meter: 1,099
 
Donate to Me
More
Ok I'm a bit Rusty. Flash from bootloader? Meaning adb? Then adb TWRP then boot to TWRP then flash stock room(s)?
18th January 2018, 12:55 AM |#10  
the Doctor's Avatar
OP Retired Senior Moderator
Flag In the TARDIS
Thanks Meter: 4,999
 
More
Quote:
Originally Posted by Ippolito1971

Ok I'm a bit Rusty. Flash from bootloader? Meaning adb? Then adb TWRP then boot to TWRP then flash stock room(s)?

Please do not quote the whole OP just to get someone's attention. A mention (@the Doctor) would suffice.

To answer your question, flash the stock recovery with the fastboot command:
Code:
fastboot flash recovery stock_recovery.img
The only ADB command involved is "push" to get the ROM onto the sdcard in step 5.
The Following 2 Users Say Thank You to the Doctor For This Useful Post: [ View ] Gift the Doctor Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes