How to swap between kernels with out Magisk brick? - Magisk

I like to switch between two different developer's kernels and they seem to work better when flashed over the stock kernel and not custom kernel 2 being flashed over custom kernel 1.
My resolution to this is to restore to my stock rooted with magisk kernel then flash the other custom kernel. This results in a Magisk brick where you can't uninstall Magisk and you can't install magisk again due to the stock boot image being modified. The only answer to fix the Magisk brick is a system wipe and rom re-install.
If I uninstall between kernels, all of my Magisk settings and modules are uninstalled too if it doesn't just give the modified boot img thing again.
How can I swap between kernels while restoring stock without getting Magisk bricked?
Example: Custom Kernel 1 > Stock Kernel > Custom Kernel 2. This always leads to the Magisk brick.
Nexus 6, 7.1.2 NitrogenOS, Stock kernel, ElementalX kernel, FK Kernel.

Whenever I have to move between kernels, I do the following:
Dirty flash ROM zip (to restore the stock boot.img that ships with the ROM) or manually extract the boot.img from your ROM's flashable zip and fastboot flash it
Flash Magisk zip
Flash new kernel zip
Reboot and profit!
I haven't faced any issues ever with this process, following the order listed above. Give it a shot. Good luck! :good:

shadowstep said:
Whenever I have to move between kernels, I do the following:
Dirty flash ROM zip (to restore the stock boot.img that ships with the ROM) or manually extract the boot.img from your ROM's flashable zip and fastboot flash it
Flash Magisk zip
Flash new kernel zip
Reboot and profit!
I haven't faced any issues ever with this process, following the order listed above. Give it a shot. Good luck! :good:
Click to expand...
Click to collapse
Y no back up stock boot from the starting?

redsun_ravi said:
Y no back up stock boot from the starting?
Click to expand...
Click to collapse
Why do you need to backup the stock boot image from the beginning? It's already a part of the ROM zip that you flash. You can always dirty flash to go back to the boot image that ships with the ROM that you are using or extract it from your ROM's flashable zip.

shadowstep said:
Why do you need to backup the stock boot image from the beginning? It's already a part of the ROM zip that you flash. You can always dirty flash to go back to the boot image that ships with the ROM that you are using or extract it from your ROM's flashable zip.
Click to expand...
Click to collapse
Y unpack rom and repack boot
Y flash whole rom and loss magisk setting, fonts, adblock host and other stuff
While u can just give 10 sec to back up boot

xNotta said:
I like to switch between two different developer's kernels and they seem to work better when flashed over the stock kernel and not custom kernel 2 being flashed over custom kernel 1.
My resolution to this is to restore to my stock rooted with magisk kernel then flash the other custom kernel. This results in a Magisk brick where you can't uninstall Magisk and you can't install magisk again due to the stock boot image being modified. The only answer to fix the Magisk brick is a system wipe and rom re-install.
If I uninstall between kernels, all of my Magisk settings and modules are uninstalled too if it doesn't just give the modified boot img thing again.
How can I swap between kernels while restoring stock without getting Magisk bricked?
Example: Custom Kernel 1 > Stock Kernel > Custom Kernel 2. This always leads to the Magisk brick.
Nexus 6, 7.1.2 NitrogenOS, Stock kernel, ElementalX kernel, FK Kernel.
Click to expand...
Click to collapse
shadowstep said:
Whenever I have to move between kernels, I do the following:
Dirty flash ROM zip (to restore the stock boot.img that ships with the ROM) or manually extract the boot.img from your ROM's flashable zip and fastboot flash it
Flash Magisk zip
Flash new kernel zip
Reboot and profit!
I haven't faced any issues ever with this process, following the order listed above. Give it a shot. Good luck! :good:
Click to expand...
Click to collapse
No real need to fastboot flash it, just flash the boot.img in TWRP, only takes a second before you flash Magisk
Sent from my H1611 using Tapatalk

redsun_ravi said:
Y unpack rom and repack boot
Y flash whole rom and loss magisk setting, fonts, adblock host and other stuff
While u can just give 10 sec to back up boot
Click to expand...
Click to collapse
Repack boot? I never said that anywhere. Also, I hope you mean unzip the ROM zip file.
Anyway, backing up the boot image would serve no purpose as the OP wants to switch to a different kernel, which means a different boot image that the one he/she is using right now. It'll be pointless.
BurnedDrake said:
No real need to fastboot flash it, just flash the boot.img in TWRP, only takes a second before you flash Magisk
Click to expand...
Click to collapse
Of course the boot image can be flashed via TWRP too. I just gave that as an alternative option. Never said it has to be done a certain way.

shadowstep said:
Repack boot? I never said that anywhere. Also, I hope you mean unzip the ROM zip file.
Anyway, backing up the boot image would serve no purpose as the OP wants to switch to a different kernel, which means a different boot image that the one he/she is using right now. It'll be pointless.
Of course the boot image can be flashed via TWRP too. I just gave that as an alternative option. Never said it has to be done a certain way.
Click to expand...
Click to collapse
Oh I know, it wasn't a criticism, just one less reboot is all
Sent from my H1611 using Tapatalk

redsun_ravi said:
Y unpack rom and repack boot
Y flash whole rom and loss magisk setting, fonts, adblock host and other stuff
While u can just give 10 sec to back up boot
Click to expand...
Click to collapse
U don't lose all the magisk stuff on dirty flash. The only way u lose all that is running the magisk uninstaller. I wipe system, boot, and cache, dirty flash ROM, then magisk, then new kernel. All magisk modules, host files, settings are still present no matter what device or what ROM. Boot is included in ROM so dirty flash flashes that stock boot.img and starts fresh.

You can flash kernel with fastboot.
Extract boot.img from zip, then run
fastboot flash boot boot.img
After that you can backup boot in twrp and flash magisk.
Repeat with other kernel.

Related

Stock boot img problem with magisk

I have a problem with SuperSU and magisk. I flash in twrp the root zip and then magisk, after that when I want to update it says this;
! Boot img patched by other programs
! please restore stock boot img
Click to expand...
Click to collapse
I don't have any custom rom, i'm actually oos 5.0.3. I first try to root but dm-verity was triggered and then followed all the steps to disable it.
Any solutions?
Nube420 said:
I have a problem with SuperSU and magisk. I flash in twrp the root zip and then magisk, after that when I want to update it says this;
Click to expand...
Click to collapse
Magisk is a root zip. It sounds like you are flashing SuperSU and Magisk. You can only use one or the other, not both!
Reflash stock ROM (or at least stock boot.img). Then flash Magisk. That's it.
Getting the error message that boot.img is modified is normal and expected in your case. SuperSU patched the boot image. Now Magisk is looking for the stock image to patch, and finding a patched one.

Stuck in bootloop after Xposed install [Magisk][Exposed][Recovery]

Device is stuck in bootloop after I installed Xposed framework module from magisk manager .
I've tried uninstalling magisk , but the uninstall package terminates with error .
Then I flashed stock boot.img , it is booting but I cannot disable the module as magisk isn't installed.
Is there a way I can removed magisk's files / uninstall magisk modules manually from twrp .
Thanks !
(If there is some more relevant place for this thread , please let me know I'll post this there.)
Edit: Fixed it!
you will have to reflash entire system.img + boot.img again with proper wiping.
I never got xposed working on R6 stock.. (i got it magically working on GSI tho) I really want Xposed tho.. :/
TanRayCz said:
I never got xposed working on R6 stock.. (i got it magically working on GSI tho) I really want Xposed tho.. :/
Click to expand...
Click to collapse
which gsi image & twrp you are using? I flashed rr gsi-nosu-vanilla but it keeps bootloop.
abkdmn said:
which gsi image & twrp you are using? I flashed rr gsi-nosu-vanilla but it keeps bootloop.
Click to expand...
Click to collapse
LOS Treble. Call/SMS issues though. LR Team TWRP.
TanRayCz said:
LOS Treble. Call/SMS issues though. LR Team TWRP.
Click to expand...
Click to collapse
i tried flashing the los (15.1 arm A only) gsi image, stuck at bootloop.
how can u succeed?
Michaelw7 said:
i tried flashing the los (15.1 arm A only) gsi image, stuck at bootloop.
how can u succeed?
Click to expand...
Click to collapse
If youll get into bootloop i suggest you trying to wipe system and data partitions from fastboot (important), then flash stock ROM and then flash the GSI. This most of the time worked for me as clear GSI flash. So steps may not be necessary.
TanRayCz said:
If youll get into bootloop i suggest you trying to wipe system and data partitions from fastboot (important), then flash stock ROM and then flash the GSI. This most of the time worked for me as clear GSI flash. So steps may not be necessary.
Click to expand...
Click to collapse
thank u for the help. i will try it
TanRayCz said:
If youll get into bootloop i suggest you trying to wipe system and data partitions from fastboot (important), then flash stock ROM and then flash the GSI. This most of the time worked for me as clear GSI flash. So steps may not be necessary.
Click to expand...
Click to collapse
[official] miui 10 recovery & fastboot ROM
tried wipe system and data partition from fastboot.
and then flash stock rom (from [official] miui 10 recovery & fastboot ROM thread in kernel sub forum), and then instal the gsi image los 15.1.
still bootloop. idk what i did wrong. still no clue
Michaelw7 said:
[official] miui 10 recovery & fastboot ROM
tried wipe system and data partition from fastboot.
and then flash stock rom (from [official] miui 10 recovery & fastboot ROM thread in kernel sub forum), and then instal the gsi image los 15.1.
still bootloop. idk what i did wrong. still no clue
Click to expand...
Click to collapse
Try to flash stock kernel/boot.img or remove Magisk trough uninstaller. This magically helped me one time
TanRayCz said:
Try to flash stock kernel/boot.img or remove Magisk trough uninstaller. This magically helped me one time
Click to expand...
Click to collapse
where can ai get the stock kernel file?
Michaelw7 said:
where can ai get the stock kernel file?
Click to expand...
Click to collapse
You can restore boot.img by installing Magisk uninstaller update ( it's available on Magisk thread I think) , or download a fastboot update for your device to get stock boot.img
Michaelw7 said:
where can ai get the stock kernel file?
Click to expand...
Click to collapse
You can extract it from firmware ZIP
Michaelw7 said:
where can ai get the stock kernel file?
Click to expand...
Click to collapse
go to this site. (not promoting it or something) https://extract.me paste this link [ http://bigota.d.miui.com/V10.0.1.0....FH_20180919.0000.00_8.1_global_794ccbbe18.tgz ] wait a few second then you will see all files from this archive, download what you want from it. It will save you a lot of time to download entire archive. Trust me.

TWRP gets replaced by stock recovery

So I've used TWRP r16 and it throws an "Image not signed or corrupt" error as suggested by other users I ignored it, but everytime I reboot to system and try to get to recovery "no command" show's up meaning TWRP was replaced by stock recovery all help will be appreciated.
Thanks
Akash731 said:
So I've used TWRP r16 and it throws an "Image not signed or corrupt" error as suggested by other users I ignored it, but everytime I reboot to system and try to get to recovery "no command" show's up meaning TWRP was replaced by stock recovery all help will be appreciated.
Thanks
Click to expand...
Click to collapse
You need to flash Magisk after flashing TWRP
1. Flash Latest TWRP
2. Reboot to TWRP
3. Flash Magisk
If you boot in to system after flashing TWRP, TWRP will be removed
pradeeppk said:
You need to flash Magisk after flashing TWRP
1. Flash Latest TWRP
2. Reboot to TWRP
3. Flash Magisk
If you boot in to system after flashing TWRP, TWRP will be removed
Click to expand...
Click to collapse
Hey thanks that worked.
But everytime I boot to system and boot to twrp the data gets encrypted and I can't access the files do you happen to know any solution for this?
Akash731 said:
Hey thanks that worked.
But everytime I boot to system and boot to twrp the data gets encrypted and I can't access the files do you happen to know any solution for this?
Click to expand...
Click to collapse
If you are on stock Rom, according to my knoweldge it is not possible to remove encryption, if you format your date in twrp for removing encryption then reboot to system you can see that the phone is again encrypted.
But in custom roms this doesnt happen.
pradeeppk said:
You need to flash Magisk after flashing TWRP
1. Flash Latest TWRP
2. Reboot to TWRP
3. Flash Magisk
If you boot in to system after flashing TWRP, TWRP will be removed
Click to expand...
Click to collapse
pradeeppk said:
If you are on stock Rom, according to my knoweldge it is not possible to remove encryption, if you format your date in twrp for removing encryption then reboot to system you can see that the phone is again encrypted.
But in custom roms this doesnt happen.
Click to expand...
Click to collapse
I don't want to try custom rom's as this is my main device guess I'm stuck with the encryption then thanks for your help. :good:
Edit:-
Tried TWRP r20 it decrypts fine thanks
pradeeppk said:
You need to flash Magisk after flashing TWRP
1. Flash Latest TWRP
2. Reboot to TWRP
3. Flash Magisk
If you boot in to system after flashing TWRP, TWRP will be removed
Click to expand...
Click to collapse
You don't have to flash Magisk after flashing TWRP. The two are unrelated.
After flashing TWRP you have to boot into recovery, not system. Once TWRP was started, you can reboot into system. No need for Magisk (unless you want Magisk anyway).
gewe said:
You don't have to flash Magisk after flashing TWRP. The two are unrelated.
After flashing TWRP you have to boot into recovery, not system. Once TWRP was started, you can reboot into system. No need for Magisk (unless you want Magisk anyway).
Click to expand...
Click to collapse
It will not work in stock ROM, if you flash a custom rom there is no need to flash Magisk.
You should flash Magisk or custom kernel after flashing TWRP otherwise it will be erased.
Google about TWRP erasing after reboot you should get too many posts regarding this
This is one of them
https://forum.xda-developers.com/oneplus-3t/help/twrp-deleted-booting-t3769867
pradeeppk said:
It will not work in stock ROM, if you flash a custom rom there is no need to flash Magisk.
You should flash Magisk or custom kernel after flashing TWRP otherwise it will be erased.
Google about TWRP erasing after reboot you should get too many posts regarding this
This is one of them
https://forum.xda-developers.com/oneplus-3t/help/twrp-deleted-booting-t3769867
Click to expand...
Click to collapse
I am using stock ROM, and yes, also Magisk (installed later). IIRC Magisk is not needed for TWRP to work. When I receive the next OTA notification, I will test this.
The thread you are referring to is for a OnePlus 3T. For our device this is the thread: https://forum.xda-developers.com/moto-g5s-plus/development/recovery-twrp-3-1-1-r7-t3694910.
Since there is no official TWRP for the Moto G5S Plus, I took the following text from the TWRP page for the Moto G5S.
Note many devices will replace your custom recovery automatically during first boot. To prevent this, use Google to find the proper key combo to enter recovery. After typing fastboot reboot, hold the key combo and boot to TWRP. Once TWRP is booted, TWRP will patch the stock ROM to prevent the stock ROM from replacing TWRP. If you don't follow this step, you will have to repeat the install.
Click to expand...
Click to collapse
Instead of that you can also use fastboot reboot-bootloader, and then from the bootloader start recovery.
pradeeppk said:
It will not work in stock ROM, if you flash a custom rom there is no need to flash Magisk.
You should flash Magisk or custom kernel after flashing TWRP otherwise it will be erased.
Google about TWRP erasing after reboot you should get too many posts regarding this
This is one of them
https://forum.xda-developers.com/oneplus-3t/help/twrp-deleted-booting-t3769867
Click to expand...
Click to collapse
Two days ago I received a notification for an OTA update, containing the August 2019 security patches.
After going back to stock ROM, installing all the updates up to the latest, I installed TWRP. After booting into recovery, and then into system, and recovery again, TWRP was gone. Strange, I don't remember this happening before. Maybe I always installed Magisk before booting into system.
Bottom line: you were right, I was wrong. Thanks for pointing it out.
gewe said:
Two days ago I received a notification for an OTA update, containing the August 2019 security patches.
After going back to stock ROM, installing all the updates up to the latest, I installed TWRP. After booting into recovery, and then into system, and recovery again, TWRP was gone. Strange, I don't remember this happening before. Maybe I always installed Magisk before booting into system.
Bottom line: you were right, I was wrong. Thanks for pointing it out.
Click to expand...
Click to collapse
As like you said this is the first time in my life i need to flash magisk to stick twrp.
I usualy doesn't use root or custom roms, install twrp, remove unnecessary apps from stock system, replace host files with adaway hosts, replace or edit gps config files. and continue using stock.
This is the main routine from Android 1.5
(Samsung spica (i think it was the first Android phone from Samsung)).
It may be due to security reason stock kernel or system delete twrp.
When installing magisk it patch stock boot image, that may be the reason of twrp remains after flashing magisk.

Question Question regarding the boot.img

When getting a custom ROM and wanting to root it with Magisk, should I patch and flash the boot.img of the specific ROM or the boot.img of the factory FW
hazoky01 said:
When getting a custom ROM and wanting to root it with Magisk, should I patch and flash the boot.img of the specific ROM or the boot.img of the factory FW
Click to expand...
Click to collapse
Flash TWRP or orange fox and then Magisk zip in the recovery
That's it
But of course the bootloader has to be unlocked
The boot img of the current ROM you're using like example boot img of Pixel Experience if you're using that. Usually the boot img is inside the ROM zip when you installed it. But this method is for devices without custom recovery. Of course it will work but I suggest to follow what Laptapper suggested to flash a custom recovery (orange fox r12.1_2 or twrp 3.7.0) and just flash magisk.zip.

[solved]How to install stock ROM + custom kernel and Magisk?

Hello everyone,
I currently use the stock ROM + WirusMOD Nethunter modified Kernel and Magisk on my SM-G781B/DS.
I installed it quite a while ago using TWRP. I'm still on Android 11 and I'd like to upgrade my system. OTA doesn't work, and I decided to just wipe and completly re-install the stock rom. The Magisk installation guide recommends patching the AP of the ROM over flashing via custom recovery. A custom recovery prohibits OTA upgrades as far as I know, so I would prefer to just keep the stock recovery.
So this is what I planned:
1. modify freshly downloaded stock ROM with Magisk
2. *somehow* install kernel in stock ROM if possible?
3. flash via ODIN
4. finish Magisk setup
I couldn't find that much information and I'm fairly new to rooting in general. So here are the questions I have:
1. Is it possible to flash a custom Kernel without custom recovery, if it is, how?
3. Will OTA updates be accessible with the custom Kernel?
4. Is there another way or did I miss something obvious?
Thanks for any feedback in advance.
you definitely can't flash an AP archive with a custom recovery.
a custom kernel is designed to be flashed by a custom recovery unless it's a single IMG file inside the zip for it.
there's a sizeable chunk of us who manually flash updates, redo twrp, flash a magisk patched boot.img with twrp (once it's been extracted from the AP archive (using a PC app that supports .LZ4 compression)) and then flash a custom kernel finally... every month!
using something like Swift Backup to save apps n data, messages etc helps cut down the misery a bit.
3mel said:
you definitely can't flash an AP archive with a custom recovery.
a custom kernel is designed to be flashed by a custom recovery unless it's a single IMG file inside the zip for it.
there's a sizeable chunk of us who manually flash updates, redo twrp, flash a magisk patched boot.img with twrp (once it's been extracted from the AP archive (using a PC app that supports .LZ4 compression)) and then flash a custom kernel finally... every month!
using something like Swift Backup to save apps n data, messages etc helps cut down the misery a bit.
Click to expand...
Click to collapse
thank you so much! I guess Ill do it that way. Maybe some day there will be an easier way.
Gurkinator said:
thank you so much! I guess Ill do it that way. Maybe some day there will be an easier way.
Click to expand...
Click to collapse
the trend seems to be that it's not getting easier sadly.

Categories

Resources