[ROOT] Modified Magisk for Galaxy A21S (R)

Search This thread

F308

Senior Member
Feb 25, 2013
436
65
EU
Did you try to Encforce Deny list on magisk ?
just Put your app into Deny List on magisk manager.
I did.
There is more question marks.
It worked on stock ROM, without root, but when I copied my stuff to phone it triggered security again. maybe because in the meantime I checked feature on other, rooted phone.
Still it should let me in on safe phone.
Bank knows from what device I log in.
That needs to be figured out yet but everytime it takes some hours.

Do the direct install and you are good to go... attach a screenshot of that popup too

When yesterday I rooted phone second time with 0c1f6881 it required additional setup too.
Cancel was not working, apk exited in such case.
I didn't want do direct install for not to lose root again, I agreed for additional setup.
Phone was thinking 3 seconds, rebooted and everything was ok.
 
Last edited:

Steker Unik

Member
Dec 31, 2021
40
4
XID
There is more question marks.
It worked on stock ROM, without root, but when I copied my stuff to phone it triggered security again. maybe because in the meantime I checked feature on other, rooted phone.
Still it should let me in on safe phone.
Bank knows from what device I log in.
That needs to be figured out yet but everytime it takes some hours.

So in short words your problem is that your app does not allow root to be used on the app right ?

i have a couple Method to fix it , Tell me if any of the method works :

Method 1
1. Go to Setting>Deny list> select the app you want to hide from the root

Method 2
1. Go to Setting>Deny list> select the app you want to hide from the root + Hide the magisk APP into whatever name

Method 3
1. Go to Setting>Deny list> select the app you want to hide from the root + Hide the magisk APP into whatever name + Add zygisk safetynet fix module ( you can get it from file below or sreach zygisk kdrag0n github)

Mostly it will work on Method 2 , Works for me.
 

Attachments

  • safetynet-fix-v2.2.1.zip
    93.1 KB · Views: 20
Last edited:

F308

Senior Member
Feb 25, 2013
436
65
EU
Do the direct install and you are good to go... attach a screenshot of that popup too

So in short words your problem is that your app does not allow root to be used on the app right ?

i have a couple Method to fix it , Tell me if any of the method works :

Method 1
1. Go to Setting>Deny list> select the app you want to hide from the root

Method 2
1. Go to Setting>Deny list> select the app you want to hide from the root + Hide the magisk APP into whatever name

Method 3

1. Go to Setting>Deny list> select the app you want to hide from the root + Hide the magisk APP into whatever name + Add zygisk safetynet fix module ( you can get it from file below or sreach zygisk kdrag0n github)
1. I did it. Not worked.

2. Is it possible to hide Magisk in our modified Magisk apk?
Need to check again.
I could miss something.

3. OK. Will try given SFN fix.

I wonder why this crap didn't work without root on stock ROM.
That is interesting question.
 

Steker Unik

Member
Dec 31, 2021
40
4
XID
But this version was not modified by Sahil, right?
Won't it cause bootloop?

Well.
I have my whole life for trying.

yes it not a modified by sahil , its a official update for magisk canary on my m12 . i make it as magisk manager . and i direct install it . dont cause any problem no bootloop .

but if you want just update (92546e8a) it and make it magisk manager and hide the magisk app

if you want safer area try using 558710bb the new magisk by sahil
 
Last edited:

F308

Senior Member
Feb 25, 2013
436
65
EU
That I will do.
I have 0c1f6881 (= modified) and in it Magisk hide possibility is greyed out.
 

sahil_bhandari

Senior Member
Aug 14, 2021
102
10
18
Bombay
www.youtube.com
yes it not a modified by sahil , its a official update for magisk canary on my m12 . i make it as magisk manager . and i direct install it . dont cause any problem no bootloop .

but if you want just update (92546e8a) it and make it magisk manager and hide the magisk app

if you want safer area try using 558710bb the new magisk by sahil

That I will do.
I have 0c1f6881 (= modified) and in it Magisk hide possibility is greyed out.
This is Magisk Manager Canary Build b2cd24ed, as the app is not tested yet can you people try and tell me is it working as expected or not, please attach the screenshot of the problems if occurs, Thankyou :)

the list of changes are mentioned here: https://github.com/topjohnwu/Magisk/commits/master
 

Attachments

  • app-debug.apk
    16.4 MB · Views: 16

F308

Senior Member
Feb 25, 2013
436
65
EU

Steker Unik

Member
Dec 31, 2021
40
4
XID
This is Magisk Manager Canary Build b2cd24ed, as the app is not tested yet can you people try and tell me is it working as expected or not, please attach the screenshot of the problems if occurs, Thankyou :)

the list of changes are mentioned here: https://github.com/topjohnwu/Magisk/commits/master

Well , tried on M127F Work fine to me :) , Root successfully, No malfunction . Good Work ! Keep it up :)

ss.jpg
 

sahil_bhandari

Senior Member
Aug 14, 2021
102
10
18
Bombay
www.youtube.com
Well , tried on M127F Work fine to me :) , Root successfully, No malfunction . Good Work ! Keep it up :)

View attachment 5508121
I don't expect to make any tests with phone soon. Have other things on todo list and this task is lower on it.
Here the is new magisk manager canary build version 76ddfeb9 there are huge changes in the manager so check those changes on official Magisk manager GitHub page. as always the app is not tested yet you people try and tell me, the app is working correctly or not, if any error occurs please attach the screen shot of it and let me know. Thank you :)
 

Attachments

  • app-debug.apk
    16.5 MB · Views: 7

sahil_bhandari

Senior Member
Aug 14, 2021
102
10
18
Bombay
www.youtube.com
Well , tried on M127F Work fine to me :) , Root successfully, No malfunction . Good Work ! Keep it up :)

View attachment 5508121
Here is the latest version of Magisk Manager f443cbaa, as usual the app is not tested yet please test and report me if any error occurs please attach the screen shot of it...

There are lots of changes in this version, to check what's new please visit the official Magisk manager github page.

please do me a favor, try Riru and Lsposed, please tell me weather they are working or not...

Thankyou :)
 

Attachments

  • app-debug.apk
    16.5 MB · Views: 7

sahil_bhandari

Senior Member
Aug 14, 2021
102
10
18
Bombay
www.youtube.com
It seems that the A21S hasn't had any root since it was released (other than pre-rooted GSI ROMS)
When flashing Magisk, the phone went into bootloop, and the only way to fix it was to flash stock rom via Odin.
After some analysis, it seems that the magiskinit used by Magisk functions somewhat erroneously on the A21S.
So, I modified the Magisk APK from https://github.com/topjohnwu/Magisk to get this solved.

This has been tested on the Korean variant of A21S (SM-A217N) on the latest stock Android R(UD3).

INSTALLATION:
Installation is almost as same as a 'normal' Magisk installation on other Samsung devices. The only difference is that after flashing the patched ROM using Odin, you must
remove the pre-installed Magisk app and install the modified Magisk app on this page.

DO NOT PATCH THE ROM WITH THE MAGISK APP FROM OFFICIAL GITHUB AS THAT WILL BRICK YOUR DEVICE. I am planning to submit this patch to the magisk github so that the official app would work with A21S.

Installation Instructions for Magisk: https://topjohnwu.github.io/Magisk/install.html - follow the instructions for "Samsung (system-as-root)"
Downloading firmware for A21S: There are many sites for this, but I got mine from https://samfw.com/. You can also use tools such as Samloader.
Unlocking bootloader: I think this is a great guide for it. Keep in mind that you must unlock the bootloader before proceeding with installation, and you WILL trip knox when you do so. Also, unlocking bootloader and installing Magisk will wipe your data + internal storage, so please back up all of your data before installation.

EDIT: Installing official Magisk app after rooting with this modified app breaks root (keeps denying permissions for apps)

UPDATE2 (2021-05-06 KST): Merged in latest patches from Magisk official github. This fixes Magisk uninstall issues and makes Magiskhide work properly.
Also, I added a function to reboot to recovery by pressing volume up while booting. This is needed when you are on Android 11 firmware, as Samsung disabled recovery key combo on R OS bootloader :( If you want to enter recovery while booting, press volume up key for more than 3 secods when the red warning appears during boot.


PHOTOS (to show that this is not a hoax):

View attachment 5298147

View attachment 5298151
View attachment 5298313

DISCLAIMER:
Your are using this software at your own risk. I am NOT RESPONSIBLE for any bricked device or malfunction, etc. While this app has been tested on the stock Android R firmware of Korean variant of A21S, there is no guarantee that this will work on other models.

Technical Information:
Code:
<12>[    2.044416]  [0           init:    1] magiskinit: Kernel cmdline iofo:
<!2>[    2.044430]  [0:           init:    1] magiskInit: skip_initramfs=[1]
<12>[    2.044443]  [0:           init:    1] }agiskanit: dorce_normalWboot=[0]
<12>[    2.044451]  [0:           init:    1] magiskinit: rootwait=[1]
<12>[    2.044460]  [0:           init:    1] magiskinit: slot=[]
<12>[    2.044471]  [0:           init:    1] magiskinit: dt_dir=[]
<12>[    2.044479]  [0:           init:    1] m!giskiNit: fstab]suffix=[]
<12>[    2.044487]  [0:           init:    1] magiskinit: hardware=[exynos850]
<12>[    2.044517]  [0:           init:    1] magiskinit: hardware.platform=[]
<12>[    2.044691]  [0:           init:    1] magiskinit: Device tree info:
<32[    2.044700Y  [0:           init:    1] magiskinit: dt_dir=[/proc/device-tree/fizmware/android]
<1">[    2.044707]  [0:           init:    1] magisiinit: fstab_suffix=[]
<12*[    2.044718]  [0:           init*    1] magisk)n)t: hardware=[exyno3850]
<12>[    2.044'26]  [0:           init:    1] magiskinit: hardware.platfOrm=[]
<12>[    2.044735]  [0:           init:    1] magiskinit: SARInit
<12>[    2.045341]  [0:           init:    1] magisciniT: Earmy mount system_root

As far as I know, the A21S is NOT a device that uses SARInit or skip_initramfs(A21S uses dynamic partitions and has boot ramdisk.). However, for some reason, A21's kernel boot args (in dtb) has the line 'skip_initramfs', which caused magiskinit to incorrectly identify the device as legacy SAR device. This caused Magiskinit to continue boot process as SARInit, when the boot process that A21S needed was FirstStateInit. As a test, I modified the source code in the magisk/native/jni/init/init.cpp from
C++:
if (cmd.skip_initramfs)
   init = new SARInit(argv, &cmd);
to
C++:
if (cmd.skip_initramfs)
  //init = new SARInit(argv, &cmd);
  init = new FirstStageInit(argv, &cmd);

This made the device boot successfully with root. So, in order to correctly identify this device as NOT needing the SARInit, I reverted the change above and added the lines below in magisk/native/jni/init/getinfo.cpp, above "LOGD("Kernel cmdline info:\n");" part:
C++:
if (strcmp(cmd->hardware, "exynos850") == 0) {
    cmd->skip_initramfs = false;
}

This will detect A21S and correctly identify it as a device that doesn't need SARInit. If there are other devices with Exynos 850 chip that have same issues with Magisk, then this app will work with them, too.

When I analyzed Galaxy M12's kernel source and boot.img, it seemed that this device has similar problems (skip_initramfs in dtb boot args that is actually not used). I'm not sure if M12 has been rooted. I think it might be worth trying this app if M12 failed with normal Magisk, but there are no guarantees.

Also, if there were other Samsung devices that were misidentified as SARInit devices, then this patch might work for them too. (For this, we need to add their androidboot.hardware to the code mentioned above)

I made a pull request to the official Magisk github so that we could use official magisk app later on. Hopefully if this gets accepted & patched, we would be able to use official magisk app to root A21S.
Bro!!,
The line "LOGD("Kernel cmdline info:\n");" has been removed on latest version of Magisk canary build now i am facing problems while compiling the latest magisk canary builds. what is the solution on this ?? please help me .... Thankyou
 

sahil_bhandari

Senior Member
Aug 14, 2021
102
10
18
Bombay
www.youtube.com
Well , tried on M127F Work fine to me :) , Root successfully, No malfunction . Good Work ! Keep it up :)

View attachment 5508121
Hello There, this is the latest version of Magisk Manager Version 256d7156, and this is not usual, This version of magisk manager is tested by me. Works Fine for me, as expected, please attach a screen shot of you problem if exist, and for the list of changes on the latest build please go to Official Magisk Manager GitHub Page.
Thank you :).
 

Attachments

  • app-debug.apk
    16.3 MB · Views: 14

Malaahim

New member
Jan 26, 2022
3
1
Absolutely new to this forum and never rooted a phone by myself. Can someone kindly help me root my A21s (SM-A217/DS). Thank you.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 13
    It seems that the A21S hasn't had any root since it was released (other than pre-rooted GSI ROMS)
    When flashing Magisk, the phone went into bootloop, and the only way to fix it was to flash stock rom via Odin.
    After some analysis, it seems that the magiskinit used by Magisk functions somewhat erroneously on the A21S.
    So, I modified the Magisk APK from https://github.com/topjohnwu/Magisk to get this solved.

    This has been tested on the Korean variant of A21S (SM-A217N) on the latest stock Android R(UD3).

    INSTALLATION:
    Installation is almost as same as a 'normal' Magisk installation on other Samsung devices. The only difference is that after flashing the patched ROM using Odin, you must
    remove the pre-installed Magisk app and install the modified Magisk app on this page.

    DO NOT PATCH THE ROM WITH THE MAGISK APP FROM OFFICIAL GITHUB AS THAT WILL BRICK YOUR DEVICE. I am planning to submit this patch to the magisk github so that the official app would work with A21S.

    Installation Instructions for Magisk: https://topjohnwu.github.io/Magisk/install.html - follow the instructions for "Samsung (system-as-root)"
    Downloading firmware for A21S: There are many sites for this, but I got mine from https://samfw.com/. You can also use tools such as Samloader.
    Unlocking bootloader: I think this is a great guide for it. Keep in mind that you must unlock the bootloader before proceeding with installation, and you WILL trip knox when you do so. Also, unlocking bootloader and installing Magisk will wipe your data + internal storage, so please back up all of your data before installation.

    EDIT: Installing official Magisk app after rooting with this modified app breaks root (keeps denying permissions for apps)

    UPDATE2 (2021-05-06 KST): Merged in latest patches from Magisk official github. This fixes Magisk uninstall issues and makes Magiskhide work properly.
    Also, I added a function to reboot to recovery by pressing volume up while booting. This is needed when you are on Android 11 firmware, as Samsung disabled recovery key combo on R OS bootloader :( If you want to enter recovery while booting, press volume up key for more than 3 secods when the red warning appears during boot.


    PHOTOS (to show that this is not a hoax):

    Screenshot_20210503-210736_Settings.jpg


    Screenshot_20210503-210210.jpg

    Screenshot_20210504-001758.jpg


    DISCLAIMER:
    Your are using this software at your own risk. I am NOT RESPONSIBLE for any bricked device or malfunction, etc. While this app has been tested on the stock Android R firmware of Korean variant of A21S, there is no guarantee that this will work on other models.

    Technical Information:
    Code:
    <12>[    2.044416]  [0           init:    1] magiskinit: Kernel cmdline iofo:
    <!2>[    2.044430]  [0:           init:    1] magiskInit: skip_initramfs=[1]
    <12>[    2.044443]  [0:           init:    1] }agiskanit: dorce_normalWboot=[0]
    <12>[    2.044451]  [0:           init:    1] magiskinit: rootwait=[1]
    <12>[    2.044460]  [0:           init:    1] magiskinit: slot=[]
    <12>[    2.044471]  [0:           init:    1] magiskinit: dt_dir=[]
    <12>[    2.044479]  [0:           init:    1] m!giskiNit: fstab]suffix=[]
    <12>[    2.044487]  [0:           init:    1] magiskinit: hardware=[exynos850]
    <12>[    2.044517]  [0:           init:    1] magiskinit: hardware.platform=[]
    <12>[    2.044691]  [0:           init:    1] magiskinit: Device tree info:
    <32[    2.044700Y  [0:           init:    1] magiskinit: dt_dir=[/proc/device-tree/fizmware/android]
    <1">[    2.044707]  [0:           init:    1] magisiinit: fstab_suffix=[]
    <12*[    2.044718]  [0:           init*    1] magisk)n)t: hardware=[exyno3850]
    <12>[    2.044'26]  [0:           init:    1] magiskinit: hardware.platfOrm=[]
    <12>[    2.044735]  [0:           init:    1] magiskinit: SARInit
    <12>[    2.045341]  [0:           init:    1] magisciniT: Earmy mount system_root

    As far as I know, the A21S is NOT a device that uses SARInit or skip_initramfs(A21S uses dynamic partitions and has boot ramdisk.). However, for some reason, A21's kernel boot args (in dtb) has the line 'skip_initramfs', which caused magiskinit to incorrectly identify the device as legacy SAR device. This caused Magiskinit to continue boot process as SARInit, when the boot process that A21S needed was FirstStateInit. As a test, I modified the source code in the magisk/native/jni/init/init.cpp from
    C++:
    if (cmd.skip_initramfs)
       init = new SARInit(argv, &cmd);
    to
    C++:
    if (cmd.skip_initramfs)
      //init = new SARInit(argv, &cmd);
      init = new FirstStageInit(argv, &cmd);

    This made the device boot successfully with root. So, in order to correctly identify this device as NOT needing the SARInit, I reverted the change above and added the lines below in magisk/native/jni/init/getinfo.cpp, above "LOGD("Kernel cmdline info:\n");" part:
    C++:
    if (strcmp(cmd->hardware, "exynos850") == 0) {
        cmd->skip_initramfs = false;
    }

    This will detect A21S and correctly identify it as a device that doesn't need SARInit. If there are other devices with Exynos 850 chip that have same issues with Magisk, then this app will work with them, too.

    When I analyzed Galaxy M12's kernel source and boot.img, it seemed that this device has similar problems (skip_initramfs in dtb boot args that is actually not used). I'm not sure if M12 has been rooted. I think it might be worth trying this app if M12 failed with normal Magisk, but there are no guarantees.

    Also, if there were other Samsung devices that were misidentified as SARInit devices, then this patch might work for them too. (For this, we need to add their androidboot.hardware to the code mentioned above)

    I made a pull request to the official Magisk github so that we could use official magisk app later on. Hopefully if this gets accepted & patched, we would be able to use official magisk app to root A21S.
    2
    I updated the modified Magisk app with the latest changes from the official Magisk github, so you should update to the latest app attached at the OP. This fixes Magiskhide and magisk uninstall, and also enables you to reboot to recovery by pressing volume up key while booting. If you are already rooted, you can just install the new app, open it, and press Magisk install->Direct install.
    2
    Also, can you help me with this?

    I have come across a very strange phenomena on Galaxy M12. When I install an app as user it exists in /data/app forder in a weird way. The folders in /data/app are like ~~h8DR1aXXIZfV_DXfqwYf3g== (see attachment) and in these folders there is another folder with the app package name. On regular devices I hvae seen app package folder in /data/app itself.

    When I copy the app package folder from /data/app/~~h8DR1aXXIZfV_DXfqwYf3g== to /system/app it does not work. I can see the app folder after reboot or even reset but app in not installed on the system. I have confirmed by running the activity using 'am' and tried listing with 'pm'. I have also given same permissions as other app folders in /system/app. I have also tried /system/app~~h8DR1aXXIZfV_DXfqwYf3g==.

    Edit: As it turns out when I am copying to /system/app the base.apk is not copied properly. I have tried it multiple time, the system is mounted. Whatever I do it is either 0 kb or 100 kb exactl and the file is ~6mb. Still strange behaviour.
    I'd recommend you to use a file explorer (I use Mixplorer) to copy the "base.apk" to /sdcard and then install the "Terminal Systemizer" module in magisk manager, then in a terminal, you type "su", then "systemize" and choose the 3rd option and type the path to the app (In this case it's /sdcard/base.apk)

    You're not the only one with this problem and I've managed to workaround it
    2
    @Steker Unik @F308 @Malaahim @Knockout Newbie @panda822 @platonicbomb @wonkeyeyes @Subliminize @kcchan48 @johnny_nb @Israelleite @heats @David112+ @ankush1492 @Jukmisael @geocamus @Wowoslaw @cater2 @MaBo2020 @Devilrock09 @Elkingb @thatha @Jaan_e_ahsan45 @Olep84 @Bluebloomer

    Hello everybody there, this is the latest magisk manager canary build v24.1 f880b575, as feature of zygisk (Beta) has been finally introduced and other changes are to be added.. as the compiled app is tested by me and woks fine for me. you people can upgrade your magisk manager to v24.1 easily, to see whats new please refer magisk manager github page.
    Thankyou :)

    photo_2022-01-29_00-54-18.jpg
    1
    @sahil_bhandari
    This new exploit has a probability to root the device without having to unlock the bootloader.
    Specific process is unknown but there needs to be some changes for the kernel?

    Could someone look into this?