I have a treble and system-as-root but it is not an A/B device. I have rooted it with the help of the MagiskManager patch feature. My understanding is: MagiskManager has modified the following three files for rooting:
boot.imgto remove the signatures.vbmeta.imgto remove the AVB checks(to stop flashing unauthorized binaries).recovery.imgto actually root the device by patchinginitand adding some files like.backup/.magisk,.backup/.init(original init) etc..
Magisk has patched the recovery.img to boot the device into root mode if you release the recovery mode key combination at a splash screen.
But my requirement is to always boot as root without needing any key combinations.
I know Magisk needs to patch the SE-Policies and init file before the init process is actually started(as it will turn ON the enforcing mode). From treble device, my understanding is that the system partition is mounted before running the init script.
I think Magisk developers have patched the recover.img because they want to follow the systemless-root approach and support for the OTA updates.
So, I want to know if MagiskManager is capable of patching my system.img file to root the device?
I know the root will be lost if any OTA will come or maybe my device will fail to update the system but this is ok with me as long as I can root it again with the same method :)
This is also fine if instead of rooting on system.img, I will be able to patch the zImage to always boot in recovery as root mode.
Please suggest if it is feasible or not. If yes then how?
system.imgand is not recommended but my requirement is different: I can not go with recovery boot and don't need OTA updates. I just need a device that always reboots as root. – Vatish Sharma Nov 06 '19 at 04:38boot.imgdoesn't have a ramdisk, kernel mountssystem.imgas rootfs/and then executes/init. Recovery kernel executes/initfrom recovery ramdisk. So both partitions have different headers and bootloader passes different command-lines to both kernels. Ifrecovery.imgis flashed tobootpartition, I think bootloader won't extract recovery ramdisk since key combination isn't applied. But it depends on bootloader implementation, may work on some devices. – Irfan Latif Nov 06 '19 at 23:20system.imgfor permanent root in normal boot without booting to recovery. But that requires some hassle (unnecessary in my opinion). – Irfan Latif Nov 07 '19 at 13:16reboot recoveryneeds to be done fromadb(which isn't a less hassle than keeping keys pressed on reboot). Orinit.rc(and hencesystem.img) needs to be modified to run some reboot script. Ifsystem.imgis to be modified then it's better to runmagiskdfrom there, rather rebooting to recovery. //suwith6755(even withpermissiveSELinux) doesn't work because zygote starts apps with PR_SET_NO_NEW_PRIVS and PR_CAPBSET_DROP.set-uidis of no use. – Irfan Latif Nov 07 '19 at 17:31