From custom ROM back to stock Samsung firmware
A LineageOS build that stopped getting updates, a Magisk root that broke your banking app, a TWRP install you no longer need: the way back is the same in every case. Flash the complete official firmware for your model with Odin, then decide whether to lock the bootloader again. One thing will not come back, and it is better to know which before you start.
What you need
- The exact model number. A custom ROM often reports a different model in Settings, so read PRODUCT NAME in Odin mode instead.
- Your region (CSC). If you no longer know it, pick the CSC of the country the phone was bought in from the CSC codes list.
- Stock firmware for that model and CSC with a bootloader binary equal to or higher than the one on the phone. The newest build for your region is always safe on that count. Find it on the models page.
- Odin 3.14.4, the Samsung USB driver and a data cable.
- A backup. Going back to stock wipes the phone, and a custom ROM backup made in TWRP will not restore on stock firmware.
Copy photos and files to a PC, export chats with each app's own backup, and note your two-factor apps: authenticator codes do not survive a wipe unless the app has cloud backup.
Flashing stock over a custom ROM
The custom ROM, TWRP and the Magisk-patched boot image all live in partitions that the official firmware overwrites. One full flash removes all three. There is no need to uninstall Magisk or restore the stock boot image first.
- Extract the firmware ZIP. You get five files:
BL_,AP_,CP_,CSC_andHOME_CSC_, all ending in.tar.md5. Tablets without mobile data have no CP file. - Boot into Odin mode and connect the phone. Odin shows a COM port and "Added!!".
- Load BL, AP, CP and CSC. Not HOME_CSC: after a custom ROM the data partition is in a format stock Android may not read, and only the full CSC wipes it.
- Keep Auto Reboot ticked, leave Re-Partition off, press Start.
- After PASS!, the first boot takes five to ten minutes. If it lands in stock recovery with an error about data instead, choose Wipe data/factory reset there and reboot.
At this point Android is stock, root is gone and the custom recovery is replaced. The bootloader is still unlocked, so the phone shows the unlocked bootloader warning on every start. The general flashing procedure, with screenshots, is in the flashing guide.
Relocking the bootloader
Relocking is what makes the phone pass Google's integrity checks again, which banking apps, Google Wallet and some games rely on. It is also the step that can brick a phone if done at the wrong moment.
Relock only after stock firmware has been flashed and has booted at least once. With any custom binary still on the phone (TWRP, a patched boot image, a custom ROM), a locked bootloader refuses to start it and the phone is stuck until you flash stock anyway.
- Back up again if you put anything on the phone: relocking wipes it.
- Turn the phone off and enter the warning screen of Odin mode (both volume keys plus the USB cable on current models).
- Long press Volume Up. The screen offers to lock the bootloader.
- Press Volume Up to confirm. The phone wipes itself and restarts.
- Finish setup. The Odin mode screen now shows
OEM LOCK: ON (L).
If the Volume Up long press goes straight into Odin mode with no lock prompt, the model either has a locked bootloader already or is a US model whose bootloader cannot be unlocked in the first place.
What stays broken: Knox
Unlocking the bootloader on a Samsung trips an e-fuse called the Knox warranty bit. Odin mode shows it as
WARRANTY VOID: 1 (or 0x1 on older models). It is a physical fuse: stock firmware,
relocking and service tools do not reset it.
Everything that depends on Knox stays off on that phone for good:
- Samsung Wallet payments (Samsung Pay) and Samsung Pass.
- Secure Folder.
- Knox-protected features in some Samsung apps, which may refuse to start or hide options.
- In many countries, warranty repairs for software-related faults.
What does come back with stock and a relocked bootloader: over-the-air updates in Settings, Google Wallet, banking apps that check device integrity and the normal boot screen without the unlocked bootloader warning.
Errors on the way back
"Custom binary blocked by FRP lock" on boot
The phone has unofficial software and FRP is on, usually because OEM unlocking got switched off or a Google account was added while TWRP or a patched boot was still installed. Flash the full stock firmware in Odin. It replaces the blocked binary, and the phone boots. FRP itself stays, so have the Google account ready; the FRP lock guide explains why.
"Only official released binaries are allowed to be flashed"
The bootloader is locked, or Knox Guard is in a restricted state, and Odin was asked to write something unofficial. When you are going back to stock this usually means a modified file slipped in: check that all four files are from the same official firmware package and that none was renamed.
KG STATE: Prenormal, or RMM STATE: Prenormal
Knox Guard has not confirmed the device yet, and unofficial binaries are refused. Stock firmware still installs. Flash stock, boot, connect to the internet and leave the phone on for a while. The state normally changes to Checking or Completed after it checks in. On a financed or company phone it may stay locked; that is a matter for the seller or employer.
"SW REV CHECK FAIL" with the stock firmware
The firmware's binary is lower than the phone's. That happens when the custom ROM was installed on top of a newer stock base. Use a newer build. The downgrade guide shows how to read the binary.
Boot loop after PASS!
Old data left behind by the custom ROM. Boot into recovery (Volume Up and Power with the cable connected to a PC on current models), run Wipe data/factory reset, reboot.
Related guides
- Odin download for Samsung: versions, Odin mode and errors. Which Odin version to use, how to get into Odin mode and what the Odin log errors mean.
- How to downgrade Samsung firmware. When a downgrade is possible, how the bootloader binary limits it and how to flash an older build.
- Odin mode on Samsung: enter, read the screen, exit. Key combinations by device, what FRP LOCK, KG STATE and WARRANTY VOID mean, and how to get out when stuck.
- How to flash Samsung firmware with Odin. The full step-by-step flashing guide.