How To Guide [Magisk] Root for the Galaxy S21 Series (B/N/0 models only)

afaneh92

Senior Member
Jul 31, 2012
2,175
4,082
203
Note: this guide copied from topjohnwu's. Original guide here

Before Installing Magisk
  • Installing Magisk WILL trip KNOX
  • Unlocking bootloader for the first time will do a data wipe.
Installation

If you already have Magisk installed, it is strongly recommended to upgrade directly via Magisk Manager using the “Direct Install” method. The following tutorial is only for initial installation.

Getting Started

Before you start:
  • This tutorial assumes you understand how to use adb and fastboot
  • Your device’s bootloader has to be unlocked
  • Make sure to remove any “boot image mods” such as other root solutions before installing Magisk. The easiest way is to restore the boot image with factory images, or reflash a non-prerooted custom ROM
  • If you plan to also install custom kernels, install it after Magisk
Download and install the latest Canary Magisk Manager (may have problems but the only one working for now.. We use the app to gather some information about your device. In the home screen, you should see this:




Pay special attention to the Ramdisk info. If the result is Yes, congratulations, your device is perfect for installing Magisk! However, if the result is No this means your device’s boot partition does NOT include ramdisk. This means you will have to go through some extra steps to make Magisk work properly.

Unlocking Bootloader

Unlocking BL on modern Samsung devices have some caveats, so I figure this would be helpful.
  • Allow bootloader unlocking in Developer options → OEM unlocking
  • Reboot to download mode: power off your device and press the download mode key combo for your device (Vol Down + Vol Up) while connected to usb.
  • Long press volume up to unlock the bootloader. This will wipe your data and automatically reboot.

If you think the bootloader is fully unlocked, it is actually not! Samsung introduced VaultKeeper, meaning the bootloader will still reject any unofficial partitions before VaultKeeper explicitly allows it.
  • Go through the initial setup. Skip through all the steps since data will be wiped again later when we are installing Magisk. Connect the device to Internet during the setup.
  • Enable developer options, and confirm that the OEM unlocking option exists and is grayed out. This means the VaultKeeper service has unleashed the bootloader.
  • Your bootloader now accepts unofficial images in download mode.

Patching Boot Image

If your device has boot ramdisk, you need a copy of the boot.img

Instructions
  • Use either Frija or Samloader to download the latest firmware zip of your device directly from Samsung servers.
  • Unzip the boot.img from AP and copy the file to your device.
  • Press the Install button in the Magisk card
  • Choose “Select and Patch a File” in method, and select the stock boot image
  • Magisk Manager will patch the image to [Internal Storage]/Download/magisk_patched.img.
  • Copy the patched image to your PC
  • Flash the patched boot image to your device.
    For most devices, reboot into fastboot mode and flash with command:
    fastboot flash boot /path/to/magisk_patched.img or
    Rename magisk_patched.img to boot.img and use 7zip to make flashable tar of your boot.img
    Reboot to download mode. Open Odin on your PC, and flash boot_patched.tar as AP.
  • Reboot and voila!

Patching AP

Instructions
  • Use either Frija or Samloader to download the latest firmware zip of your device directly from Samsung servers.
  • Unzip the firmware and copy the AP tar file to your device. It is normally named as AP_[device_model_sw_ver].tar.md5
  • Press the Install button in the Magisk card
  • Choose “Select and Patch a File” in method, and select the AP tar file
  • Magisk Manager will patch the whole firmware file to [Internal Storage]/Download/magisk_patched.tar
  • Copy the patched tar file to your PC with ADB:
    adb pull /sdcard/Download/magisk_patched.tar
    Do NOT use MTP as it is reported to corrupt files.
  • Reboot to download mode. Open Odin on your PC, and flash magisk_patched.tar as AP, together with BL, CP, and CSC (NOT HOME_CSC because we want to wipe data) from the original firmware. This may take some time (>10 mins).
  • After Odin is done, your device should reboot. You may continue with standard initial setup.
    If you are stuck in a bootloop, agree to do a factory reset if promted.
  • Although Magisk is installed, it still need some additional setup. Please connect to the Internet.
  • Install the latest Magisk Manager and open the app. It should show a dialog asking for additional setups. Let it do its job and the app will automatically reboot your device.
  • Voila! Enjoy Magisk 😃
Thanks
@topjohnwu for magisk and guide, If you appreciate his effort, show some love and support :)

Donations
https://www.patreon.com/topjohnwu
https://www.paypal.me/topjohnwu
 
Last edited:

Didgeridoohan

Forum Moderator / Developer Relations
Staff member
May 31, 2012
11,207
11,222
263
Gothenburg
The latest Magisk Canary release (21409) contains the fix needed for the S21 devices, yes (but being a Canary release there are of course other bugs).

But, @afaneh92, since you're just copying @topjohnwu's installation instructions exactly, word for word, wouldn't it just have been easier to link to those instructions and let people know that Magisk Canary releases now can root the S21 Ultra (and maybe also warn people that the Canaries can be buggy)?
 

afaneh92

Senior Member
Jul 31, 2012
2,175
4,082
203
The latest Magisk Canary release (21409) contains the fix needed for the S21 devices, yes (but being a Canary release there are of course other bugs).

But, @afaneh92, since you're just copying @topjohnwu's installation instructions exactly, word for word, wouldn't it just have been easier to link to those instructions and let people know that Magisk Canary releases now can root the S21 Ultra (and maybe also warn people that the Canaries can be buggy)?
Its not just a copy and paste! I have edited the the guide to suit our S21 series.
 

Didgeridoohan

Forum Moderator / Developer Relations
Staff member
May 31, 2012
11,207
11,222
263
Gothenburg
Its not just a copy and paste! I have edited the the guide to suit our S21 series.
Edited?

These few lines are the only things that do not exactly match John's instructions:
  • Unzip the boot.img from AP and copy the file to your device.
  • <Copy of John's flashing boot image instructions>
  • Rename magisk_patched.img to boot.img and use 7zip to make flashable tar of your boot.img
  • Reboot to download mode. Open Odin on your PC, and flash boot_patched.tar as AP.
99% of that 1st post is a copy-paste... You should know the rules on this forum. Copying others work, even text, without proper credits is a no-no.

And no: a small "thanks for the guide" isn't proper credits. Be transparent with where you copy stuff from.
 

afaneh92

Senior Member
Jul 31, 2012
2,175
4,082
203
Edited?

These few lines are the only things that do not exactly match John's instructions:
  • Unzip the boot.img from AP and copy the file to your device.
  • <Copy of John's flashing boot image instructions>
  • Rename magisk_patched.img to boot.img and use 7zip to make flashable tar of your boot.img
  • Reboot to download mode. Open Odin on your PC, and flash boot_patched.tar as AP.
99% of that 1st post is a copy-paste... You should know the rules on this forum. Copying others work, even text, without proper credits is a no-no.

And no: a small "thanks for the guide" isn't proper credits. Be transparent with where you copy stuff from.
Also removed unnecessary instructions!
Thanks for clarification, I will add link to topjohnwu guide and donations
 
Last edited:

chenjingyuan98

New member
Feb 8, 2021
3
0
11
Work hard and I succeeded. Thanks again to the author

Mod Edit : English only !

Google translation :

Work hard and I succeeded. Thanks again to the author,
 
Last edited:

NuLuumo

New member
Dec 1, 2015
1
0
21
White River Junction
I recently got a Samsung S21 Ultra 5G from Verizon. I live in the US, and I have read online that the US variants are more difficult to root. The model is SM-G998U, with Snapdragon.

The serial number is R3CR106XBXT, if that helps at all.

The main issue I've been facing is unlocking the bootloader -- it doesn't seem to show up in the Developer Options menu, unfortunately. I am able to enter recovery mode but selecting the option to boot into the bootloader only restarts the phone.

I am able to use ADB in the command prompt, as it detects the phone fine when checking 'adb devices'.

I have tried doing 'adb reboot bootloader' but it only does the same as trying it from recovery mode.

The only other 'mode' that works is Samsung's Download mode' which I think only works with Odin.

Trying 'fastboot devices' during this screen yields no results.

Am I out of luck for trying to get this device rooted?

Thank you!
 

Burt Squirtz

Senior Member
Feb 11, 2018
293
83
28
I recently got a Samsung S21 Ultra 5G from Verizon. I live in the US, and I have read online that the US variants are more difficult to root. The model is SM-G998U, with Snapdragon.

The serial number is R3CR106XBXT, if that helps at all.

The main issue I've been facing is unlocking the bootloader -- it doesn't seem to show up in the Developer Options menu, unfortunately. I am able to enter recovery mode but selecting the option to boot into the bootloader only restarts the phone.

I am able to use ADB in the command prompt, as it detects the phone fine when checking 'adb devices'.

I have tried doing 'adb reboot bootloader' but it only does the same as trying it from recovery mode.

The only other 'mode' that works is Samsung's Download mode' which I think only works with Odin.

Trying 'fastboot devices' during this screen yields no results.

Am I out of luck for trying to get this device rooted?

Thank you!
this is exactly what I'm encountering as well. I have the US unlocked version of the s21 ultra. Incredibly annoying - as there's no OEM unlocking option under Dev options. I tried the 'set the date back 7 Days' trick that supposedly makes work. It does absolutely nothing.

I'm dangerously close to returning this phone and going back to my OnePlus 8 pro which was overall much better experience. The 8 pro had way better touch response, much more beautiful screen, and was completely rootable and able to have ROMs.
 

afaneh92

Senior Member
Jul 31, 2012
2,175
4,082
203
I recently got a Samsung S21 Ultra 5G from Verizon. I live in the US, and I have read online that the US variants are more difficult to root. The model is SM-G998U, with Snapdragon.

The serial number is R3CR106XBXT, if that helps at all.

The main issue I've been facing is unlocking the bootloader -- it doesn't seem to show up in the Developer Options menu, unfortunately. I am able to enter recovery mode but selecting the option to boot into the bootloader only restarts the phone.

I am able to use ADB in the command prompt, as it detects the phone fine when checking 'adb devices'.

I have tried doing 'adb reboot bootloader' but it only does the same as trying it from recovery mode.

The only other 'mode' that works is Samsung's Download mode' which I think only works with Odin.

Trying 'fastboot devices' during this screen yields no results.

Am I out of luck for trying to get this device rooted?

Thank you!
This guide for unlockable bootloader devices, B/N/0 models
 
  • Like
Reactions: chenjingyuan98

Didgeridoohan

Forum Moderator / Developer Relations
Staff member
May 31, 2012
11,207
11,222
263
Gothenburg
@afaneh92 By the way, I'm curious: Why have you added the "Patch boot image" section? John's original Samsung instructions only include patching the AP, so I was wondering why you have this section in your text... From what I can see, users are reporting that John's original instructions work just as they should on the S21 devices (as long as you use releases from 21409 onwards).