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

Search This thread

the Doctor

Retired Senior Moderator
Dec 15, 2011
4,588
4,526
In the TARDIS
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 [I]stock_recovery.img[/I]


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 [I]twrp-recovery.img[/I]
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 [I]OOS...ROM.zip[/I] /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"
 
Last edited:

blackknightavalon

Senior Member
Feb 1, 2009
3,216
534
Somewhere in NYC
It gave me an error 1 in TWRP. I had to do the following:
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 Doctor

Retired Senior Moderator
Dec 15, 2011
4,588
4,526
In the TARDIS
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 [I]stock_recovery.img[/I]

The only ADB command involved is "push" to get the ROM onto the sdcard in step 5.
 

tcat007

Senior Member
Jul 3, 2011
5,449
2,019
Austin, TX
Thanks for this, may need it. Plan to flash DU 8.1 tomorrow. So you can't just restore an ob1 or ob2 nandroid from a custom ROM?
 

the Doctor

Retired Senior Moderator
Dec 15, 2011
4,588
4,526
In the TARDIS
Thanks for this, may need it. Plan to flash DU 8.1 tomorrow. So you can't just restore an ob1 or ob2 nandroid from a custom ROM?
You can, but TWRP will not recognize your PIN or password while in OOS, so you'll have to set lockscreen security to none or swipe. Or you could do the procedure in the OP, then restore only data from your nandroid. You'll have to re-flash Magisk or any other mods after that.
 
Last edited:
  • Like
Reactions: Dior DNA

tcat007

Senior Member
Jul 3, 2011
5,449
2,019
Austin, TX
I don't use a pin for backups or restores. Since I seem to have to format internal storage to get a custom ROM to boot, was just wondering if restore of oos nandroid works once on DU.

Sent from my OnePlus5T using XDA Labs
 

Dazed No More

Senior Member
Aug 21, 2017
279
105
How can I get my wifi back after reverting to 4.7.6? Ive tried EFS backup and everything possible but the only way to get wifi back is to flash an Oreo zip.
 

the Doctor

Retired Senior Moderator
Dec 15, 2011
4,588
4,526
In the TARDIS
hello thanks for the guide just did this when i boot i cant connect to any wifi network thanks
Did you restore to 4.7.6 or Oreo Beta 1/2?

How can I get my wifi back after reverting to 4.7.6? Ive tried EFS backup and everything possible but the only way to get wifi back is to flash an Oreo zip.
Have you flashed OOS Oreo Beta? My theory is that the firmware won't downgrade back to OOS 4.7.6, but I'm not sure. I've only restored back to OOS OB1/2, and wifi has worked perfectly every time.
 

Dazed No More

Senior Member
Aug 21, 2017
279
105
Did you restore to 4.7.6 or Oreo Beta 1/2?

Have you flashed OOS Oreo Beta? My theory is that the firmware won't downgrade back to OOS 4.7.6, but I'm not sure. I've only restored back to OOS OB1/2, and wifi has worked perfectly every time.
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.
 
  • Like
Reactions: the Doctor

Top Liked Posts

  • There are no posts matching your filters.
  • 39
    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 [I]stock_recovery.img[/I]


    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 [I]twrp-recovery.img[/I]
    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 [I]OOS...ROM.zip[/I] /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"
    6
    It gave me an error 1 in TWRP. I had to do the following:
    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
    4
    Bump!

    I made a big update to the OP today with more explanation, more detail and download links.
    2
    Thank you for the write up .. nicely done :good:

    Sent from my OnePlus5T using XDA Labs
    2
    The other way is to flash rollback image to Nougat in stock recovery.
    https://goo.gl/YRyrt6