If you go through How Magisk works and How to manually root a phone it would be easy for you to figure out why it's impossible to achieve what you are looking for.
init
is the very first process started by kernel, which at its early stage sets SELinux enforcing
(if it's not already enforcing
). Before that happens, we need to modify SELinux policy so that it doesn't restrict the root daemon (magiskd
) from running. Also init.rc
needs to be patched to inject magiskd
service.
A simple option is to patch /sepolicy
and modify /init.rc
when rooting the device and save the files on device. But on system-as-root
devices both files are on system.img
(and possibly vendor.img
), not on boot.img
. So modifying them would break "systemless" approach and other related things, in particular dm-verity
and OTAs.
Another option is to run a process even before init
which patches SELinux policy and changes init.rc
on the go. And the easy way to achieve this is to replace original init
file with Magisk init
so that kernel executes the latter. However on SAR devices init
is also on system.img
, so we can't replace it. But we can always boot to recovery mode which does have a ramdisk
where Magisk's init
can be placed and executed before any other process. On A/B
SAR devices recovery ramdisk
is in boot.img
, so Magisk always boots to recovery by forcing kernel to ignore skip_initramfs
cmdline parameter received from bootloader.
Is there any way to achieve the root on a normal reboot?
On non-A/B SAR devices (like yours) there is no ramdisk
in boot.img
, so the only option to retain systemless approach is to place Magisk init
in recovery ramdisk
on recovery
partition, and always boot to recovery mode. From there system.img
is mounted at /system_root
by Magisk init
, contents of ramdisk
are then copied to /
cleaning everything previously existing, files are added / modified in rootfs /
, /system_root/system
is bind-mounted to /system
, and finally [/system]/init
is executed for normal boot.
However things have changed with Android 10, now system.img
is mounted at /
but the files to be added / modified like /init.rc
and /sbin
are overlaid with bind mounts as tweeted by Magisk developer.