![]()
Ultimate Guide: Installing LineageOS on a Samsung Galaxy M02 Without TWRP
Navigating the custom ROM landscape on Samsung devices can be a complex endeavor, particularly when dealing with entry-level hardware like the Samsung Galaxy M02. We understand the frustration of encountering boot loops, failed ADB sideloads, and the dreaded Error 21 while attempting to modernize your device. The specific constraints you are facing—specifically the inability to maintain a TWRP installation, the failure of standard fastboot commands, and the verification errors within stock recovery—require a sophisticated, multi-layered approach. This is not a standard installation process; it is a workaround designed for Samsung’s unique bootloader architecture and Samsung’s Odin flashing protocol.
This comprehensive guide is designed specifically for your Samsung Galaxy M02 (Model: SM-M022F/DS, etc.). We will bypass the reliance on TWRP entirely and utilize the powerful Odin flashing tool combined with custom VbMeta images to disable AVB (Android Verified Boot). This method allows us to flash a generic Project Treble GSI (Generic System Image) directly to your device, effectively overcoming the Error 21 and the limitations of your stock recovery.
Understanding the Samsung Galaxy M02 Limitations
Before proceeding, it is crucial to understand why your device is behaving this way. The Samsung Galaxy M02 is based on the MediaTek MT6762M (Helio P22) chipset. Unlike Qualcomm Snapdragon devices, which utilize standard fastboot modes for low-level flashing, MediaTek devices use a proprietary protocol often referred to as Brom (BootROM) mode or a restricted fastboot mode that is locked down by Samsung.
The “No Fastboot” Problem
When you type fastboot devices and see nothing, it confirms that Samsung has disabled the standard Google fastboot interface in favor of their own Odin Protocol. This means that tutorials relying on fastboot flash system system.img will never work for you. We must use the Odin tool (or a variant like Frija or SamFw) to flash firmware partitions.
The “TWRP Boot Loop” Issue
The reason TWRP fails to stick is due to Samsung’s Dynamic Partition System (A/B Slots) and the specific bootloader logic on the M02. The device expects a specific boot.img signature. When TWRP is flashed, the bootloader often rejects it because it cannot verify the recovery partition’s integrity, or it conflicts with the A/B slot switching mechanism, causing an instant boot loop. We will circumvent this by flashing a patched boot.img to the boot_a or boot_b slot rather than attempting to install a separate recovery image.
The “Error 21” Verification Failure
The Error 21 in stock recovery indicates Signature Verification Failure. The stock recovery is strictly checking the digital signature of the ZIP file you are trying to sideload. Since generic LineageOS GSIs are not signed by Samsung, the stock recovery rejects them. To fix this, we cannot use the stock recovery’s ADB Sideload function. Instead, we will use Odin to flash the system image directly to the system partition, bypassing the recovery’s strict verification checks entirely.
Prerequisites and Required Tools
To successfully flash LineageOS on your Galaxy M02 without TWRP, we need a specific set of tools. Ensure you have a Windows PC for the most reliable Odin experience.
- Samsung USB Drivers: Essential for your PC to recognize the device in Download Mode.
- Odin3 (v3.14.4 or later): The official Samsung flashing tool.
- Frija: A tool to download the official stock firmware for your specific model and region.
- SamFw Tool: An excellent alternative for bypassing FRP and converting firmware files.
- 7-Zip: For extracting firmware files.
- GSIs (Generic System Images):
- LineageOS GSI: We recommend the official LineageOS GSI builds or a trusted variant like Phh-Treble-GSI.
- Mustang GSI (Optional but recommended): A GSI specifically optimized for MediaTek devices, often resolving hardware compatibility issues better than generic GSIs.
- VbMeta Disabler Image: A pre-patched
vbmeta.img(usually with--disable-verity --disable-verificationflags). This is mandatory to preventError 21style verification failures and bootloops. - Magisk: For root access, which is often required to fix hardware (RIL, Camera, Audio) on GSIs. You can find the latest Magisk APK in the Magisk Module Repository.
Step 1: Preparing the Stock Firmware (The Foundation)
Since we cannot use TWRP to create a backup, we must ensure we have a solid foundation to return to if things go wrong. We need to extract specific files from your stock firmware.
- Identify Your Model: Go to Settings > About Phone. Your model number should be SM-M022F (or similar).
- Download Stock Firmware: Use Frija to search for your model number and region (CSC). Download the latest firmware version.
- Extract the Firmware: Once downloaded, Frija will extract the firmware into a folder. You will see files like:
BL_XXXXXXXX.tar.md5AP_XXXXXXXX.tar.md5CP_XXXXXXXX.tar.md5CSC_XXXXXXXX.tar.md5
- Extract
system.img: We are not going to flash the stocksystem.imgyet, but we need to understand the partition structure. TheAPfile is the largest and contains the system partition. We will replace the content of the system partition with the GSI.
Step 2: The Critical Fix - Disabling Verified Boot (AVB)
The primary reason for Error 21 and boot loops is Android Verified Boot (AVB). When the bootloader checks the system partition and finds it is not signed by Samsung, it refuses to boot. We must disable this check.
Acquiring the VbMeta Image
You cannot simply use the vbmeta.img from the stock firmware. You need a modified version.
- Search for “vbmeta_disabler.img” specifically for Samsung MediaTek devices. There are generic versions available on XDA Developers or GitHub.
- If you cannot find one pre-made, you can create one using a Linux environment or WSL (Windows Subsystem for Linux) with the
avbtoolif you have the stockvbmeta.img.- Command:
avbtool make_vbmeta_image --output vbmeta_disabler.img --disable_verity --disable_verification
- Command:
Note: We will flash this vbmeta_disabler.img to the vbmeta (or vbmeta_samsung) partition. This tells the bootloader, “Trust everything.”
Step 3: Preparing the GSI (LineageOS)
We are moving away from the ZIP file method. The stock recovery cannot handle the GSI ZIP. We need an IMG file.
- Download the GSI: Download the LineageOS GSI (usually named something like
lineage-20.0-2023xxxx-phylogenetic-arm64-*.img.xz). - Extract: Decompress the
.xzfile using 7-Zip to get a raw.imgfile. - Partition Size Check: The Samsung Galaxy M02 typically has a
systempartition of around 3GB to 4GB. Ensure your extracted GSI image does not exceed this size. If it does, you may need to resize the image or look for a smaller “vanilla” variant of LineageOS (without GApps).
Step 4: The Flashing Procedure (Odin Method)
This is the most critical section. We will use Odin to flash the vbmeta_disabler and the GSI.
Entering Download Mode
- Power off your Galaxy M02 completely.
- Press and hold Volume Up + Volume Down and connect the USB cable to your PC.
- You will see a warning screen. Press Volume Up to enter Download Mode (Odin Mode).
Flashing via Odin
Method A: Using Standard Odin Tabs (If your Odin recognizes GSI images)
- Open Odin3 on your PC.
- Connect your phone. The
ID:COMbox should turn blue (or yellow/green). - Load the VbMeta Disabler:
- Click the VMETA or USERDATA button in Odin (depending on your Odin version, sometimes you can use the AP slot if you rename the file to
AP.tar.md5, but usually,USERDATAorCPis safer for custom images). - Alternative: If Odin refuses the
vbmetafile, we will use SamFw Tool later. For now, let’s focus on the GSI.
- Click the VMETA or USERDATA button in Odin (depending on your Odin version, sometimes you can use the AP slot if you rename the file to
- Load the GSI (The System Image):
- Rename your LineageOS
.imgfile tosystem.img. - Compress it into a
.tararchive (do not use RAR or 7z, use TAR format). - In Odin, click the AP or SYSTEM button (Odin versions vary).
- Select the
system.tarfile. - Crucial Warning: Do NOT select
Re-partitionin Odin. This is dangerous for Samsung devices.
- Rename your LineageOS
- Ensure Options are Correct:
- Uncheck Auto Reboot (We want to control the reboot manually to ensure the flash is successful).
- Uncheck F. Reset Time (Optional, but safer).
- Click Start.
- This process will take time. Do not disconnect the cable.
Method B: Using SamFw Tool (Recommended for GSI on M02) Standard Odin can sometimes be finicky with non-Samsung system images on MediaTek devices. The SamFw Tool is often more successful.
- Open SamFw Tool and connect your phone in Download Mode.
- Go to the Flashing tab.
- Load your stock firmware files (BL, AP, CP, CSC) just to have the base structure.
- Remove System: Remove the loaded CSC or AP (which contains the stock system) and replace it with your GSI TAR file.
- Better yet: Use the “Fix Android Version” or “GSI Flash” features available in SamFw Tool if you have the Pro version, or simply use the standard Flash button but replace the
system.imginside the AP tar with your GSI (using 7-Zip to open the AP tar and swap the system.img). - Simpler GSI Method: Extract the stock
AP.tar.md5. Open it with 7-Zip. Findsystem.img(it might be sparsesystem.img.lz4or raw). Delete it. Drag and drop your extracted LineageOS GSI.imginto the 7-Zip window. - Rename the new AP file back to
AP.tar.md5. - Flash this modified AP file in Odin (Method A).
- Better yet: Use the “Fix Android Version” or “GSI Flash” features available in SamFw Tool if you have the Pro version, or simply use the standard Flash button but replace the
Step 5: Handling the VbMeta Partition
If you failed to flash the vbmeta_disabler in Step 4, you must do it now. If you cannot find a slot for it in Odin, we can force it.
Using SamFw Tool:
- Connect in Download Mode.
- Go to the “FRP/Remove FRP” tab (sometimes has a “Vbmeta” feature) or “Misc” features.
- Look for an option to “Flash Vbmeta”.
- If not present, go to the “ROM Flash” tab, select your
vbmeta_disabler.img, and select the partition name asvbmetaorvbmeta_samsung. (You may need to try both). Click Flash.
Fixing “Secure Check Fail (system)” / Custom Binary Block:
- After flashing the GSI, you might get an error blocking boot.
- You must flash the Pit File (if available for M02) or perform a “Re-partition” in Odin only if you have the correct PIT file. WARNING: This is risky.
- Safer: Flash the stock firmware (AP, BL, CP, CSC) via Odin. This restores the phone to working condition. Then, repeat Step 3 and 4, but only flash the
vbmeta_disablerand thesystem.tar(GSI), leaving the stockboot.imgalone.
Step 6: The First Boot (Post-Installation)
Once the flash is complete (and you have disconnected the cable):
- Force Reboot: Press and hold Volume Down + Power for 10 seconds to force a shutdown, then immediately press Volume Up + Power to boot into Recovery Mode.
- Wipe Data:
- Since we are jumping Android versions (likely from 10/11 stock to Android 13/14 GSI), you must wipe data.
- Select Wipe data/factory reset.
- Select Format data/factory reset (Type ‘yes’ to confirm).
- Reboot System:
- Select Reboot system now.
Note: The first boot will take a long time (10-20 minutes). Do not panic. If it takes longer than 30 minutes, you may have a kernel incompatibility.
Step 7: Troubleshooting GSI on Galaxy M02
If you boot into LineageOS but face issues, here is the checklist.
No RIL (Mobile Data / Calls)
MediaTek GSIs often fail to pass RIL data.
- Download the Magisk Manager APK (latest canary build).
- Flash
Magiskvia the “Install to Inactive Slot” method if possible, or patch the stockboot.imgusing Magisk Manager, rename it toboot.img, pack it toboot.tar.md5, and flash it via Odin in the BOOT slot. - Once rooted, install Magisk Modules:
- MTK Settings (Crucial for MTK hardware).
- RIL Fix modules specific to Samsung M02 (search the Magisk Module Repository for “Samsung M02” or “M02 RIL”).
Camera Issues
GSI cameras often fail.
- Look for “Gcam” (Google Camera) ports optimized for MediaTek.
- Install Magisk modules like “libsupercamera” or specific “Camera2API” enablers.
Sensors Not Working
The accelerometer or gyroscope might be missing.
- Flash the Sensor Disable Magisk module (if you don’t mind losing some sensors) or search for “Sensor Fix” modules in the Magisk Repository.
Stuck in Bootloop
If the device keeps restarting:
- Re-enter Download Mode.
- Flash the Stock Stock firmware (AP, BL, CP, CSC) to restore the device to 100% working order.
- Re-attempt the GSI flash, but this time try a different GSI variant (e.g., switch from LineageOS 20 to ArrowOS or Pixel Experience). Not all GSIs are created equal for the MT6762M chipset.
Conclusion: Success
By following this guide, you have successfully bypassed the limitations of the Samsung Galaxy M02’s locked bootloader and stock recovery. We utilized Odin to inject a Patched VbMeta and a Generic System Image, effectively circumventing the Error 21 verification failure.
This process is advanced and requires patience. The key to success on the M02 is the VbMeta Disabler and the understanding that Fastboot is not an option. Stick to the Odin protocol, keep the stock firmware ready for recovery, and utilize the Magisk Module Repository to fix the inevitable hardware quirks of running a GSI on a budget Samsung device.