Home > Unbrick

Restore OnePlus 6/6T to Stock via Fastboot Commands

In this guide, we will show you how to restore your OnePlus 6/6T device to stock OxygenOS by flashing the Stock ROM via Fastboot Commands. First off, we will show you how to convert the extract the payload.bin file from Stock ROM and get hold of all the partition IMG files (such as boot.img, system.img, etc). After this, we will flash all these files individually via Fastboot commands. Upon successful execution of these commands, your device will be back to stock ROM, unrooted, and without any custom binary installed (such as root or TWRP Recovery). Furthermore, the below instructions will also help you out in case it is stuck your device is stuck in the bootloop or soft brick.

OnePlus devices have always to be stand out among the crowds when it comes to custom development. However, it is with its sixth iteration that the OEM was well and truly highlighted. Up to this date, the device is receiving quite active support in custom development. With tons of custom ROMs, the ability to flash custom kernels, or a custom recovery like TWRP, well goodies are in order. Along the same lines, you could also root your device. This could be done directly via TWRP or without TWRP– by flashing the patched boot,img file. Once you do so, you could then flash Magisk Modules, Xposed Frameworks, Substratum Themes, among others.

However, all these tweaks do bring in some associated risks as well. If not done correctly, then it might lead to a few issues. The most general ones include the device getting into a boot-looped or a soft-brick. If that ever happens to your device, then you have landed at the right place. Given here are the detailed instructions to restore your OnePlus 6/6T device to stock OxygenOS by flashing the Stock ROM via Fastboot Commands. Follow along for the detailed instructions.



Unbrick | Restore: OnePlus 6/6T to Stock via Fastboot Commands

Before we list out the instructions, there are a few requirements that you need to qualify. Make sure to go through them and only then proceed with the unbrick steps.

Prerequisites

  • Create a complete device backup, if possible. This is because we will have to wipe off all the data from your device via the fastboot-w command later on. So a backup beforehand is of utmost importance. Since most of you might be stuck in fastboot, it might be a tough job to do. But if your device is up and running, then please create a backup beforehand.
  • Next up, install the Android SDK Platform Tools on your PC. This will provide you with the necessary ADB and Fastboot binary files.

These were the required files. You may now proceed ahead with the steps to restore your OnePlus 6/6T device to stock OxygenOS by flashing the Stock ROM via Fastboot Commands.

STEP 1: Boot OnePlus 6/6T to Fastboot Methods [3 Methods]

First and foremost, you will have to boot your OnePlus 6 device to Fastboot Mode. This could be done via 3 different methods, depending on the scenario you are facing as of now:

fastboot mode oneplus
Fastboot Mode OnePlus [Reference Image]
  • If your device is soft-bricked, well then it might already be booted to Fastboot.
  • If it is in a continuous boot-loop, then wait for the battery to dry out so that it powers off. Then plug in the charger and at the same time press and hold the Volume Up and Power button together. The timing is extremely important in this, if done at the right time, then you should have no issues in booting to Fastboot or Bootloader Mode.
  • On the other hand, if your device is perfectly working then use the Advanced Reboot menu under Developer Options and access the Fastboot Mode option. Or you could also enable USB Debugging from Developer options and then use the adb reboot bootloader command. Anyways, once your device is booted to Fastboot Mode, head over to the next set of instructions. to restore your OnePlus 6/6T device to stock OxygenOS by flashing the Stock ROM via Fastboot Commands.

STEP 2: Download OnePlus 6/6T Stock OxygenOS ROM

extracted fastboot rom restore oneplus 6 fastboot commands

Now head over to the OnePlus Support Forum and download the latest OxygenOS for your OnePlus 6. The firmware would be in ZIP format. If you see the firmware in JAR format, then simply use the 7 ZIP, WinZIP, WinRAR, etc extraction tool to extract its content.



STEP 3: Extract OnePlus 6 /6T Payload.Bin File

After extraction, you would notice that there aren’t any partition files. Rather you would see a payload.bin file. It is this file that is holding all the partition IMG files. So you will need to extract this patload.bin file to get hold of all the other files. In this regard, this guide should help you out: How to Extract Stock Boot. img from OnePlus OxygenOS Stock ROM.

payload bin extract via python restore oneplus 6 fastboot commands

Follow the steps given in this linked guide and you should all the files inside the Python output folder (again refer to the linked guide). For example, the above image shows all the files that I got after extracting the OnePlus 6 payload.bin file. Let’s now proceed to the next step to restore your OnePlus 6/6T device to stock OxygenOS by flashing the Stock ROM via Fastboot Commands.

oneplus 6 extracted payload fastboot files

STEP 4: Flash OnePlus 6/6T Stock ROM- The Initial Setup

Once you have got all the OxygenOS ROM extracted files, transfer them to the platform-tools folder. Inside the same folder, type in CMD in its address bar and hit Enter (see below image). This will launch the Command Prompt window. Now connect your device to the PC via USB cable. Make sure that is booted to Fastboot. Finally, you may now flash all the OnePlus Fastboot ROM files via Fastboot Commands.

command-prompt-adb

Given below in STEP 5 we have listed all the commands for the same. Copy-paste the first command in the CMD window, hit Enter, then do so for the next one, and so on. Furthermore, some commands like when the system.img file is being flashed, will take up quite a lot of time. This is completely normal. Along the same lines, you might also get an “Invalid sparse file format at header magic” message. Well then it is not an error, just wait for a few seconds and it will automatically be gone.



STEP 5: Restore OnePlus 6 Stock ROM via Fastboot Commands

Here are the required Fastboot commands to restore your OnePlus 6/6T device to stock OxygenOS by flashing the Stock ROM. The first command (fastboot -w) will completely wipe off all the data from your device, so make sure to have a backup beforehand. If you are doing just a normal upgrade, then you could skip this command. On the other hand, if you are fixing bootloop/softbrick or are coming from a custom ROM, then you will have to execute this command.

Then the command at the end (fastboot reboot bootloader) will reboot your device back to Fastboot Mode. After this, you may easily reboot to the OS from Fastboot either by bringing up the Reboot option via Volume Keys and then pressing the Power button to confirm the decision. Or you could also execute the fastboot reboot command to boot to the OS (only do so after all the files have been flashed and your device has been rebooted to Fastboot).

Android 10 Commands

fastboot -w
fastboot flash aop_a aop.img
fastboot flash aop_b aop.img
fastboot flash bluetooth_a bluetooth.img
fastboot flash bluetooth_b bluetooth.img
fastboot flash boot_a boot.img
fastboot flash boot_b boot.img
fastboot flash dsp_a dsp.img
fastboot flash dsp_b dsp.img
fastboot flash dtbo_a dtbo.img
fastboot flash dtbo_b dtbo.img
fastboot flash modem_a modem.img
fastboot flash modem_b modem.img
fastboot flash oem_stanvbk oem_stanvbk.img
fastboot flash qupfw_a qupfw.img
fastboot flash qupfw_b qupfw.img
fastboot flash storsec_a storsec.img
fastboot flash storsec_b storsec.img
fastboot flash system_a system.img
fastboot flash system_b system.img
fastboot flash vbmeta_a vbmeta.img
fastboot flash vbmeta_b vbmeta.img
fastboot flash vendor_a vendor.img
fastboot flash vendor_b vendor.img
fastboot flash LOGO_a LOGO.img
fastboot flash LOGO_b LOGO.img
fastboot reboot bootloader

Android 11 Commands

Upon downloading and extracting the OnePlus 6 Android 11 (OxygenOS 11) firmware, here are the files that you will get, as shown in the below image. We will be flashing these files onto your device via Fastboot Commands to restore your OnePlus 6/6T device to stock OxygenOS. So without any further ado, let’s get started.

restore OnePlus 6 OnePlus 6T stock OxygenOS via Fastboot Commands

fastboot -w
fastboot flash abl_a abl.img
fastboot flash abl_b abl.img
fastboot flash aop_a aop.img
fastboot flash aop_b aop.img
fastboot flash bluetooth_a bluetooth.img
fastboot flash bluetooth_b bluetooth.img
fastboot flash boot_a boot.img
fastboot flash boot_b boot.img
fastboot flash cmnlib_a cmnlib.img
fastboot flash cmnlib_b cmnlib.img
fastboot flash cmnlib64_a cmnlib64.img
fastboot flash cmnlib64_b cmnlib64.img
fastboot flash devcfg_a devcfg.img
fastboot flash devcfg_b devcfg.img
fastboot flash dsp_a dsp.img
fastboot flash dsp_b dsp.img
fastboot flash dtbo_a dtbo.img
fastboot flash dtbo_b dtbo.img
fastboot flash fw_4j1ed_a fw_4j1ed.img
fastboot flash fw_4j1ed_b fw_4j1ed.img
fastboot flash fw_4u1ea_a fw_4u1ea.img
fastboot flash fw_4u1ea_b fw_4u1ea.img
fastboot flash hyp_a hyp.img
fastboot flash hyp_b hyp.img
fastboot flash keymaster_a keymaster.img
fastboot flash keymaster_b keymaster.img
fastboot flash LOGO_a LOGO.img
fastboot flash LOGO_b LOGO.img
fastboot flash modem_a modem.img
fastboot flash modem_b modem.img
fastboot flash reserve_a reserve.img
fastboot flash reserve_b reserve.img
fastboot flash storsec_a storsec.img
fastboot flash storsec_b storsec.img
fastboot flash system_a system.img
fastboot flash system_b system.img
fastboot flash vbmeta_a vbmeta.img
fastboot flash vbmeta_b vbmeta.img
fastboot flash vendor_a vendor.img
fastboot flash vendor_b vendor.img
fastboot flash xbl_a xbl.img
fastboot flash xbl_b xbl.img
fastboot flash xbl_config_a xbl_config.img
fastboot flash xbl_config_b xbl_config.img
fastboot reboot bootloader

As mentioned before, your device will be booted to Fastboot mode due to the fastboot reboot bootloader command. You may now boot it to the OS right from the Fastboot Mode itself or use the fastboot reboot command. Do keep in mind that the first boot might take up some time. It is completely normal.

Furthermore, you might have to set up your device from scratch as a complete device wipe has taken place. On that note, let us know in the comments if you have any other queries related to the aforementioned steps. On that note, we conclude this guide to how to restore your OnePlus 6/6T device to stock OxygenOS by flashing the Stock ROM via Fastboot Commands.


Share:
  • Hey,
    All commands except first returns result: fastboot: error: cannot load ‘xxxx.img’: No such file or directory.
    Is there any hidden *.img files or I missed something?

  • hello i try to fix my phone but is not working,what can i do?

    Sending ‘abl_a’ (2132 KB) OKAY [ 0.062s]
    Writing ‘abl_a’ FAILED (remote: ‘Flashing is not allowed for Critical Partitions
    ‘)
    fastboot: error: Command failed

    • For me it was same error occurred.

      Solution : I started my phone in the first fast-boot (By pressing volume up + volume down + power button). Then I changed mood to recovery with volume key to move up and down and power key to select. It landed me in Chinese font recovery, also had the option to select English. Later, from advance option, I wiped data / delvic caches and rebooted system. I heard sometime delvic caches create issue. It worked.

  • while Flashing it shows “Flashing is not allowed for critical partitions” for several commands stating that they are failed.

  • Hello, thanks for the post I got something new today. But still have some questions.

    1.) How this is different from MSM Tool Flashing. It is much easier and user-friendly as well.

    2.) Is there any other method to install OTA updates. My one plus 6 was rooted. I rolled back it to Android 10 and it was working fine but after some days it suddenly stuck on Restart Loop. I tried to flash it with the same file again but the issue remains the same. I tried almost all Android 10 updates MSM flash I found on the internet it remains the same. Last hope is the later latest update for Android 10. But the issue is i am not able to find the MSM zip file. What i found is OTA update when i unzipped it PAYLOAD File in place of OPS file which is used by MSM tool. Can i flash OTA updates with this method. Can i directly download and flash the latest Android 11 update for OP6.

    3.) As i said my device is stuck in Restart Loop. I am hopeless know even googling does not giving anything appropriate. Do you ever faced such problem and have the solution. thanks a lot. Please let me know. A quick reply will be appreciated.

  • My device is in Locked bootloader state and getting an error while executing above said commands. But you didn’t mention anything related to that in this article, can you help here, how to do without unlocking? Because I need to take data backup.

  • Hi Sadique, this is really very helpful article.
    My OnePlus 6 recently got into Qualcomm Crash dump mode and didn’t have data backup of my important documents & photos. After a lot of searching, found this & your related articles and read them.

    Here the “fastboot -w” command indicates, it will wipe off whole data. What if I skip this command and follow all other steps, will my user data be saved and can I take backup once mobile is booted? Or please suggest me better way to have my data backup. Later I’m ready to do whatever to restore my mobile completely.

  • This guide doesn’t work. I got to the “fastboot flash aop_a aop.img” command and got the error “Flashing is not allowed for Critical Partitions.” Tried to follow your other guide to solve that, but it didn’t work. Unfortunately now I’m sitting here with a softbricked phone because of this as well (boot loop).

    I do not recommend this guide to anyone passing through.

  • Jeet Shah

    I have followed all the steps
    but getting this error for all the commands
    please help!!

    FAILED (remote: Flashing is not allowed in Lock State)

  • Hi Sadique,
    i cannot execute the commands apart from fastboot -w, it shows an error of
    flashing is not allowed for critical partitions
    fastboot: error: command failed

  • Assalamualaikum Brother, I’m so worried about my phone. I recently purchased a used OnePlus 6 2 weeks ago. It had Android 9 installed at that time. I heard about Oxygen Updater app, updated it to Android 10, then Android 11.1.1.1. within same day from the app.

    That’s when my frustration began, after the update 11.1.1.1.

    My OnePlus 6 camera was working completely fine on Android 9/10 but 3-4 days after updating to Android 11.1.1.1., it started crashing. On 6-7th day it completely stopped working on stock Camera app.

    It did not fall down at all or got pressed from anywhere anyhow. Be noted that I’m a very careful user.

    Now when I click the Camera app, it opens the Camera with black screen and closes within two seconds. That’s it, no response at all. It does not switches to front camera at all. If I select any other Camera Mode (Video/Portrait) on back cam it closes without any response.

    I then checked camera operation in some apps:
    1- Instagram: By default Front cam opens. Front cam operates fine here and captures pictures.
    2- Whatsapp: By default Back cam opens. Back cam is unresponsive, neither lets switching to Front cam.

    Then I downloaded “HD Camera” app from Play store. Running this app, back camera is loaded by default so, at first it gives “Serious Camera Error” and switching to front camera is unresponsive. I open Gallery images from within the app and then back to camera, I click on Front camera and it switches to front camera. Then I can click images/videos with Front camera. I then again try to switch to back camera and “Failed to HD camera. Camera may be in use by another application?” message appears. Hence, back camera does not works.

    I also noticed that in Face Unlock settings it lets Front Camera work. It recognized my face and lets it unlock the phone fine.

    Then, I googled How to unlock Engineering Mode in OnePlus 6 and tested camera working in Engineering Mode:
    1- Rear camera testing FAILED/unresponsive. (This is lower camera on the back)
    2- Second Rear camera testing PASSED/camera image appears. (This is upper camera on the back)
    3- Front camera testing PASSED/camera image appears.

    Things that I have tried multiple times to cure the issue:
    1- clearing Cache of Camera app
    2- clearing Storage of Camera app
    3- wiping Cache from Boot menu
    4- doing Factory reset 5 times
    5- rolling back to Android 10, then 9 but the problem still remains
    6- tried Gcam, same behavior

    As far as I know it may be a software issue since the issue happened right after updating to Android 11. Before that everything was working completely fine.

    I followed some posts in OnePlus community, found multiple other users having the same issue after the update.
    Could you please guide me on how can i get the Rear Camera to start working again?

    JazakAllah.

  • When I try to flash, it gives me error “Flashing is not allowed for Critical Partitions”. My bootloader was already unlocked. I did the “fastboot oem unlock” and “fastboot flashing unlock” and “fastboot flashing unlock_critical” commands and it tells me that the device is already unlocked. But still I can’t execute the actual flash images. The USB debugging is ON. Any idea what might have gone wrong?

  • Hey, I tried doing this while going from lineage os 18.1 to oxygenOS a11 open beta 3. Once all the commands are executed, and I perform a reboot I get an error on my phone saying “Qualcom CrashDump Mode Attempted to kill init! exitcode=0x0000000b do_exit”
    and it doesn’t proceed further. I can only go back to fastboot after this.
    What do I do?

  • Bricked my phone thanks.

  • Riham Chowdhury

    FAILED (remote: ‘Erase is not allowed in Lock State’)
    How to solve this error? my device is bricked. So i cannot unloack bootloader

  • lineageOS is nice all works BUT , i need all my google services working! so i decided to go back using this guide.

    i was mining at the moment so my fastboot flash crashed in the middle… had a heart attack, then when got back to life, power off the device, fastboot again and started again.

    it seems to work, rebooted, oem lock, rebooted and i’m typing this while my phone is booting again.

    NEVER EVER AGAIN custom roms for working good mobiles, is just not worth it !!

    love you all worked flawlessly,

    • Sadique Hassan

      Thanks a lot David for the appreciation, means a lot!

  • THANKYOU SOO MUCH SIR! AFTER TRYING ENDLESS PERMUTS AND COMBINATIONS AND HAVING SOMETHING OR THE ORTHER NOT WORKING (FLASHING STOCK FIRMWIRE WITH TWRP MADE INTERNAL STORAGE NOT ACCESSIBLE, SOME STOCK FIRMWIRE FLASHED WITH TWRP LEAD TO NOT BEING ABLE TO BYPASS GOOGLE ACCESS DEVICE AT STARTUP, SOO MANY ENDLESS FASTBOOT ERRROES, BOOT LOOPS I FACED IN THE PAST 36 HOURS) FINALLY THIS WORKED FOR ME. WAS SKEPTICAL INITALLY SEEING THE CUMBERSOME STEPS IT WOORRIED ME THAT EVEN ONE STEP WRONG OR THE PC NOT ACCEPETING SOME DRIVER ALL WOULD BE IN VEIN IT IT WENT SMOOTHLY AS DESCRIBED.

    • Sadique Hassan

      Well, it’s always great to receive such feedbacks. Thanks for these kinds words and I/’m glad that it worked out for you

  • Man, thank you man. You saved me from bricking a €500 device ^.^

  • Lucas Hernandez

    Hi SADIQUE,
    I have the problem that the phone is locked in a reset loop and i cant access developer options to enable debugging mode in order to enable ADB or Fastboot commands. is there any way to achieving this any othe way? i can get the phone to be in fastboot mode.

    • Sadique Hassan

      Hi Lucas, USB Debugging is only needed to boot your device to Fastboot Mode. Since you are already in Fastboot, you could now directly use the Fastboot Commands to flash the firmware

  • Adam Howells

    You’re a hero, thank you so much!