Obtaining root access opens up endless possibilities for customization on Android, but sooner or later it becomes necessary to return the device to its โfactoryโ state. The reasons are different: from selling a smartphone to restoring a warranty or eliminating errors after unsuccessful modifications. However, simply deleting the application Magisk or SuperSU is not enough - traces of root access remain in the system partitions, and this is fraught with problems with OTA updates, a ban in banking applications, or even the device being bricked.
In this article we will examine 5 working methods the complete resetting root access, including methods for devices with a locked and unlocked bootloader, and also consider the nuances for popular brands - Samsung (c Knox), Xiaomi (c Mi Unlock), Google Pixel and others. We will pay special attention to restoring the original firmware and bypassing common errors like DM-Verity or Bootloop.
Why you canโt just uninstall Magisk or SuperSU
Many users mistakenly believe that uninstalling an application to manage root access (Magisk Manager, SuperSU) completely removes the root. In fact:
- ๐น System files remain changed: modified
boot.img, patches in/systemor/vendor. - ๐น SafetyNet continues to give an error: even without active root, banking applications (for example, SberBank Online or Tinkoff) can block operation.
- ๐น OTA updates stop installing: the system detects mismatch of section checksums
recoveryorboot. - ๐น Knox (on Samsung) or ARB (on Pixel) record facts of hacking, which leads to loss of warranty.
Moreover, some custom kernels (for example, ElementalX or FrancoKernel) may conflict with the stock firmware, causing endless reboot (Bootloop) when trying to return the original boot.img. Therefore, simply removing Magisk only works in 10% of cases - and then temporarily.
โ ๏ธ Attention: If you plan to sell the device, check the status Knox (for Samsung) or Tamper Flag (for Pixel) through the engineering menu (#06#or##4636##*). Even after a complete root reset, these flags may indicate hacking, which will reduce the cost of the phone.
Method 1: Full reset through settings (for beginners)
The simplest method, but it only works if:
- ๐ฑ Root was obtained via Magisk (not SuperSU!).
- ๐ The bootloader was not blocked after receiving root.
- ๐ฆ The device does not have a custom recovery (TWRP).
Instructions:
- Open Magisk Manager and go to the section
Uninstall โ Complete Uninstall. - Reboot your phone.
- Go to
Settings โ System โ Reset โ Delete all data. - Select
Erase internal memory(optional, but recommended).
After reboot, check the root status through the app Root Checker. If it is still active, proceed to the next method.
โ ๏ธ Attention: On some devices (for example, OnePlus or Realme) after such a reset, the IMEI may disappear. Before the procedure, write it down via *#06# or the application MTK Engineering Mode (for processors Mediatek).
Remove Magisk through the app
Do backup important data
Write IMEI
Disable pattern protection
Charge the phone at least 50%-->
Method 2: Restoring stock firmware via Fastboot
This method is suitable for devices with unlocked bootloader and requires the original firmware (factory image) for your model. Detailed instructions for Google Pixel, Xiaomi, OnePlus and other brands are different, but the general scheme is the same:
1. Download the stock firmware from the manufacturer's official website:
- Pixel: Google Factory Images
- Xiaomi: Miui Downloads (select version Fastboot)
- Samsung: via Samsung Firmware Downloader or Frija.
2. Unpack the archive with the firmware into the folder with fastboot (from Android SDK Platform-Tools).
3. Connect the phone to the PC in Fastboot (press Power + Vol Down when the device is turned off).
4. Execute the commands:
fastboot flash boot boot.imgfastboot flash system system.img
fastboot flash vendor vendor.img
fastboot flash dtbo dtbo.img
fastboot flash vbmeta vbmeta.img
fastboot erase userdata
fastboot erase cache
fastboot reboot
For Samsung instead of fastboot use the utility Odin with files AP, BL, CP i CSC (select HOME_CSCso as not to lose data).
| Brand | Utility for firmware | Features |
|---|---|---|
| Google Pixel | fastboot |
Required unlock OEM Unlock in the developer settings. |
| Xiaomi | Mi Flash Tool | You need to link your account Mi to the device (once every 30 days). |
| Samsung | Odin | Knox will work even after flashing stock firmware. |
| OnePlus | fastboot or MSM Tool |
MSM Tool resets Tamper Flag (only for some models). |
If the phone does not turn on after flashing the firmware, try pressing Power + Vol Up for 10-15 seconds to force a reboot. On Samsung sometimes a combination helps Power + Vol Down + Bixby (if there is a button).
Method 3: Removing root via TWRP (for experienced users)
If custom recovery is installed on the device TWRP, you can remove the root without completely flashing it. This method saves user data, but requires accuracy:
- Download the original
boot.imgfor your firmware (can be extracted from factory image or found on the forums XDA Developers). - Reboot into TWRP (press
Power + Vol Upwith the phone turned off). - Go to
Mount โ Systemand connect the phone to the PC. - Copy
boot.imgto folder/sdcard/. - B TWRP select
Install โ Install Image โ select boot.img โ Boot. - Flash
vbmeta.img(if any) with checking disabled (fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img). - Reboot.
After this, the root will be deleted, but traces may remain in /data/adb or /data/magisk. For complete cleaning:
adb shellsu
rm -rf /data/adb/*
rm -rf /data/magisk*
rm -rf /cache/magisk.log
โ ๏ธ Attention: On some devices (for example, Huawei or Honor) firmware of non-original boot.img via TWRP leads to activation eRecovery i forced reset. Before the procedure, check the compatibility on XDA.
What to do if TWRP does not see the internal memory?
If TWRP does not mount the partition /data, try:
1. version TWRP (for example, Redmi Note 10 Pro you need version 3.7.0+).
2. Enter the command TWRP team repair filesystem.
3. data-i="182">manually (will lead to data loss!). /data manually (will lead to data loss!).
4. Use ADB Sideload to install boot.img without mounting the memory.
Method 4: Using Magisk Uninstaller (for Magisk 24+)
From version Magisk 24.0 an official script has appeared for complete removal, which restores the original boot.img and clears all traces. Instructions:
- Download latest version of Magisk (file
Magisk-v26.4.zip). - Rename the archive to
uninstall.zip. - Flash it via TWRP or Fastboot:
fastboot boot uninstall.zip - After reboot, check the status via:
adb shell getprop | grep -i magisk(should return empty result).
The advantage of this method is automatic cleaning /data/adb and recovery vbmetaHowever, on devices with A/B sections (for example, Pixel or Samsung Galaxy S22+) needs to be flashed uninstall.zip on both slots:
fastboot --set-active=afastboot boot uninstall.zip
fastboot --set-active=b
fastboot boot uninstall.zip
Script Magisk Uninstaller is the only official way to remove root without the risk of damage DM-Verity. However, it does not reset the flags Knox or ARB!
Method 5: Manual recovery via ADB (for devices without TWRP)
If the device does not have a custom recovery, but has access to ADB, you can try restoring the original one boot.img manually. This method works on Sony Xperia, Nokia and some models Motorola.
Procedure:
- Download the stock firmware for your model and extract
boot.img. - Connect the phone to the PC and enable
Debugging USB. - Reboot into
Fastboot:adb reboot bootloader - Flash the original
boot.img:fastboot flash boot boot.img - If the device supports
A/B, flash on both slots:fastboot flash boot_a boot.imgfastboot flash boot_b boot.img - Reset
vbmeta(disables integrity check):fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img - Reset data:
fastboot erase userdatafastboot erase cache
On Samsung instead fastboot use Odin with option Auto Reboot i F. Reset Time (but not Re-Partition!). For Mediatekdevices (for example, Redmi 9A) you may need SP Flash Tool with a file scatter.txt.
Checking the result: how to make sure that the root is removed
Even after a successful reset, traces of root access may stay. Here's how to check the device:
- ๐ฑ Root Checker: the application should show "Root access: No".
- ๐ SafetyNet: use SafetyNet Test or YASNAC (should be green status
ctsProfile: true). - ๐ Build.prop: check through
ADB:adb shell getprop ro.build.tags(there should be no mention
test-keys). - ๐ก๏ธ Knox (for Samsung): enter
#0#โ if there is red text at the top โKnox Warranty Void: 0x1โ, guarantee lost.
If SafetyNet still does not work, try:
- Delete remaining Magisk files:
adb shellsu
rm -rf /data/adb/magisk*
rm -rf /cache/magisk.log
rm -rf /data/magisk* - Reset
vbmetaagain. - Flash
disable_dm-verity_forceencrypt.zip(at your own peril and risk!).
โ ๏ธ Attention: On some devices (for example, Google Pixel 6/7), even after a complete reset, the root may remain active due to AVB 2.0. In this case, only this will help. firmware factory image with complete cleaning of all partitions (fastboot -w).
Frequent errors and their solutions
When removing root access, users encounter typical problems. Here are the most common and ways to fix them:
| Error | Cause | Solution |
|---|---|---|
Fastboot: FAILED (remote: 'Not allowed in Lock State') |
The bootloader is locked after removing the root. | Unlock the bootloader again (fastboot flashing unlock). |
E: Unknown command [log] in TWRP |
Damaged section /data. |
Format /data to TWRP (Wipe โ Format Data โ yes). |
Phone does not turn on after flashing boot.img |
Incompatible version boot.img or damaged kernel. |
Flash the original firmware completely via Fastboot or Odin. |
SafetyNet does not work (ctsProfile: false) |
Modified system files remain. | Flash vbmeta.img with checking disabled or use MagiskHide Props Config. |
| Loss of IMEI after reset | Damaged partition /persist or nvram. |
Restore IMEI via Maui Meta (for Mediatek) or QCN (for Qualcomm). |
If after all the manipulations the device does not boot or gives an error No Command, try:
- ๐ Reflash stock recovery via
fastboot flash recovery recovery.img. - ๐ฅ Use EDL mode (for Qualcomm) or Download Mode (for Samsung).
- ๐ง Contact the forum XDA Developers or 4PDA with the error log (
adb logcat).
90% of problems when resetting the root are associated with incompatibility between versions boot.img and the current firmware. Always check the compliance of the assemblies (ro.build.fingerprint) through adb shell getprop!
FAQ: Answers to frequently asked questions
Is it possible to remove root without losing data?
Theoretically yes, if used Magisk Uninstaller or flash the original one boot.img through TWRP without formatting /dataHowever:
- On devices with FBE (File-Based Encryption) after changing
boot.imgdata may become not available. - Some banking applications (for example, SberBank) require a complete reset to pass SafetyNet.
We recommend making a backup via Titanium Backup or Swift Backup (work only with root!).
How to reset root on Samsung with Knox 0x1?
On devices Samsung triggered Knox (0x1) complete removal of traces of root is impossible - the flag remains forever. you can:
- Flash the stock firmware via Odin (files
AP,BL,CP,CSC). - Use Samsung Pay and Secure Folder will not work - they are blocked when
Knox 0x1. - To pass SafetyNet install the module MagiskHide Props Config and activate
Hide Magisk.
The warranty on hardware (for example, a screen or battery) is maintained, but the service center may refuse repairs under warranty if the problem is related to the software.
What what to do if, after removing the root, the phone does not see the SIM card?
This is a typical problem for devices on Mediatek (Redmi, Realme, Tecno, where modification boot.img partition nvram or persistis damaged. Solutions:
- Restore IMEI via Maui Meta or SN Writer Tool (backup required
nvram). - Flash stock firmware with a checkmark
Preloader(risky - may block device!). - Use a patch for
modem(search on 4PDA for your model).
If it doesnโt help, contact the service center with a request to reflash modem via SP Flash Tool.
How to bypass DM-Verity after removing the root?
DM-Verity (Device-Mapper Verity) blocks the system from booting if it detects changes in partitions. To disable it:
- Download
disable_dm-verity_forceencrypt.zip(for example, from here). - Flash via TWRP or
fastboot:fastboot boot disable_dm-verity_forceencrypt.zip - For A/Bdevices, flash to both slots.
โ ๏ธ Warning: Disabling DM-Verity reduces the security of the device! Do not use this method if you store sensitive data.
Is it possible to return root after a reset?
Yes, but there are nuances:
- On Samsung with
Knox 0x1receiving root will not worsen the situation (the flag has already worked). - On Pixel after resetting with Android Flash Tool may require unlocking again
OEM Unlock. - On devices with AVB 2.0 (for example, Pixel 6) you will have to patch
boot.imgagain through Magisk.
We recommend Before re-rooting, make a backup boot.img i vbmeta.img - this will simplify the future reset.