yashsingh1/xdaforums huggingface dataset:
[Magisk] J.Michael:
You are all over the place.

First, the intent was never for you to find *a* stock boot image. The intent was for you to have a copy of the software installed on your device, and to extract from that the boot image.

My opinion: You shouldn't try installing Magisk unless you have successfully flashed the "stock" software from which you intend to extract whatever gets patched. How you recover when it turns out that your "stock" software is no good, I don't know. Maybe start a miserable grind of downloading and trying a whole lot of other ROMs until you get lucky and find one that works.

As to whether you can install Magisk into the boot partition, you have to tell us. When the Magisk app says "Ramdisk: No", you might be able to install Magisk into the boot partition anyway; it might not work, as in, you don't get Magisk active when you boot.

"Type III" is a designation for a particular combination of Android version and device organization. I think John Wu assigned the name to one of the special cases he encountered. If it's not in the Installation Notes, try searching this thread, @pndwal has repeated it a number of times.

If you can use "dd" to alter partitions, you already have "root". Why do you want Magisk?

Did you ever patch the boot image with Recovery unchecked and try flashing that to the boot partition?

(How do you flash? Do you have fastboot?)

What you have now certainly addresses my concern about having the right kernel to run the normal system, but now you have no recovery. Unless you put one on the external SD-card.

I'm curious: If you put the unpatched boot image on the SD-card as "recovery.img", do you get your normal system? If you put the patched-with-recovery-option boot image on the SD-card as "recovery.img", do you get Magisk active? If you put the patched-without-recovery-option boot image on the SD-card as "recovery.img", do you get Magisk active?

Congratulations. This has got to be one for the record book.
[Magisk] gnirtS:
Ive got a removing a bad module issue on Lineage 21 / S5E LTE using Delta.

I flashed a bit module (Husky props) which has triggered a bootloop to the extent it tried twice, fails then just presents me with "Try Again" or "Wipe Data" in recovery. Unable to load system - your data maybe corrupt.

ADB works from here but magisk command is not found so i cant use remove-modules

Safe mode does NOT boot

The only way to get back into the OS is by flashing the orginal image. This works in that i get into the GUI. This also wipes Magisk.

If i then reinstall Magisk its renabling the bad module on the reboot so im back to square one.

I cannot go in to ADB via a computer or terminal because without root access i cant access /data or any folder where i could manually delete the module.

To get root i need Magisk installed but the second it reboots after installing that its a boot loop so i cant remove the module etc.

Any idea how to get around this? Seems i need root to delete the bad module but with Magisk to obtain root the bad module stops it from booting at all, even into safe mode.
[Magisk] n.p.:
I did wander a bit. :)

I originally thought that I needed the recovery image, which (apparently) the slimBOXtv developers have altered ("Boot image patched by unsupported programs"). Their ROMs have existed for a few years, and (albeit with some quirks) generally work.

I did say above that flashing boot.img to the boot partition did not work.

I flashed the images with TWRP, and opened a terminal in TWRP to

execute the dd command. I have never tried to use fastboot over TCP (I have no idea if the device supports that).

I obviously need Magisk to have root in the Android system (not just recovery).

I will search the thread (which, unfortunately, at 2900+ pages, has become quite large) for that. Thanks.

Let me know if you can suggest a better option. :)

Since you have generously contributed your time (and indulged my curiosity), I feel like I owe you answers to these questions (and I would like to know them myself, as well :) ).

Unpatched boot.img as recovery.img on microSD card: boot loop

Patched (with Recovery Mode checked in the Magisk install menu) boot.img as recovery.img on microSD card: boots normally with Magisk active

Patched (without Recovery Mode checked in the Magisk install menu) boot.img as recovery.img on microSD card: does not boot (freezes with logo displayed, but before splash screen).

Thanks (I think). :)
[Magisk] pndwal:
Yeah, I didn't really consider what function cited actually does, but you're correct that boot kernel is required... Some details:

For Legacy SAR (System As Root) - (B type boot method) devices, pre-init, magiskinit replaces init as the first program to run, kernel directly mounts the system partition as rootdir (kernel doesn’t need initramfs to boot Android and since rootdir is always system, init for Android is in system, not ramdisk... boot ramdisk(s) are eliminated), other Magisk functions are carried out then exec original init to boot... Since two init files are now invoked to , L-SAR with Magisk has really become a form of 2SI...

A/B L-SAR (type II) devices retain recovery ramdisks in /boot partitions for recovery booting, but Magisk-patching these works since bootloader supports the recovery environments in /boot... The Magisk-patched init in recovery ramdisk is seen by bootloader and initiates the system linux kernel and root functions mentioned above (except where recovery key combo is detected)...

A-only L-SAR (type III) devices have no ramdisk in /boot, but recovery ramdisk in /recovery partition can be patched by Magisk (Recovery mode Magisk) in these cases... When recovery key combo is detected, bootloader sees this Magisk-patched init and if keys are released before a set interval, system linux kernel (in /boot) and root functions mentioned above are initiated...

👀 PW
[Magisk] pndwal:
Have you searched for/used proper safe mode key combo for your device?...

Do you have accessable custom recovery?

🤠 PW
[Magisk] gnirtS:
Safe mode buttons dont work - i still get the same Lineage recovery "unable to load system. Try again or wipe" screen.

I can access recovery, ADB and so on via LOS recovery which is how i reflash the OS to get it to boot (without Magisk). The problem is because theres no root i cant then delete the problematic module as there is no permission for the shell or terminal.

If i then reinstall Magisk for root it also re-enables the bad module so back to a boot loop/error.

FWIW ive tried the magisk remove-modules but it fails as magisk command isnt found and also tried putting .disable_magisk in /cache and /data/unencrypted but again nothing changes.
[Magisk] pndwal:
Yes... The two series John was pretty sure about were Galaxy S10 and Note 10... For others users can just try...

This:

https://topjohnwu.github.io/Magisk/boot.html#piecing-things-together

... Whole document will help you... More on Android/Magisk booting here:

https://topjohnwu.github.io/Magisk/details.html#magisk-booting-process

Sure... I can't see much need for enhanced security on a TV box myself either!...

If unrooted I guess you could install Magisk in /recovery however...

Had to read that twice... Very novel approach!... Well done!... Did you read of it somewhere or use own lateral thinking?... 👍

Interesting implementation I've never heard of also... Guess you Magisk patched boot.img (aka fake recovery setup) could work from there too?...

I wondered about how key combo worked for TV box... Is that typical?... Even w/o the toothpicks?...

Guess you meant patching recovery.img and flashing to recovery here?... I think we've established you must boot via recovery w/ patched ramdisk there cos ramdisk in /boot will simply never work, no?

Yeah, makes sense now... Only in concert with a patched boot.img in recovery... Normal patched recovery.img would require intact boot.img/Android kernel I presume...

Yup, probably ...

I might... But I wouldn't be sad if it does work generally...

Have a feeling it's a special case though, based ability to see boot images on SD alone...

🤠 PW
[Magisk] pndwal:
So only goes to recovery?... I'd try a few more times... Button combo can be finicky... (I wrote extra details in FAQ about this...):

https://topjohnwu.github.io/Magisk/faq.html#q-i-installed-a-module-and-it-bootlooped-my-device-help

So guess you can't see data partition from LOS recovery if data is encrypted as LOS recovery doesn't support decryption?...

If not encrypted you may be able to see /data/adb in file recovery file explorer and delete all contents there (ie Magisk congratulation files) or just module(s)...

Otherwise, install or simply fastboot boot recovery and delete /data/adb contents...

So could try ADB shell command magisk --remove-modules again... I guess you had removed Magisk when you tried before? Should work if you restore (broken) Magisk as only then will daemon be running... (Guessing you patch recovery.img on your device?)

👀 PW
[Magisk] gnirtS:
I've tried a lot. When Magisk isn't installed I can launch it every time. With it, no button combination seems to do anything except the recovery error.

Yep, all I see is encrypted names

I don't have permission to delete or see that either in recovery or from the OS with a shell or USB debugging. I think I need root to alter that folder from the actual booted OS.

Can see the error screen when it fails to boot. I can enable ADB but the Magisk command isn't found. I can't see any of the folder structure from it either except the 99- survival script. Which I can't delete due to a read only file system.

Selecting mount system partition from the same advanced menu seemingly changes nothing.

So summary, I can boot fine with an OS image but obviously then I need to reinstall Magisk. The second I do that it's enabling the module and going to the above error screen. I can't get it to start in a safe mode.
[Magisk] n.p.:
Thanks for the link. I will definitely read the whole thing.

Yes, but I would like to see an up to date Webview (aside from the security issues, some apps and sites now expect functions not available in older versions).

I did see the idea about forcing booting from the recovery partition by zeroing out the boot partition somewhere else. I didn't really have any other options besides trying the patched boot.img in the recovery partition.

Yes, as I verified later in my reply to @J.Michael.

Yes, the "reset button" (which normally forces booting into recovery) placed in the back of the headphone jack appears to have almost become a "standard" on Android TV boxes.

I meant more convenient than the "typical" setup for most devices (usually a patched boot.img file in the boot partition, but not in this case) where you have to mess around with toothpicks (or key combinations) to boot a recovery image.

Thanks to both of you for your help.
[Magisk] pndwal:
Sorry, I meant to say "Otherwise, install or simply fastboot boot

TWRP

recovery and delete /data/adb contents..." there... TWRP should decrypt assuming you can enter lock screen password or pattern...

So try TWRP if available... Or others may have ideas?

Otherwise you may need to boot unrooted and save all your data, messages etc, then wipe data to fix... At least user data isn't lost... 🤪 PW
[Magisk] J.Michael:
@gnirtS How did you put a file ".disabled" in /data/adb?

If you have that kind of access, you should be able to delete or rename /data/adb/modules.
[Magisk] J.Michael:
@n.p. The usual way to install Magisk in recovery is to patch the recovery image, with the Recovery option checked; then flash *that* to the recovery partition.

Did you ever try that? Or did you skip it because you didn't want to have to deal with fussy buttons?

When I installed Magisk in recovery, I expected to have to suffer with the fussy button mess every time I wanted to boot Magisk. (There are qualifications: we are told that selecting the Power->Reboot, or using a Reboot button in the Magisk app, will reboot with Magisk active.)

What I found was that after that first, awful, struggle to boot towards but not quite to recovery, once I finally got Android with Magisk active, if I power off -- completely shut down -- and boot by just holding Power until the tablet starts to boot, I get Android with Magisk active.

I don't know if there's something special about my tablet -- Samsung 8" SM-T290 -- or if Magisk was altered between the time the instructions were written and the time I grabbed a copy.
[Magisk] gnirtS:
Sadly this is only before magisk is reinstalled following a flash of the original rom. It seems to be removed when magisk is reflashed and doesnt do anything.
[Magisk] zgfg:
I don't remember what will happen with .disable_magisk upon reinstalling Magisk, but if you put .disable (not .disabled) to /data/adb/modules/<particular-module-subfolder>

then, upon reinstalling Magisk, that particular-module should remain disabled- IF your DIDN'T WIPE /data.

So eg, if you just fastboot flash or boot to the boot img patched by the new Magisk

Also, I don't remember possible peculiarities with Kitsune

Generally, it's always better to experiment by patching the img and then temporarily booting by fastboot boot <patched-img> than to permanently flash by fastboot flash ... or by Direct installing or installing through TWRP (custom Recovery). If anything goes wrong (eg, you patched the wrong img, etc), you can simply reboot to your previous setup. On the other side, i you flash permanently and something went wrong, you would have the bootloop
[Magisk] gnirtS:
Can you clarify exactly what i do there (ive never played with fastboot).

Would i simply boot into recovery and issue adb fastboot boot <filename of twrp> ?

Its about 8 years since i last played with twrp/fastboot type things.
[Magisk] zgfg:
No such thing as adb fastboot

Just eg fastboot boot <recovery.img>

You need to have installed ADB and Fastboot (client and drivers) on the PC, being connected by USB and phone must be in Fastboot mode. On the phone screen, you will see FASTBOOT MODE and you cannot use the phone screen. Phone is not in the System/Android as for ADB

(For ADB commands phone must be in Android/System, so Fastboot is not ADB or adb command. Fastboot are separated commands for use from the PC)

If not familiar with Fastboot, please google about, ,you will learn the basics in 15-30 minutes.

It's OUT-OF-TOPIC to give here the basics what is Fastboot, how to use, how to enter the phone to Fastboot mode, etc - there are good guides on the Net, YT videos and so

It's really DANGEROUS to play with Fastboot if you first don't take your time to read things and understand (ie, just based on one command somebody post you here)). Once you do the homework, you will generally know how to help yourself :)
[Magisk] gnirtS:
OK slight update, i CAN boot with "safe mode" with vol up/down and power.

However when in the OS Magisk then appears not to be installed and i have no root.

i dont have permission to do anything or even see in /data as a result.

magisk command isnt found either so i cant use a --remove option

gts4lv:/ $ ls /data
ls: /data: Permission denied

gts4lv:/ $ su
/system/bin/sh: su: inaccessible or not found
127|gts4lv:/ $ magisk
/system/bin/sh: magisk: inaccessible or not found
[Magisk] zgfg:
Ok, but what did you want to obtain by booting to the Safe mode?

It is the Android Safe mode and in the Android Safe mode Android disables certain functions. All apps, hence specially all Magisk modules and root apps will not work fully functionally

However, there is one PURPOSE to boot to the Android Safe mode, and after that back to the full/normal Android mode. In that case, that next time you boot normally, Magisk should come-up with all modules disabled - therefore, this is just another way to recover from the bootloop caused by an errant module

However, on some phones it may not work correctly if Magisk did not recognize that System was previously booted into the Safe Mode

For more info, please checkthe official Magisk Instructions (you have the link from your Magisk app) on the Magisk Github:

Installation

The Magic Mask for Android

topjohnwu.github.io

Frequently Asked Questions

The Magic Mask for Android

topjohnwu.github.io

From what you posted, it seems that Magisk was not installed previously, therefore there is also no Magisk when you booted to the Android Safe mode
[Magisk] J.Michael:
(I don't understand why you quoted a post of mine that was directed to @n.p.)

I'm not sure what you are telling me here. Earlier, when you were trying to disable modules, thinking a module was responsible for your bootloop, you said you tried putting magic files in magic places.

If what you meant by "tried putting file in /data/adb, but it didn't work" was "could not put file there", then we're done.

If what you meant was "managed to put file in /data/adb but that didn't disable module", then I would like to know how you put the file there.

@zgfg has already pointed out that you probably misspelled the magic name. You might have put the file in the wrong place. But if you were really able to create the file, you should also have enough control to delete /data/adb, or rename /data/adb/modules, ...

Were you able to create the files? How were you able to create the files?
[Magisk] pndwal:
Yeah, so fastboot boot twrp.img with twrp.img (ensure it's correct version/build for your device) in PC ADB directory... Then use TWRP's file manager to remove /data/adb contents...

Have you done that with after re-installing Magisk patched boot image?... Daemon must be running as I said, so won't work with no Magisk...

Also, I asked if you patch recovery.img or boot.img... You didn't respond, but I guess/ recovery.img?... In this case it's doubtful that Safe mode will work to write ‘disable’ file as standard booting would be to Android without Magisk and I assume daemon wouldn't be running when entering Safe mode either... I don't know if it's possible or how to boot to Safe mode via recovery to enable Magisk, but I expect it's not possible...

Likewise for ADB shell command magisk --remove-modules, you'd need to have daemon running so would need to have begun booting Android via recovery if you use Magisk in /recovery ramdisk, even if broken boot returns you to recovery... You could try that if you didn't already...

For safe mode, if background root is present (despite fact that Magisk App won't see it), you wouldn't need to manually do anything; Magisk daemon writes the file if you got the key combo timing right... Just reboot to system with Magisk...

Try booting via recovery (if Ramdisk=No and you root /recovery) as above...

Further good news FYI, if all the regular methods above fail, others have developed a special 'core-only'-Magisk that can be used to disable Magisk... Another user did it first and published how modules functionality can be disabled before building Magisk, and XDA contributor @badabing2003 has now produced several such

builds (and embedded a way to invoke the same from his PixelFlasher utility... Please read about usage for latest build here:

https://github.com/badabing2005/Magisk

... Branch drop-down at top of page will get you to older builds if needed... Just installing a special build should work for you... (If that installs but doesn't fix boot issues you can be fairly confident that modules were not the problem.)

👀 PW
[Magisk] J.Michael:
The Magisk FAQ explains that there are two Safe Modes. There is a manufacturer (or ROM) dependent key combo to get to Android Safe Mode. There is (I think) a universal key combo to get to Magisk Safe Mode.

At least some times, after booting to Safe Mode, it is only after one more reboot that you can expect to be in un-Safe Android with Magisk active and modules disabled.
[Magisk] pndwal:
Yes, and the extra detail was added as I found system Safe mode doesn't activate 'Magisk safe mode' where on-line guides for key combo timing are followed in Xiaomi devices (possibly others) and users erroneously concluded modules must not be the issue since (system ) Safe mode had activated... In fact the issue is that Magisk 'safe mode' is different and had not been activated due to different timing required although the key combo is otherwise the same.

However as I explained above, Magisk must still be running in background for Daemon to detect the key combo (which it does earlier than system does), and for 'Magisk safe-mode' to do its thing (writing creating ‘disable’ in modules directories)...

Problem here is that the device in question is an A-only L-SAR device, and if there's no B/L support for ramdisk in /boot, Magisk will be installed in /recovery... I'm waiting for member to confirm, but I doubt Safe Mode for Magisk can activate at all where Recovery mode Magisk is used... Magisk daemon simply won't be running unless Recovery key combo is used AFAIK, and I doubt there's a way to reliably do that and have Magisk detect Safe mode key combo also...

This may be why all methods have failed so far, and @badabing2003's Special Magisk builds may be the best bet for this and other Recovery mode Magisk installations. 🙃 PW
[Magisk] J.Michael:
As long as the key combo for recovery is not Power-VolDown, there is some hope that you could release the recovery buttons early enough, and switch to Power-VolDown for Magisk Safe Mode. Except unless Power-VolUp is the Android universal way to get to recovery, Wu can't distinguish between recovery-combo and Magisk-Safe-Mode-combo.

I know it requires some forethought, but having USB debugging enabled and using adb to run magisk to delete all modules sounds like the most reliable approach.

Why would anyone *not* have USB debugging enabled?
[Magisk] pndwal:
Yeah, may be possible, but I'm doubtful and don't have S10 device to test... Just wondering if some members realise that boot to Android w/ Magisk must at least initialise for Magisk Safe Mode to have a chance so standard booting or Safe Mode key combo just won't cut the mustard on S10 series...

Yeah... BTW have you done that?... Easy enough when Magisk resides in /recovery?...

Because banks/games etc detect?... Maybe cos it can be dangerous when plugging into public USB ports, even if they're only designated chargers?...

Anyway, with that, safe mode and TWRP access failing, @badabing2003's 'Special' core-only Magisk may be the simplest solution; this is exactly the scenario that makes it's existence important... 🙂 PW
[Magisk] J.Michael:
Done what?

I have USB debugging enabled.

I may have tried adb once, but since I had to ise Odin, and there is no fastboot, I never had much use for adb.
[Magisk] pndwal:
?... 'used adb to run magisk to delete all modules' on a Magisk-in-/recovery device...

... So guess not? PW
[Magisk] J.Michael:
No, never tried to delete modules.
[Magisk] Chizz3x:
Patched boot and recovery images and flashed them via fastboot. Device is rooted now, except, a problem.

Whenever i boot into magisk my device is rooted but sides on my touch screen are unresposive.

If i boot up normally, obv no root but whole touch screen functions normally.

Why is this touch screen problem present and how can i fix it?
[Magisk] J.Michael:
Don't know why you're having problems with touch screen sensitivity.

Hung up on: "Patched boot and recovery images"

That is not the normal procedure. If you have to install Magisk in recovery, you patch recovery. If you don't have to install Magisk in recovery, you patch boot. If you have a Samsung (you don't say, but you say you have fastboot, which I expect to mean "not Samsung"), you patch a tar file that contains boot and recovery, and Magisk touches boot even if it is installing itself into recovery.

How are you "booting up normally"? If you mean by not using the buttons to boot towards recovery, then you do not seem to have Magisk installed in the boot image.

Maybe explain in some detail how you patched boot and recovery and flashed them via fastboot.