• 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

[MDM][Magisk] Fully install Magisk after a reset without finishing the initial setup

Search This thread
Jun 19, 2021
9
3
Hello,

I have problem to fully install Magisk after a factory reset without using the GUI (Basically I have to not finish the initial setup of the phone) I want to perform a forensic analysis of a MDM enrolled smartphone (Fairphone 3) and the enrollment takes place when adding the Google account. I almost succeeded to obtain the root and bypass SafetyNet after the activation. The only problem is that I need to use the CLI command/su of Magisk after the factory reset, but the application is not "fully" installed and I need to press "install" from a prompt when clicking on it. (It's after the initial setup, so it's impossible in this context)


Is there a way to fully install Magisk from TWRP (after the reset factory) or anything like this ? I have observed that the zip install from TWRP put all the files in /data/adb/magisk. If I complete the install from the GUI, magisk binary is installed in /sbin/ in addition to /data/adb. (Only magiskboot binary survives the factory reset in /sbin/) I'm trying to read the source of Magisk to understand a way to do this.

Thank your for reading.
 
Jun 19, 2021
9
3
I have found the solution... Simply enable USB Debugging mode from the file /system/build.prop and /data/property/persistent_properties (with setprop command, not adb pull/push). And from the initial setup, we can use adb install magisk APK. The su command will work from that.