FORUMS

[Guide] Magisk Modules Disabler for booting into Magisk core-only Mode

7,108 posts
Thanks Meter: 5,303
 
By Tulsadiver, XDA Ad-Free Recognized Contributor on 2nd October 2019, 01:45 PM
Post Reply Email Thread
Tools needed: boot.img extractor. I recommend the one created by osm0sis from this thread:
https://forum.xda-developers.com/sho....php?t=2073775

The first method was developed by osm0sis and removes magisk and all modules.
1. Unpack magisk_patched.img
2. Unzip overlay.dremove1.zip and place overlay.d folder in ramdisk folder.
3. Repack IMG
4. fastboot boot image-new.img created by repacking 8mg

This method is an offshoot of osm0sis version but boots core-only mode. Afterwards, remove the .disable-magisk file from the /cache folder for modules to work. Dot files are hidden files so if your root explorer can't see hidden files, run the "Remove disable_magisk" bat file in ADB.

1. Same as above but use the overlay.dcoreonly1.zip


For both methods you must be rooted for it to work. These are not cure all's for all bootloops.

Remove .disable_magisk bat file
https://www.androidfilehost.com/?fid...26312261684994

****************************************
Here is a fastboot bootable image to boot you into Magisk core-only mode, in case you bootloop due to flashing a bad module, in fastboot:

You will boot with root but modules disabled. After you remove the offending module you will need to go to /cache folder and delete the .disable_magisk file before your modules will work.
Once in fastboot:

fastboot boot image-newpixel3axl.img

You will boot with root but modules disabled. After you remove the offending module you will need to go to /cache folder and delete the .disable_magisk file before your modules will work.

fastboot boot image-newpixel3axlRemove.img

This one should remove magisk and all modules, then reboot and magisk should reinstall itself (ask to install necessary binaries). This is what osm0sis uses to recover from failed flashes. See this post:
https://forum.xda-developers.com/pix...t3976625/page2

Images are in this common folder. Pick the appropriate image for your phone.

6-4-20
https://www.androidfilehost.com/?w=files&flid=313291
Attached Files
File Type: zip overlay.dcoreonly1.zip - [Click for QR Code] (953 Bytes, 158 views)
File Type: zip overlay.dremove1.zip - [Click for QR Code] (761 Bytes, 108 views)
File Type: zip crosshatch-disabler.zip - [Click for QR Code] (478 Bytes, 54 views)
File Type: zip remove-disabler.zip - [Click for QR Code] (406 Bytes, 44 views)
The Following 6 Users Say Thank You to Tulsadiver For This Useful Post: [ View ] Gift Tulsadiver Ad-Free
3rd October 2019, 04:45 AM |#2  
Skittles9823's Avatar
Recognized Contributor
Flag Sydney
Thanks Meter: 2,009
 
Donate to Me
More
Ohboy this is helpful. Just out of curiosity, how does one create a magisk patched boot image with core-only mode enabled? I would like to be able to make my own every time a new security patch is out.

Sent from my Google Pixel 3a XL using XDA Labs
3rd October 2019, 12:46 PM |#3  
Tulsadiver's Avatar
OP Recognized Contributor
Thanks Meter: 5,303
 
Donate to Me
More
Quote:
Originally Posted by Skittles9823

Ohboy this is helpful. Just out of curiosity, how does one create a magisk patched boot image with core-only mode enabled? I would like to be able to make my own every time a new security patch is out.

Sent from my Google Pixel 3a XL using XDA Labs

I had planned on keeping these updated but here are the instructions.

You have to build your own copy of magisk from GitHub.

Clone magisk
Go to native/jni/core folder and edit the boot stages.cpp file in notepad++ like this:

Approx line 667

If (access(DISABLEFILE, F_ok) ==0)

Change == to !=

Now build magisk as per instructions on GitHub
One you have built it and there were no errors go to native/out/armeb-v7a folder and get a copy of the magiskini64 file.

Unpack your magisk_patched.img
In the ramdisk folder replace the init file with the .magiskini64 file (rename to init)
Repack your magisk_patched.img
The results are a patched IMG that will boot core only mode.
The Following 6 Users Say Thank You to Tulsadiver For This Useful Post: [ View ] Gift Tulsadiver Ad-Free
4th October 2019, 02:40 AM |#4  
Skittles9823's Avatar
Recognized Contributor
Flag Sydney
Thanks Meter: 2,009
 
Donate to Me
More
Quote:
Originally Posted by Tulsadiver

I had planned on keeping these updated but here are the instructions.

You have to build your own copy of magisk from GitHub.

Clone magisk
Go to native/jni/core folder and edit the boot stages.cpp file in notepad++ like this:

Approx line 667

If (access(DISABLEFILE, F_ok) ==0)

Change == to !=

Now build magisk as per instructions on GitHub
One you have built it and there were no errors go to native/out/armeb-v7a folder and get a copy of the magiskini64 file.

Unpack your magisk_patched.img
In the ramdisk folder replace the init file with the .magiskini64 file (rename to init)
Repack your magisk_patched.img
The results are a patched IMG that will boot core only mode.

Nice. Seems easy enough, if you ever disappear and stop updating images for some reason I'll give it a go 👌

Sent from my Google Pixel 3a XL using XDA Labs
The Following User Says Thank You to Skittles9823 For This Useful Post: [ View ] Gift Skittles9823 Ad-Free
28th October 2019, 08:24 AM |#5  
Member
Thanks Meter: 22
 
More
Hello

I have regular 3a with Android 10 installed, no twrp. I was in bootloop due to some module and was looking for solution to disable modules with only fastboot.

Before I found this thread, I went and reflash to stock.

Now I know.

Thanks for sharing this.
5th November 2019, 12:07 AM |#6  
Member
Thanks Meter: 9
 
Donate to Me
More
Quote:
Originally Posted by Tulsadiver

I had planned on keeping these updated but here are the instructions.

You have to build your own copy of magisk from GitHub.

Clone magisk
Go to native/jni/core folder and edit the boot stages.cpp file in notepad++ like this:

Approx line 667

If (access(DISABLEFILE, F_ok) ==0)

Change == to !=

Now build magisk as per instructions on GitHub
One you have built it and there were no errors go to native/out/armeb-v7a folder and get a copy of the magiskini64 file.

Unpack your magisk_patched.img
In the ramdisk folder replace the init file with the .magiskini64 file (rename to init)
Repack your magisk_patched.img
The results are a patched IMG that will boot core only mode.

I tried to do this for a Pixel 4 XL but the resulting boot image errors with "error boot prepare"
5th November 2019, 10:39 AM |#7  
Tulsadiver's Avatar
OP Recognized Contributor
Thanks Meter: 5,303
 
Donate to Me
More
Quote:
Originally Posted by gudenau

I tried to do this for a Pixel 4 XL but the resulting boot image errors with "error boot prepare"

I have these already made for the pixel 4 xl on the pixel 4 xl forum.
20th November 2019, 02:28 AM |#8  
osm0sis's Avatar
Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 31,392
 
Donate to Me
More
Should just make an AK3 zip that pushes the init from this boot.img into any boot partition, so will work universally.
20th November 2019, 04:20 AM |#9  
Skittles9823's Avatar
Recognized Contributor
Flag Sydney
Thanks Meter: 2,009
 
Donate to Me
More
Quote:
Originally Posted by osm0sis

Should just make an AK3 zip that pushes the init from this boot.img into any boot partition, so will work universally.

Ooft.

Wait, can you flash that through adb though?

Sent from my Google Pixel 3a XL using XDA Labs
20th November 2019, 03:17 PM |#10  
osm0sis's Avatar
Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 31,392
 
Donate to Me
More
Quote:
Originally Posted by Skittles9823

Ooft.

Wait, can you flash that through adb though?

Hmm.. true, non-working recovery is a definite problem. I'm in that boat right now on my OnePlus 7T, which is how I came across this thread.

Okay, better idea. Instead of mucking around with recompiling magiskinit for the above, just do it via boot script in overlay.d
20th November 2019, 06:36 PM |#11  
Skittles9823's Avatar
Recognized Contributor
Flag Sydney
Thanks Meter: 2,009
 
Donate to Me
More
Quote:
Originally Posted by osm0sis

Hmm.. true, non-working recovery is a definite problem. I'm in that boat right now on my OnePlus 7T, which is how I came across this thread.

Okay, better idea. Instead of mucking around with recompiling magiskinit for the above, just do it via boot script in overlay.d

Tbh, a custom boot.img is the only way to recover in some situations. Like if you can't boot into an adb environment or if you've never granted adb she'll root access.

Sent from my Google Pixel 3a XL using XDA Labs
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes