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

Search This thread

MichelBen

Member
Jun 6, 2021
23
0
It turns out that I bought a phone from Amazon and it came to me with a custom ROM that I don't know about, the operating system has the bootloader blocked and they were in the lobby when I switched to the phone slot, it gives me an error and now it says that it has a damaged boat. I know how to solve this problem and I have always tried to flash the stock ROM but I have not been able to with this I would like to ask you if you know how I can solve this problem if you can help me
 

Tulsadiver

Recognized Contributor
Jul 11, 2013
9,815
7,380
Google Pixel 7 Pro
Are you saying the bootloader is locked? It shouldn't be if it has a custom rom installed. Are you trying to flash stock rom via fastboot or adb?
 

MichelBen

Member
Jun 6, 2021
23
0
Are you saying the bootloader is locked? It shouldn't be if it has a custom rom installed. Are you trying to flash stock rom via fastboot or adb?
This is how the phone comes with a custom ROM called Matrix and it does not allow access to any type of configuration I can not activate USB debugging nor can I unlock boot management the phone is free but it is from but to the Isa I have not been able to solve anything The only thing What I did was change from Slow to Slow ve and I could no longer do any kind of configuration when you change them to a corrupted Butler error appears
 

Tulsadiver

Recognized Contributor
Jul 11, 2013
9,815
7,380
Google Pixel 7 Pro
This is how the phone comes with a custom ROM called Matrix and it does not allow access to any type of configuration I can not activate USB debugging nor can I unlock boot management the phone is free but it is from but to the Isa I have not been able to solve anything The only thing What I did was change from Slow to Slow ve and I could no longer do any kind of configuration when you change them to a corrupted Butler error appears
I don't know how a custom rom can prevent you from enabling usb debugging or how you can have a custom rom but a locked bootloader. The different slots are to assist in automatic updates so stick with the slot your custom rom is on. What happens when you try to flash your stock rom?
 

MichelBen

Member
Jun 6, 2021
23
0
No sé cómo una rom personalizada puede evitar que habilite la depuración USB o cómo puede tener una rom personalizada pero un gestor de arranque bloqueado. Las diferentes ranuras son para ayudar en las actualizaciones automáticas, así que quédese con la ranura en la que se encuentra su rom personalizada. ¿Qué sucede cuando intentas flashear tu stock. Error ! Boot logo
 

Lynxx241

Member
Sep 27, 2021
5
0
Are you saying the bootloader is locked? It shouldn't be if it has a custom rom installed. Are you trying to flash stock rom via fastboot or adb?
Hello, I have a problem with my Nokia 9PV i ended in a bootloop, all caused by faulty magisk module. No TWRP for Nokia 9PV. I cannot start in core only mode and the adb command does not work for me either. I've been trying your method but it hasn't worked, look this patched img.
 

Tulsadiver

Recognized Contributor
Jul 11, 2013
9,815
7,380
Google Pixel 7 Pro
Hello, I have a problem with my Nokia 9PV i ended in a bootloop, all caused by faulty magisk module. No TWRP for Nokia 9PV. I cannot start in core only mode and the adb command does not work for me either. I've been trying your method but it hasn't worked, look this patched img.
Try this:

1. Boot into fastboot and flash stock boot.img, and reboot. "fastboot flash boot boot .img"


2. Boot as if entering safemode (push and hold power button until the power off icon shows. Long press it for safemode option).


3. Your phone will attempt to reboot. Before it boots all the way up, press and hold power and volume down to enter fastboot mode. Fastboot flash magisk_patched.img and reboot. You'll be rooted in safemode.


4. You can now use adb to remove all modules.

"adb wait-for-device shell magisk --remove-modules"
 

Lynxx241

Member
Sep 27, 2021
5
0
Try this:

1. Boot into fastboot and flash stock boot.img, and reboot. "fastboot flash boot boot .img"


2. Boot as if entering safemode (push and hold power button until the power off icon shows. Long press it for safemode option).


3. Your phone will attempt to reboot. Before it boots all the way up, press and hold power and volume down to enter fastboot mode. Fastboot flash magisk_patched.img and reboot. You'll be rooted in safemode.


4. You can now use adb to remove all modules.

"adb wait-for-device shell magisk --remove-modules"
Stuck in android one logo then reboot to fastboot bro ): so safemode not work. if i flash in the fastboot state with stock boot.img, safemode appears on the next reboot
 

Tulsadiver

Recognized Contributor
Jul 11, 2013
9,815
7,380
Google Pixel 7 Pro
Stuck in android one logo then reboot to fastboot bro ): so safemode not work. if i flash in the fastboot state with stock boot.img, safemode appears on the next reboot
You aren't supposed to let it reboot all the way after trying to go to safemode.

If your bootloop is caused by a bad module, this should work. I do it all the time. Phones are different though, and you have to be able to enter fastboot prior to your phone booting all the way back up after selecting safemode.
 

Lynxx241

Member
Sep 27, 2021
5
0
You aren't supposed to let it reboot all the way after trying to go to safemode.

If your bootloop is caused by a bad module, this should work. I do it all the time. Phones are different though, and you have to be able to enter fastboot prior to your phone booting all the way back up after selecting safemode.
Try this:

1. Boot into fastboot and flash stock boot.img, and reboot. "fastboot flash boot boot .img"


2. Boot as if entering safemode (push and hold power button until the power off icon shows. Long press it for safemode option).


3. Your phone will attempt to reboot. Before it boots all the way up, press and hold power and volume down to enter fastboot mode. Fastboot flash magisk_patched.img and reboot. You'll be rooted in safemode.
Yes buddy, I did 1,2 and 3rd step perfectly "my phone display (reboot in safemode) and pressed it" then use button combo to reboot in fastboot and flash patched.img, but after reboot with patched image, safemode not work, stuck in bootloop.
 
Last edited:

Lynxx241

Member
Sep 27, 2021
5
0
You might be rebooting to fastboot too soon. Wait until you see the message that your bootloader might be corrupt.
I do not see anything that my bootloader is corrupt. Dude I want to flash my stock firmware, I give up haha. The problem is that I cannot find the firmware for my region "model 513H00WW" But I found the "525A00WW" Do you think there would be a problem? The firmware is for the same device but it is "different variant"
 

Testing33

Member
Mar 4, 2023
41
28
Xiaomi Redmi Note 7 Pro
Hi , I have gone through this entire thread and patched files in boot accordingly but still does not deleting folders in adb. I tried .disable_magisk file in /data/cache and also later on that overlay.d stuff but no luck in both.

my phone is different sorry for that , any help would be appreciated. attaching my boot img file also.
Motorola Edge 30 android 13
 

Attachments

  • newboot.img
    96 MB · Views: 1

Tulsadiver

Recognized Contributor
Jul 11, 2013
9,815
7,380
Google Pixel 7 Pro
Hi , I have gone through this entire thread and patched files in boot accordingly but still does not deleting folders in adb. I tried .disable_magisk file in /data/cache and also later on that overlay.d stuff but no luck in both.

my phone is different sorry for that , any help would be appreciated. attaching my boot img file also.
Motorola Edge 30 android 13
I don't believe this works for Android 13.
 

Testing33

Member
Mar 4, 2023
41
28
Xiaomi Redmi Note 7 Pro
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.
Hi, is this method still works on A13 roms with latest magisk ? I don't have expertise in building magisk.

If possible for you can you please yours compiled magisk binaries ? and any other guide or help will also be great.

I already tried below method but no luck:
.disable_magisk file
via ADB or TWRP(no twrp available)
overlay.d files
 

Tulsadiver

Recognized Contributor
Jul 11, 2013
9,815
7,380
Google Pixel 7 Pro
Hi, is this method still works on A13 roms with latest magisk ? I don't have expertise in building magisk.

If possible for you can you please yours compiled magisk binaries ? and any other guide or help will also be great.

I already tried below method but no luck:
.disable_magisk file
via ADB or TWRP(no twrp available)
overlay.d files
What is your phone doing? If im not mistaken, the current method is to boot into safe mode as your phone boots up, then reboot.
 

Testing33

Member
Mar 4, 2023
41
28
Xiaomi Redmi Note 7 Pro
What is your phone doing? If im not mistaken, the current method is to boot into safe mode as your phone boots up, then reboot.
Phone is stuck at boot animation. I tried various key combinations as well at different-different timing of boot animation but still not booting into safe mode.
My sole purpose is somehow delete/disable modules or boot with core only mode, via flashing edited magisk_patched boot.img .
 

Top Liked Posts

  • There are no posts matching your filters.
  • 7
    Tools needed: boot.img extractor. I recommend the one created by osm0sis from this thread:
    https://forum.xda-developers.com/showthread.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=4349826312261684994

    ****************************************
    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/pi...odules-disabler-booting-magisk-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
    6
    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.
    3
    If anyone wants to experiment with this idea, here's the basic setup I used for my boot.img to fully reset the /data/adb directory for the soft brick issue (related to a magisk.db failure) I was seeing in the last canary.

    Unpack the current magisk_patched.img for your device using my Android Image Kitchen (AIK) project, then create:

    ramdisk/overlay.d/init.resetmagisk.rc:
    Code:
    on post-fs-data
        exec u:r:magisk:s0 root root -- /sbin/init.resetmagisk.sh

    ramdisk/overlay.d/sbin/init.resetmagisk.sh:
    Code:
    #!/system/bin/sh
    rm -rf /data/adb/* && reboot

    So, pretty simple stuff, and I'm sure it could be applied to some sort of Core Only workaround until @topjohnwu decides what he wants to do with all those Core Only boot.img Pull Requests. :cowboy:
    3
    Follow my instructions and make your own. I will not be making images for every single person that hijacks this thread. :rolleyes:

    Edit: In fact I'm unsubscribing, good luck to all!
    2
    I would like to thank you as this has saved me multiple times now. Haven't had a phone I could root for many years now and how I've missed it. Not having twrp makes things interesting and this saved the day many many times. Thank you

    Yes, without TWRP, a person needs to be creative at times and, like you said, it can make things interesting. Thus the occasional need for a recovery boot.img :)