Root possibility?

1atom1

Member
Dec 4, 2020
7
0
1
Root for Samsung a21s

Root your Samsung a21s with this method.
You can't use Magisk or the Stock ROM/Firmware with this method, instead you will use SuperSu and a customized pre-rooted ROM/GSI. For this, you need to backup all your data eventually. For now that's the only way to get this phone rooted. For more information about GSI click here.

UPDATE:
Now you can root your phone flashing this GSI with Odin. So no need to do the tutorial. It will install a pre-rooted AOSP GSI on your phone.
If you already flashed the Android 11 GSI and want to downgrade, unfortunately you need to wipe your data. But if you already this Android 10 GSI and want to update to 11 you don't need to wipe your data.

Downloads:
Android 10 AOSP pre-rooted (Android 10 is highly recommended because it's more stable and faster.) (Download Screenshots)
Android 11 AOSP pre-rooted

Root Confirmations.
https://forum.xda-developers.com/showpost.php?p=83929761&postcount=62 > Theqtest
https://forum.xda-developers.com/showpost.php?p=83931905&postcount=69 > Eklipz3
https://forum.xda-developers.com/showpost.php?p=83940297&postcount=80 > PamelaGirl
thenks for sharing your confirmations.

Follow this tutorial to flash any GSI ROM on your A21s using fastboot. If you are stock on fastboot (can't boot to bootloader) you need to follow the below tutorial or flash the super.tar above.


Backup all your data.
Requirements:

1. Virtual Box
2. Linux ISO (Mint or Ubuntu)
3. 7-Zip ZS Installer
4. Simg2img : thenks MrWaehere
5. Unlock your bootloader
6. GSI Android 10 A/B Gapps : Download only arm64, A/B GSIs.
Choose any ROM. Some does not work, so I recommend to use the Official Android 10 or 11.
Android 10 AOSP 10.0 v222 "system-quack-arm64-ab-gapps.img.xz" with Gapps. (USB does not work on this ROM, only ADB)
7. Odin

Download all the required files and tools Samsung_A21s.zip.
Don't forget to install 7-Zip ZS.

Sharing a folder from Windows to Linux

Fist you need to use both Windows and Linux using Virtual Box and share a folder from Windows to Linux.
Install Linux on Virtual Box following this tutorial and open the Terminal Win + T and run this code. Recommended Linux Mint.

Installing VirtualBox Guest Additions
Code:
sudo su root
Type your Password.
Code:
apt install build-essential dkms
Type Y and wait downloading...
Code:
mount /dev/cdrom /media/cdrom
Code:
cd /media/YOURUSERNAME/VBox_GAs_6.1.16
Code:
./VBoxLinuxAdditions.run
This will install the "VirtualBox Guest Additions" on your Linux, so without it we can't share the folders.

Type :
Code:
adduser YOURUSERNAME vboxsf
And reboot your Linux.

Create a folder on your Windows Desktop called "Samsung".
At the top bar of your Virtual Box click Devices and Shared Folders > Shared Folders Settings, then click the plus icon, select and add your Samsung folder, enable Auto-mount, click OK and close.
A drive will be mounted on your Linux as "sf_Samsung".
Now Save the state of your Linux. (Exitting)

File extraction

Download your stock ROM and extract the super.img.lz4 file from AP_A217XXXXXXXXXX_XXX_XXXX_REV00_user_low_ship_MULTI_CERT_meta_RKEY_OS10.tar.md5 with 7-Zip ZS.
Extract the "super.img.lz4" using the 7-ZIP ZS and copy the original super.img to your Samsung folder.

Extract all files from A21_Samsung.zip to your Samsung folder including your "AOSP ROM .IMG".

Convert super.img to raw

Open CMD Win + X, and select Command Prompt (Admin) or press A.
Type:
Code:
cd C:\Users\%USERNAME%\Desktop\Samsung
.
then:
Code:
simg2img super.img super.raw
.
Wait.
Move the super.raw to Samsung_Files folder.

Extracting super.raw

Now Start your Virtual Linux, open Terminal Win + T and type:
Code:
sudo su root
Code:
cd /media/sf_Samsung/System_Files
Code:
./lpunpack --slot=0 super.raw /media/sf_Samsung/System_Files
Wait the extraction and switch to your Windows.

Getting all the bytes from files and creating a modified super.img

Verify if the folder System_Files has this 4 files odm.img, system.img, vendor.img and product.img. Delete the product.img, we don't need it.
Rename your orginal System.img to Original_System.img, and rename your extracted AOSP ROM to System.img then move it to System_Files folder. We will switch the system.img.
Right click on each file > Properties, and copy all sizes in bytes of the original super.img, odm.img, Original_System.img and vendor.img. We don't need the AOSP ROM bytes.

Example:
--device super: super.img : 5557452800
--image system= Original_System.img : 3340271616
--image vendor= vendor.img : 474976256
--image odm= odm.img : 4349952

Calculate your Original_System.img bytes + vendor.img bytes + odm,img bytes.
(3340271616 + 474976256) + 4349952 = 3819597824 . And replace the bytes below "3819597824" with your result.

You need to update the below code with the actual sizes in bytes of your files.

Update the bytes and run

Code:
./lpmake --metadata-size 65536 --super-name super --metadata-slots 2 --device super:5557452800 --group main:3819597824 --partition system:readonly:3340271616:main --image system=./system.img --partition vendor:readonly:474976256:main --image vendor=./vendor.img --partition odm:readonly:4349952:main --image odm=./odm.img --sparse --output ./super.img
Flash the modified boot.tar, and the 2 vbmeta.tar via Odin inside of "Flash it" folder, reboot and boot to the Download Mode again. If bootloop flash only the boot.tar and flash the stock vbmeta downloading here.
Use 7-Zip to archive the new super.img to .tar, flash it via Odin (AP), wait your phone restarts.

That's it have fun.

Notes

I not an expert on this, I just sharing my research I found on the Internet that worked for me. I not responsible for any damage on your phone. It does not stuck or phone, if anything occurs just flash your stock regional ROM through Odin.

If this tutorial did not work, you did something wrong or your phone is not supported.
"Anyway until there is no TWRP or Magisk for this phone you can use it as an alternative.
And I'm sorry for my English. If you don't understood please search for "./lpmake --metadata-size 65536" on the Internet, and you'll find out more tutorials like it but not about for this phone, use it as reference.
It worked thanks but SuperSu is not trusted and I would rather magisk because of the modules is it possible they may have patched the bug the patched the bootloop problem I had when I patched the stock A21s firmware with magisk read changelog for v20 I just want the modules from magisk if you can develop a method for magisk even if it isn't stock rom I would still appreciate it thanks
 

i_am_fresco

Member
Feb 7, 2015
45
6
33
not working for me on A217M, red words sayin: obl images bla bla bla. Maybe A217M boot with supersu? How to modify my own boot.img file? Any guide or help?
 
Last edited:

Jokke73

New member
Dec 26, 2020
3
1
3
Hi all

I was able to succesfully root my A21S with the AOSP image of wer99 ( Big thanks for the work and the explanation on how to do it!! :D ) but I was wondering if there is any progress on rooting the stock image with Magisk or the AOSP image with Magisk. I am used to use this one and would like to give it a try. Or can I hide root with the SuperSU installed? (hiding root is needed for some apps like Pokemon Go :D )

Any tests I can do?

I am struggling with the TWRP not seeing the zipfiles I have on my SD card :-(
 
Last edited:

Jokke73

New member
Dec 26, 2020
3
1
3
not working for me on A217M, red words sayin: obl images bla bla bla. Maybe A217M boot with supersu? How to modify my own boot.img file? Any guide or help?
Hi

Just flash stock rom to your device, then flash the Android 10 AOSP prerooted image (https://forum.xda-developers.com/t/root-possibility.4130739/post-83915657) to your device using Odin, make sure you wipe your data (but first make a backup if you need your data of course ;-) ), and then you can boot in this rooted version, works like a charm, thanks to Wer99 :D
 
Last edited:
  • Like
Reactions: i_am_fresco

Jokke73

New member
Dec 26, 2020
3
1
3
Theoretically, could this prerooted AOSP image also work on an A21 (not A21s)?
I am not an expert (at all) but I think the base stock image of the A21 is different so I think you should rebuild the super.img with your own stock vendor and odm.img files and then flash it. I tried to rebuild the image with Lineage 17.1 and that works as well on the A21S. It's a pity that TWRP / Magisk is still not available though
 

i_am_fresco

Member
Feb 7, 2015
45
6
33
Root for Samsung a21s

Root your Samsung a21s with this method.
You can't use Magisk or the Stock ROM/Firmware with this method, instead you will use SuperSu and a customized pre-rooted ROM/GSI. For this, you need to backup all your data eventually. For now that's the only way to get this phone rooted. For more information about GSI click here.

UPDATE:
Now you can root your phone flashing this GSI with Odin. So no need to do the tutorial. It will install a pre-rooted AOSP GSI on your phone.
If you already flashed the Android 11 GSI and want to downgrade, unfortunately you need to wipe your data. But if you already this Android 10 GSI and want to update to 11 you don't need to wipe your data.
Dude, I alredy booted my Samsung stock rom with your modded boot but SU is not available for root checker or from shell commands. Any help or suggestion? How to preroot a stock super.img?