• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[ROOT] Modified Magisk for Galaxy A21S (R)

Search This thread
Aug 14, 2021
21
2
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.

Can you please Teach me How you managed to compile the app after modifying the 2 files, because I am using windows 11 and the file called 'build.py' is showing errors on running and I did the same thing with android studio, I opened the android studio and it shows error upon run.

Here are the errors I am getting:

This one is build.py error:

PS E:\Users\sahil\Desktop\Magisk-23.0> python build.py -r
Traceback (most recent call last):
File "E:\Users\sahil\Desktop\Magisk-23.0\build.py", line 498, in <module>
load_config(args)
File "E:\Users\sahil\Desktop\Magisk-23.0\build.py", line 156, in load_config
commit_hash = cmd_out(['git', 'rev-parse', '--short=8', 'HEAD'])
File "E:\Users\sahil\Desktop\Magisk-23.0\build.py", line 132, in cmd_out
return subprocess.check_output(cmd).strip().decode('utf-8')
File "D:\Program Files\Python39\lib\subprocess.py", line 424, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "D:\Program Files\Python39\lib\subprocess.py", line 505, in run
with Popen(*popenargs, **kwargs) as process:
File "D:\Program Files\Python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "D:\Program Files\Python39\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
PS E:\Users\sahil\Desktop\Magisk-23.0>


and this one is android studio error:

Build file 'E:\Users\sahil\Desktop\Magisk-23.0\build.gradle.kts' line: 3

An exception occurred applying plugin request [id: 'MagiskPlugin']
> Failed to apply plugin 'MagiskPlugin'.
> repo.refDatabase.exactRef("HEAD") must not be null

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.plugins.InvalidPluginException: An exception occurred applying plugin request [id: 'MagiskPlugin']
at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.exceptionOccurred(DefaultPluginRequestApplicator.java:207)
at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugin(DefaultPluginRequestApplicator.java:189)
at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.lambda$applyPlugins$1(DefaultPluginRequestApplicator.java:127)
at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugins(DefaultPluginRequestApplicator.java:127)
at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugins(DefaultPluginRequestApplicator.java:123)
at org.gradle.kotlin.dsl.provider.PluginRequestsHandler.handle(PluginRequestsHandler.kt:48)
at org.gradle.kotlin.dsl.provider.StandardKotlinScriptEvaluator$InterpreterHost.applyPluginsTo(KotlinScriptEvaluator.kt:192)
at org.gradle.kotlin.dsl.execution.Interpreter$ProgramHost.applyPluginsTo(Interpreter.kt:373)
at Program.execute(Unknown Source)
at org.gradle.kotlin.dsl.execution.Interpreter$ProgramHost.eval(Interpreter.kt:506)
at org.gradle.kotlin.dsl.execution.Interpreter.eval(Interpreter.kt:179)
at org.gradle.kotlin.dsl.provider.StandardKotlinScriptEvaluator.evaluate(KotlinScriptEvaluator.kt:113)
at org.gradle.kotlin.dsl.provider.KotlinScriptPluginFactory$create$1.invoke(KotlinScriptPluginFactory.kt:51)
at org.gradle.kotlin.dsl.provider.KotlinScriptPluginFactory$create$1.invoke(KotlinScriptPluginFactory.kt:36)
at org.gradle.kotlin.dsl.provider.KotlinScriptPlugin.apply(KotlinScriptPlugin.kt:34)
at org.gradle.configuration.BuildOperationScriptPlugin$1.run(BuildOperationScriptPlugin.java:65)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
at org.gradle.configuration.BuildOperationScriptPlugin.lambda$apply$0(BuildOperationScriptPlugin.java:62)
at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:43)
at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:62)
at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.lambda$applyToMutableState$0(DefaultProjectStateRegistry.java:250)
at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.fromMutableState(DefaultProjectStateRegistry.java:277)
at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.applyToMutableState(DefaultProjectStateRegistry.java:249)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:42)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:35)
at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject.lambda$run$0(LifecycleProjectEvaluator.java:100)
at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.lambda$applyToMutableState$0(DefaultProjectStateRegistry.java:250)
at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.lambda$withProjectLock$3(DefaultProjectStateRegistry.java:310)
at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:213)
at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withProjectLock(DefaultProjectStateRegistry.java:310)
at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.fromMutableState(DefaultProjectStateRegistry.java:291)
at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.applyToMutableState(DefaultProjectStateRegistry.java:249)
at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject.run(LifecycleProjectEvaluator.java:91)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:63)
at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:723)
at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:150)
at org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:41)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:67)
at org.gradle.configuration.DefaultProjectsPreparer.prepareProjects(DefaultProjectsPreparer.java:46)
at org.gradle.configuration.BuildTreePreparingProjectsPreparer.prepareProjects(BuildTreePreparingProjectsPreparer.java:64)
at org.gradle.configuration.BuildOperationFiringProjectsPreparer$ConfigureBuild.run(BuildOperationFiringProjectsPreparer.java:52)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
at org.gradle.configuration.BuildOperationFiringProjectsPreparer.prepareProjects(BuildOperationFiringProjectsPreparer.java:40)
at org.gradle.initialization.DefaultGradleLauncher.prepareProjects(DefaultGradleLauncher.java:226)
at org.gradle.initialization.DefaultGradleLauncher.doClassicBuildStages(DefaultGradleLauncher.java:164)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:125)
at org.gradle.internal.invocation.GradleBuildController$1.create(GradleBuildController.java:71)
at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:213)
at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:67)
at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:56)
at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:56)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:66)
at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
at org.gradle.tooling.internal.provider.FileSystemWatchingBuildActionRunner.run(FileSystemWatchingBuildActionRunner.java:90)
at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:41)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:49)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:44)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:44)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.lambda$execute$0(InProcessBuildActionExecuter.java:59)
at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:58)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
at org.gradle.launcher.exec.BuildTreeScopeLifecycleBuildActionExecuter.lambda$execute$0(BuildTreeScopeLifecycleBuildActionExecuter.java:34)
at org.gradle.internal.buildtree.BuildTreeState.run(BuildTreeState.java:53)
at org.gradle.launcher.exec.BuildTreeScopeLifecycleBuildActionExecuter.execute(BuildTreeScopeLifecycleBuildActionExecuter.java:33)
at org.gradle.launcher.exec.BuildTreeScopeLifecycleBuildActionExecuter.execute(BuildTreeScopeLifecycleBuildActionExecuter.java:28)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:104)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:55)
at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:64)
at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:37)
at org.gradle.tooling.internal.provider.SessionScopeLifecycleBuildActionExecuter.lambda$execute$0(SessionScopeLifecycleBuildActionExecuter.java:54)
at org.gradle.internal.session.BuildSessionState.run(BuildSessionState.java:67)
at org.gradle.tooling.internal.provider.SessionScopeLifecycleBuildActionExecuter.execute(SessionScopeLifecycleBuildActionExecuter.java:50)
at org.gradle.tooling.internal.provider.SessionScopeLifecycleBuildActionExecuter.execute(SessionScopeLifecycleBuildActionExecuter.java:36)
at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:59)
at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:31)
at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:58)
at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:42)
at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:47)
at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:31)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:65)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:39)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:29)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:35)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:78)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:75)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:75)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:63)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:84)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:52)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin 'MagiskPlugin'.
at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:163)
at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:127)
at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.lambda$applyPlugins$0(DefaultPluginRequestApplicator.java:129)
at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugin(DefaultPluginRequestApplicator.java:185)
... 149 more
Caused by: java.lang.NullPointerException: repo.refDatabase.exactRef("HEAD") must not be null
at MagiskPlugin.applyPlugin(BuildSource.kt:37)
at MagiskPlugin.apply(BuildSource.kt:26)
at MagiskPlugin.apply(BuildSource.kt:25)
at org.gradle.api.internal.plugins.ImperativeOnlyPluginTarget.applyImperative(ImperativeOnlyPluginTarget.java:43)
at org.gradle.api.internal.plugins.RuleBasedPluginTarget.applyImperative(RuleBasedPluginTarget.java:51)
at org.gradle.api.internal.plugins.DefaultPluginManager.addPlugin(DefaultPluginManager.java:177)
at org.gradle.api.internal.plugins.DefaultPluginManager.access$100(DefaultPluginManager.java:51)
at org.gradle.api.internal.plugins.DefaultPluginManager$AddPluginBuildOperation.run(DefaultPluginManager.java:272)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
at org.gradle.api.internal.plugins.DefaultPluginManager.lambda$doApply$0(DefaultPluginManager.java:157)
at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:43)
at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:156)
... 152 more

Can you sort this errors out please Help me i am new to this :p
 

platonicbomb

New member
Sep 15, 2021
4
0
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.
Would you be willing to walk me through this via Zoom for a fee? It would be my first time rooting a phone. My goal is to set the phone up as a VPN router (it needs to receive wifi connection in India and broadcast it via hotspot as if the signal is from the USA).
 
Aug 14, 2021
21
2
Would you be willing to walk me through this via Zoom for a fee? It would be my first time rooting a phone. My goal is to set the phone up as a VPN router (it needs to receive wifi connection in India and broadcast it via hotspot as if the signal is from the USA).
do you own a server from USA for vpn service, btw i am Indian too, tum chaho toh mujh se hindi mai baat kar sakte ho
 

kcchan48

Member
Jul 11, 2007
17
4
Tested this on my Samsung A21s following OP steps. Works without issues. Summary of steps I did (in order):
  1. Download the Samsung Firmware Downloader.exe (v0.5.2) Zachary Wander based on Samloader
    I downloaded the ready-to-run exe Windows version.
    Note: When launching on Windows 10 PC, received a pop-up error 'The os does not support: 'Taskbar.setIconImage' . I ignored this error.
  2. In this app,
    for Model: SM-A217F (retrieved from Settings > About phone > Model number
    for Region: XSA (retrieved from Settings > About phone > Software information >Service provider software version
  3. Click the "Check for Updates" button, it will provide you with the latest Firmware version eg.
    A217FXXS7CUI3/A217FOLM7CUI3/A217FXXS7CUI3/A217FXXS7CUI3
  4. Click the "Download" button to download the firmware to your PC
  5. This will download an encrypted version of the firmware to your PC and automatically decrypt it to a zip file eg.
    SM-A217F_1_20210915175645_mbisbo1d5k_fac_A217FXXS7CUI3_A217FOLM7CUI3_A217FXXS7CUI3_A217FXXS7CUI3_XSA.zip
  6. Next download the modified verson of Magisk for the A21s at the start of this thread eg.
    Magisk_patched_for_A21S.apk
  7. Magisk is used to patch the firmware to enable root. This will void your warranty and you will have to put up with warnings every time to power off/on your phone eg.
    "The phone is not running Samsung's official software...."
  8. Installing Magisk will cause a full data wipe of your phone. So make sure you do a full backup of your phone using Samsung Smart Switch app running on your PC. In addition, I also use File Transfer to copy important folders/files on my phone directly to my PC hard disk. Note: not all applications will have their data restored successfully so you need to make sure you can reinstall and configure those applications eg. Google Authenticator
  9. The next software you need to download is Odin which runs on Winodws. Search online for it. I downloaded and used this version:
    Odin3_v3.14.1.zip
  10. Odin is used to load the custom firmware back onto the phone.
  11. At this stage, you have not made any changes to your phone. But you have now got all the software needed in place to root your phone. Once you proceed with the next step, your phone will no longer be running the official Samsung software and you will be reminded of this every time you power on/off your phone. Also, you may not be able to update the Samsung software using the Software Update option.
  12. Read through the steps in the section "Samsung (System-as-root)" on how to install Magisk to your phone
    DO NOT PROCEED WITH THE "Unlocking Bootloader" step IF ARE NOT COMFORTABLE WITH THE INSTRUCTIONS THERE.
  13. Tip: While it is stated in the instructions, the following step may not be clear:
    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.
    You need to unzip the BL, CP and CSC files from the downloaded firmware zip file as well to use in this step.
I decided to root my phone just to get the Axet Call Recorder function to work correctly under Magisk. Which it did after I installed Magisk but the Wifi Calling had to be turned off.
 

Subliminize

Member
Oct 21, 2021
6
0
baguio
Tested this on my Samsung A21s following OP steps. Works without issues. Summary of steps I did (in order):
  1. Download the Samsung Firmware Downloader.exe (v0.5.2) Zachary Wander based on Samloader
    I downloaded the ready-to-run exe Windows version.
    Note: When launching on Windows 10 PC, received a pop-up error 'The os does not support: 'Taskbar.setIconImage' . I ignored this error.
  2. In this app,
    for Model: SM-A217F (retrieved from Settings > About phone > Model number
    for Region: XSA (retrieved from Settings > About phone > Software information >Service provider software version
  3. Click the "Check for Updates" button, it will provide you with the latest Firmware version eg.
    A217FXXS7CUI3/A217FOLM7CUI3/A217FXXS7CUI3/A217FXXS7CUI3
  4. Click the "Download" button to download the firmware to your PC
  5. This will download an encrypted version of the firmware to your PC and automatically decrypt it to a zip file eg.
    SM-A217F_1_20210915175645_mbisbo1d5k_fac_A217FXXS7CUI3_A217FOLM7CUI3_A217FXXS7CUI3_A217FXXS7CUI3_XSA.zip
  6. Next download the modified verson of Magisk for the A21s at the start of this thread eg.
    Magisk_patched_for_A21S.apk
  7. Magisk is used to patch the firmware to enable root. This will void your warranty and you will have to put up with warnings every time to power off/on your phone eg.
    "The phone is not running Samsung's official software...."
  8. Installing Magisk will cause a full data wipe of your phone. So make sure you do a full backup of your phone using Samsung Smart Switch app running on your PC. In addition, I also use File Transfer to copy important folders/files on my phone directly to my PC hard disk. Note: not all applications will have their data restored successfully so you need to make sure you can reinstall and configure those applications eg. Google Authenticator
  9. The next software you need to download is Odin which runs on Winodws. Search online for it. I downloaded and used this version:
    Odin3_v3.14.1.zip
  10. Odin is used to load the custom firmware back onto the phone.
  11. At this stage, you have not made any changes to your phone. But you have now got all the software needed in place to root your phone. Once you proceed with the next step, your phone will no longer be running the official Samsung software and you will be reminded of this every time you power on/off your phone. Also, you may not be able to update the Samsung software using the Software Update option.
  12. Read through the steps in the section "Samsung (System-as-root)" on how to install Magisk to your phone
    DO NOT PROCEED WITH THE "Unlocking Bootloader" step IF ARE NOT COMFORTABLE WITH THE INSTRUCTIONS THERE.
  13. Tip: While it is stated in the instructions, the following step may not be clear:
    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.
    You need to unzip the BL, CP and CSC files from the downloaded firmware zip file as well to use in this step.
I decided to root my phone just to get the Axet Call Recorder function to work correctly under Magisk. Which it did after I installed Magisk but the Wifi Calling had to be turned off.
Would this work with SM-A217F/DS?
 

Subliminize

Member
Oct 21, 2021
6
0
baguio
Tested this on my Samsung A21s following OP steps. Works without issues. Summary of steps I did (in order):
  1. Download the Samsung Firmware Downloader.exe (v0.5.2) Zachary Wander based on Samloader
    I downloaded the ready-to-run exe Windows version.
    Note: When launching on Windows 10 PC, received a pop-up error 'The os does not support: 'Taskbar.setIconImage' . I ignored this error.
  2. In this app,
    for Model: SM-A217F (retrieved from Settings > About phone > Model number
    for Region: XSA (retrieved from Settings > About phone > Software information >Service provider software version
  3. Click the "Check for Updates" button, it will provide you with the latest Firmware version eg.
    A217FXXS7CUI3/A217FOLM7CUI3/A217FXXS7CUI3/A217FXXS7CUI3
  4. Click the "Download" button to download the firmware to your PC
  5. This will download an encrypted version of the firmware to your PC and automatically decrypt it to a zip file eg.
    SM-A217F_1_20210915175645_mbisbo1d5k_fac_A217FXXS7CUI3_A217FOLM7CUI3_A217FXXS7CUI3_A217FXXS7CUI3_XSA.zip
  6. Next download the modified verson of Magisk for the A21s at the start of this thread eg.
    Magisk_patched_for_A21S.apk
  7. Magisk is used to patch the firmware to enable root. This will void your warranty and you will have to put up with warnings every time to power off/on your phone eg.
    "The phone is not running Samsung's official software...."
  8. Installing Magisk will cause a full data wipe of your phone. So make sure you do a full backup of your phone using Samsung Smart Switch app running on your PC. In addition, I also use File Transfer to copy important folders/files on my phone directly to my PC hard disk. Note: not all applications will have their data restored successfully so you need to make sure you can reinstall and configure those applications eg. Google Authenticator
  9. The next software you need to download is Odin which runs on Winodws. Search online for it. I downloaded and used this version:
    Odin3_v3.14.1.zip
  10. Odin is used to load the custom firmware back onto the phone.
  11. At this stage, you have not made any changes to your phone. But you have now got all the software needed in place to root your phone. Once you proceed with the next step, your phone will no longer be running the official Samsung software and you will be reminded of this every time you power on/off your phone. Also, you may not be able to update the Samsung software using the Software Update option.
  12. Read through the steps in the section "Samsung (System-as-root)" on how to install Magisk to your phone
    DO NOT PROCEED WITH THE "Unlocking Bootloader" step IF ARE NOT COMFORTABLE WITH THE INSTRUCTIONS THERE.
  13. Tip: While it is stated in the instructions, the following step may not be clear:
    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.
    You need to unzip the BL, CP and CSC files from the downloaded firmware zip file as well to use in this step.
I decided to root my phone just to get the Axet Call Recorder function to work correctly under Magisk. Which it did after I installed Magisk but the Wifi Calling had to be turned off.
Are you on A11?
 

kcchan48

Member
Jul 11, 2007
17
4
Now I just wanna ask, is it okay now to use the original Magisk app that can be updated instead of the modified one?
From the OP:
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.

It is not clear if the latest version has fixed the issue, but I did try to update from the patched Magisk by clicking on the Update button, but it failed for me.
 

johnny_nb

Member
Jul 10, 2020
5
0
Hi, this is perfect. Your Magisk modification works for Galaxy M12 SM-M127F. The phone is root !!! I have a build of Central Europe XEZ-M127FXXS2AUE2. Do you have a similar modification of Magisk for Galaxy A52s 5G SM-SM-A5289B? Unfortunately, this method does not work on this.
 

F308

Senior Member
Feb 25, 2013
384
61
EU
I want to point out that if individual boot.img dont work try with the full AP file. I might be worng, I am just sharing what worked in my case.
I devoted plenty of time yesterday to analyze those actions and observed various facts which I want to share.
Maybe any conclusions will come up?
BTW:
I didn't root my phone yet, I cannot allow myself any failure at the moment.

Concerning the ankush1492 advice:
If I patched the whole AP file - except boot.img vbmeta.img was patched, too.
That would explain your success.

I tried patch vbmeta.img separately - it didn't work.
Patching boot.img - succeeded.
Then if we patch boot.img only we don't have patched vbmeta.img then pushing AP with unpatched vbmeta.img to phone may eventually lead to failure.

Those are md5sums of my patched files but probably it will give nothing as they are for XEO ROM then not necessarily will correspond to other versions.
MD5SUM:
887afdc83554da23e2858dd59d2b8c24 boot.img - patched
42339f87079163479689f18c0c6bb11a vbmeta.img - patched
I provide sums just for information.
Please compare with yours.
It may give some input eventually.
 

heats

New member
Nov 22, 2021
1
1
Just to confirm - I was able to root my A127F using the patched Magisk apk.
You can either use the latest source from https://github.com/topjohnwu/Magisk (but compile it by yourself) which already contains the fix from the patched Magisk (https://github.com/topjohnwu/Magisk/pull/4788) or use the patched .apk for ease. However, you should install the patched Magisk after rooting again.

The latest release of Magisk (currently) is from May 2021 (v23.0) - it does not include this patch. I guess, after installing the patched version, we can leave the option for "automatic upgrade" once a new Magisk release is out, because it should contain the patch, thus we'll be running an official release.
 
  • Like
Reactions: cater2

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Just to confirm - I was able to root my A127F using the patched Magisk apk.
    You can either use the latest source from https://github.com/topjohnwu/Magisk (but compile it by yourself) which already contains the fix from the patched Magisk (https://github.com/topjohnwu/Magisk/pull/4788) or use the patched .apk for ease. However, you should install the patched Magisk after rooting again.

    The latest release of Magisk (currently) is from May 2021 (v23.0) - it does not include this patch. I guess, after installing the patched version, we can leave the option for "automatic upgrade" once a new Magisk release is out, because it should contain the patch, thus we'll be running an official release.
  • 9
    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
    1
    If this works for the Latin American variant (A217M) then you're a god.
    1
    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.
    This may be due to the fact that A21S & M12 are using dynamic partitions. While the /super partition (this in charge of /system, /vendor, /product, /odm) is very large (about 5.5GB), the allocated space for each partition seems to be rather small with little extra space. (for A21S, there is about 20mb free space in / (this includes system) and 5mb in /vendor)

    One way to work around this is by creating a dummy module to use Magisk's Magic mount function. This function allows modules to add/delete/replace files in /system without actually modifying it.

    1. Using file managers like Root Explorer, you should create a folder in /data/adb/modules (the name doesn't matter)
    2. Create a file named module.prop in it. in this file, write the following:
    id=<anything (ex. dummymodule)> name=<anything (ex. Hello World)> version=v1.0 versionCode=1 author=<anything (ex. Hello)> description=<anything (ex. Hello World!)>

    3. Create a folder named system
    4. In the system folder, create a folder that matches with the folder in /system that you're trying to put your file in (in your case, it would be app)
    5. After creating the app folder, create a folder with the name name as the apk that you're trying to copy
    6. Copy the apk file that you're trying to install into the app folder that you just created.
    7. reboot

    After rebooting, you should see the changes. I personally used this method to install Pixel Launcher on my A21S.

    Screenshot_20210523-092445_Root Explorer.jpg

    Screenshot_20210523-092504_Pixel Launcher.jpg


    If you want more information this, these links would be very useful:
    https://topjohnwu.github.io/Magisk/details.html#magic-mount
    https://topjohnwu.github.io/Magisk/guides.html