• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!
  • Fill out your device list and let everyone know which phones you have!    Edit Your Device Inventory

How To Guide [Magisk][US/CAN BL Unlock] Root for Galaxy S21 Series (B/N/0/U/U1/W)

Search This thread

denchi80

New member
Apr 23, 2021
1
0
Thanks for all the info provided from this thread.
Bit of a noob to this and trying to get 'adb root' access for a GS21 Ultra (SM-G998N).

I completed the steps to unlock bootloader and flashed patched boot.img which passed on Odin.
Had to factory reset and re-install Magisk app which brought up dialog to complete steps and reboot.

I think all steps make sense at this point, and device shows up after 'adb devices' after enabling USB debugging.
My question is why I can't get root access with 'adb root'? Still get 'adbd cannot run as root in production builds' message.
 

Attachments

  • Screenshot_20210422-200121.jpg
    Screenshot_20210422-200121.jpg
    337.8 KB · Views: 72

Max128

Senior Member
Apr 16, 2011
1,152
298
Canada
I have the model unlockable SM-G9980 ultra, i have rooting it.. and i know how to flash manually a rom with odin.

What I don't know is how to do updates without losing our data every time an ota comes out? And i guess if you want to have the ota back you have to remove the root and that's it?
 

afaneh92

Senior Member
Jul 31, 2012
2,506
4,347
I have the model unlockable SM-G9980 ultra, i have rooting it.. and i know how to flash manually a rom with odin.

What I don't know is how to do updates without losing our data every time an ota comes out? And i guess if you want to have the ota back you have to remove the root and that's it?
Use jrkruse AIO, flash it in USERDATA along with firmware.
 
I have the model unlockable SM-G9980 ultra, i have rooting it.. and i know how to flash manually a rom with odin.

What I don't know is how to do updates without losing our data every time an ota comes out? And i guess if you want to have the ota back you have to remove the root and that's it?
After download OTA update and extracted it, copy AP_XXX file on to you phone and patched it with magisk. After that you need to flash it with Odin.
There are 2 changes to retain root and update Software. First you need to select patched file instead of AP_XXX and second one is to select HOME_CSC instead on CSC.
Voila! You have updated firmware with root access and without any loss of data.
 

Max128

Senior Member
Apr 16, 2011
1,152
298
Canada
Use jrkruse AIO, flash it in USERDATA along with firmware.

After download OTA update and extracted it, copy AP_XXX file on to you phone and patched it with magisk. After that you need to flash it with Odin.
There are 2 changes to retain root and update Software. First you need to select patched file instead of AP_XXX and second one is to select HOME_CSC instead on CSC.
Voila! You have updated firmware with root access and without any loss of data.

Great ! Thanks for your answers. I have a few last questions that I have not really found precise answers yet.

So I know the root trip knox but except samsung pay and secure folder are there other things that no longer work? This is not a big deal for me i am not using that.

Last question, I already known for a long time that the root breaks ota update and for getting ota back you need to unroot completely the phone and having the stock rom.
Is it still the same way on Samsung phones with a bootloader unlocked?
 
Last edited:
Great ! Thanks for your answers. I have a few last questions that I have not really found precise answers yet.

So I know the root trip knox but except samsung pay and secure folder are there other things that no longer work? This is not a big deal for me i am not using that.

Last question, I already known for a long time that the root breaks ota update and for getting ota back you need to unroot completely the phone and having the stock rom.
Is it still the same way on Samsung phones with a bootloader unlocked?
Yes I think, You need to flash Stock OS with ODIN and simple lock bootloader via fastboot.

I haven't tried yet for Samsung Phone so i can't say much about it.
 

afaneh92

Senior Member
Jul 31, 2012
2,506
4,347
Normally i am using fastboot too for my other devices of another brand.

Can you tell us how to re-lock the bootloader ? and the ota updates will work that way again right?? Just wanted to know it, if someday i need to do it or someone else here. Thanks!
Same procedure as unlock. Reboot to download mode and hold vol up, this may require flashing stock firmware.
 

Max128

Senior Member
Apr 16, 2011
1,152
298
Canada
Same procedure as unlock. Reboot to download mode and hold vol up, this may require flashing stock firmware.

And What about the ota? When you lock the bootloader again you can install ota again right?

I only ask for knowing because.. Samsung looks different, some others brand I have used it was not necessary to lock the bootloader again so that I could install an ota again.

Thanks!
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Hey thanks for this! but here's a noob question. Is the Patching Boot Image an added step or an alternative to the Patching AP step from the original instructions from topjohnwu?
    Alternative to the Patching AP
    1
    Is there a fix for CTS Profile - "failed" in SafetyNet test (after ROOT/Magisk) for S21 Ultra?
    Universal SafetyNet Fix module in Magisk
    1
    Is there a fix for CTS Profile - "failed" in SafetyNet test (after ROOT/Magisk) for S21 Ultra?
  • 25
    Note: this guide copied from topjohnwu's. Original guide here

    US/Canada bootloader unlock thread:
    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:


    device_info.png


    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
    4
    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)?
    3
    US/Canada devices has no oem unlock toggle!
    Unlock service here

    How to get OEM Unlock option back for Non US/Canada device?
    1. Open the Settings app. Tap on General Management → Date and time.
    2. Use the toggle button to disable Automatic date and time.
    3. Set date option will be enabled now. Tap on it, and set the date to about 10-20 days earlier.
    4. Enable developer options.
    4.a Go to your device Settings.
    4.b Select ‘About phone’ » tap seven times on ‘Build number’.
    └ This will enable Developer options under Settings.
    4.c Go back to Settings » scroll down to the bottom and you’ll see Developer options menu.
    5. Open developer options (in the Settings app itself), and find the option called ‘Auto update system‘. Use the toggle button to disable it.
    6. Now, go back to the main screen of Setting, and then tap on Software update.
    7. Disable the option ‘Download updates automatically‘.
    8. Tap on ‘Download updates manually‘ option, but it will give you an error because of the wrong date, so it’s fine.
    9. Restart the device.
    10. Go to Settings > Developer options. The OEM unlock option should be enabled now.
    3
    Thanks, but that doesn't apply to the S21 :coffee:
    Use latest magisk canary, I have rooted my S21 Ultra.
    2
    I assume this will trip Knox right?
    Read the very first bullet, lol