yashsingh1/xdaforums huggingface dataset:
[Magisk] zgfg:
Thx for hexdump and xxd.

I used od -A d since it gives me bytes offsets in decimal format (not hexadecimal), that is better readable for human, and ready for the next command dd count=

---

It was fastboot command, not adb. And of course, when the phone boots to System, fastboot cannot be connected anymore (fastboot is only for Fastboot mode). But who cares - you can disconnect the cable right when the phone starts booting, or later at any time

Hence, when it boots to the System, open Magisk app and inspect does it show the Magisk and the right version, etc - actually, the main test was that it didn't bootloop

You can test if root works etc, just don't reboot (it would reboot then not to that newly patched boot IMG but to the boot IMG that was previously, last time permanently flashed)

If all ok, just do Direct install and reboot, it will flash Magisk permanently to Boot.

(Alternatively, you can reboot again to Fastboot and flash then permanently the patched boot IMG, but with Direct install it is easier and faster - while, on the other side, you already tested by temporarily booting that IMG was ok, prior than flashing it permanently)

---

And if the test with temporarily booting to the patched img was ok, who cares then about the padded bytes or not

Or you can strip the padded bytes, patch, test and use if ok

I used to strip them since I always store couple of the latest patched boot images (together with the corresponding Magisk apks), just in case, if I later discover that something else was bad with that version of Magisk, that I can easily revert

Then striping the padded bytes was useful to save smaller IMG files (but it makes sense only if there are really tens of MB of padded bytes - while in that case boot images can be also simply zipped, it would save almost the same amount)
[Magisk] J.Michael:
I have gotten that far. Repeatedly. What I cannot do, even with @pndwal's instructions, is find a list of Magisk APKs identified by what I recognize as Magisk versions, like "25209".
[Magisk] Nergal di Cuthah:
March 2nd

You also might have it in your downloads folder
[Magisk] zgfg:
Unfortunately Canaries are not tagged by the useful version numbers but instead by the hexa, like 2717feac

Hence you must either know when exactly a particular Canary version was released (like two weeks ago) or its hexa tag like 2717feac

And that is pretty useless, BCS you would hardly recognize by dates what was eg 25206, and you usually do not remember its hexa tag

It means that you must also open the changelog files to decipher which date corresponded to 25206 (and not to 25205 or 25207), and so on

And if you want to locate the correct downloads for even older Canary versions, you would waste more time (usually, you have not even a rough idea from which date to start searching up or down)

It just seems like it was intentionally made hard and frustrating to search/find, to force most users to give up😁
[Magisk] J.Michael:
So if I somehow find my way to

Releases · topjohnwu/Magisk

The Magic Mask for Android. Contribute to topjohnwu/Magisk development by creating an account on GitHub.

github.com

and know to expand "assets" in various places, I can find a recognizable Magisk-25209.apk.

I still cannot find a sequence of links starting from Topjohnwu.
[Magisk] ctcx:
Yes, sorry, my mistake...

BTW, I read that one could also patch the boot image via adb shell, with the boot_patch.sh script included in Magisk.

As mentioned in the installation docs, Magisk patching process includes setting correct options for the cases of ramdisk/non-ramdisk and vbmeta/non-vbmeta before actually attempting to patch.

However, after searching in the Magisk docs, the boot_patch.sh script is not documented there. So I tried looking at the script itself:

Magisk/scripts/boot_patch.sh at master · topjohnwu/Magisk

The Magic Mask for Android. Contribute to topjohnwu/Magisk development by creating an account on GitHub.

github.com

But I'm still not sure how to use the flags...

For example, if I have ramdisk A/B partitioning and no independent vbmeta partition, would the flags be RECOVERYMODE=false and PATCHVBMETAFLAG=false ?

Thanks yet again.
[Magisk] joefuf:
Having read the last few pages, I see that there are issues with 25210.

Hoping to confirm that my issue is related to whatever is broken in that version. I have 25210 installed. I patched the boot.img and init_boot.img from the March update on my Pixel 7 Pro. After flashing those to my phone, I am told that my phone is rooted, but I still am not able to use any root tools (eg. Debloater and AdAway).

I got an answer from someone suggesting that "March is a feature update, so magisk may need to be patched to work" which is not something I've ever heard/experienced before, but would understand.

Is that an example of something broken with 25210 which I could remedy by using 25209 or would I have to wait until there is a 25211? Or a different issue altogether?
[Magisk] xunholyx:
From what I've read here lately (on XDA in general not this thread in particular), using 25206 might be your best option. I'm still using 25206 without issues on my Pixel 7 Pro. It's not on purpose, I've just not updated Magisk in a while.
[Magisk] joefuf:
Is there a way to grab specific Canary versions? Or can you post your apk?

And to install an older Canary version, do I need to completely uninstall Magisk and lose root or just the Magisk app on my phone?
[Magisk] J.Michael:
All of this has been covered in the last few hundred posts. Some much more recently.

To find a specific Canary version, start at the root of John Wu's github. Depending on how recent the version is, you look in "magisk-files" or "magisk_files". You will *not* see APKs identified as "25206", etc. -- you will need some idea of when it was produced. Or you will need some cryptic hex code that is associated with the release.

The safest way to install a different version of Magisk is always to uninstall Magisk, uninstall the Magisk manager app, and start over. There are lots of cases where you can skip steps or substitute steps, these are discussed in posts. You will spend less time just doing it than you will spend reading to assure yourself that you are a special case that can use another procedure.
[Magisk] zgfg:
Sorry, I will no more spend time to answer - about few months ago we extensively discussed about boot_patch.she here and how it can be used

Vbmeta was also discussed, etc

Please search back in the thread - recently it was also posted how to use Search in XDA (also for the n-th time)

Edit:

Open the script and read the Usage comments on top - and throughout the code. Everything should be pretty much clear, how to use and how it works
[Magisk] J.Michael:
adb shell is like opening a shell (or terminal window) on the Android device. It might be more convenient because you have a real keyboard and monitor; it might be more convenient to open a terminal window (terminal emulator) on the device, and not need to connect to a PC.

Is there a reason why you are digging into patching an image using CLI commands, instead of just using the Magisk manager app to patch an image?
[Magisk] ctcx:
Yes, sorry.

I did search, and found this:

https://xdaforums.com/t/magisk-general-support-discussion.3432382/page-2608#post-87014873

Starting from here, I realized that boot_patch.sh can only be run with root, and if I ran OTA updates, device is no longer rooted, thus cannot run the script.

So my only option is the other one @ipdev mentioned: extracting /lib/<arch>/*.so directly from Magisk apk.

But, according to his examples on this and the --help, at most one unpacks and repacks! No patching functions at all here!

WTH?

Because I need to make it an automated script for PC, because I'll need to update frequently (as soon as weekly), and doing it manually will cause me pain...
[Magisk] pndwal:
Base magiskboot tool and usage is described here:

Magisk Tools

The Magic Mask for Android

topjohnwu.github.io

Correct

Well instructions state:

If your device does NOT have a separate vbmeta partition, check the “Patch vbmeta in boot image” option

So perhaps this should be true?...

But, not having played with these settings I'm not sure... Differences between flags confuse me, eg seems

KEEPVERITY=false

and

PATCHVBMETAFLAG=true

equate to:

fastboot flash vbmeta --disable-verity

and --disable-verification vbmeta.img

... But not sure of different effects when device relies on vbmeta in boot image... 🙃 PW
[Magisk] joefuf:
Thank you for confirming all of my questions even though the topic has been covered. I was able to uninstall Magisk, reboot, and reinstall 25206 (which I conveniently had in my Downloads folder from setting up my new phone the other week). Patched the March 2023 init_boot.img for my Pixel 7 Pro, and flashed it successfully. Glad it was this easy.

Attaching my Magisk Canary 25206 file in case it helps anyone else.
[Magisk] Greeneyes420:
Just had an idea and decided to throw it out there maybe im dumb but it possible for your device to enter aggressive doze while smartview is on for watching movies???
[Magisk] Nergal di Cuthah:
What does that have to do with magisk general talk?
[Magisk] Greeneyes420:
Idk someone could make a module lol
[Magisk] Greeneyes420:
I didnt care i just posted it here man sorry..... God.....
[Magisk] pndwal:
That's because Canary and Debug are not 'public' releases (which is why their Update Channels don't appear in Public builds and a user must manually download Canary/Debug to change from Public) so the repo is simply set up to fetch latest builds for Canary and Debug... This means that since they are generally 'done with' when next release comes, the archives are simply left as-is and no effort is made to list builds, versions and changelogs separately...

Public Beta and Stable on the other hand, are nicely listed in a Release page with release notes and changelogs linked...

Follow my post above:

so when you get to '--> select a build by date', just scroll down to 'notes.md' current changes in green to quickly identify corresponding version... Skip back or forward thru builds to find wanted version this way...

Not a convenient list, but fine for Devs and testers... And mavericks... 😜

You need to remove Magisk core/mask built with release flags in order to downgrade...

Installing Debug (built with debug flags) works around version checks and allows downgrading w/o PC using Direct install... Details/reasons here:

https://xdaforums.com/t/magisk-general-support-discussion.3432382/post-88254695

🤠 PW
[Magisk] zgfg:
Look into the PixelFlasher thread. That's the tool for Pixel phones, doing similar things

You could maybe use/modify, discuss with developer, etc
[Magisk] m0han:
Depends on how @joefuf or any user wants the result, I guess. @zgfg's post describes his experience thus:

booted with the original, not-patched boot.img and then later booted again with the boot.img patched by Magisk, and /data was not erased, specially /data/adb was not erased... When I booted with the patched boot.img again, I continued using Magisk, magisk.db (database), modules folder, etc, everything was there as left before
[Magisk] donjoe0:
Haven't found anything with search, does anyone know if Magisk works on GrapheneOS, at least for non-root modules?

LE: Ah, never mind, it was in a different section of the forum. https://xdaforums.com/t/fyi-magisk-works-on-grapheneos-and-calyxos.4473445/

Doesn't mention any "rootless Magisk" scenario though.
[Magisk] badabing2003:
You can create a patch, you can extract the script and the libraries and run it.

The details of it was discussed in this thread, that is how PixelFlasher does it if you are not rooted.

Take a look at the code, or better yet create a patch with pf while un-rooted and see the script it generates, all of which is visible in the console.

If the flags used is good enough for you, you're good to go.

If not, just cancel at that point and edit the script and run it manually.

If it happens that you need to pass different flags, I can add an option to PF to set the flags as you want.

Alternately it's open source, so you can modify it to your heart's desire.
[Magisk] pndwal:
Well you've got me intrigued!...

What is "rootless Magisk"? ... Is it a bit like a fly with no wings?

... And what are "non-root modules"? ... bit like the vegetarian sausage? 😜

Actually, I'm really curious... 😃 PW,

- Underground Airways, CEO
[Magisk] donjoe0:
Ah, my bad x2. I installed it so long ago I forgot what its core capabilities were, I thought it also made it possible to install modules that act like system apps but somehow don't need root to do it. Also I misremembered that ViPER4Android could be installed rooted or unrooted, but it was actually system app or non-system app. 😅

Maybe I'm also misremembering that Magisk was the last way I found that worked to install V4A on newer Androids, but that might be wrong as well, I'll have to check.
[Magisk] pndwal:
This repackaged ViPER4Android module works well for many here currently:

https://github.com/programminghoch10/ViPER4AndroidRepackaged

... Root required! 🙂 PW
[Magisk] owenshadbolt:
Hi All, Just a general question and proposal for a new project.

Has anyone considered that magisk might be a perfect tool to inject a device agnostic 2nd stage bootloader like uboot or grub into the the usual boot process.

What thoughts? If this would make a viable project what would be next steps?
[Magisk] J.Michael:
Not particularly Magisk related. If you can flash partitions, and this bootloader of yours is on a partition, you are free to flash one. Then you just have to deal with the previous stage's refusal to run anything that isn't properly signed.

Device-agnostic seems like an awful big ask.
[Magisk] zgfg:
Magisk starts in parallel with Android

IMO, replacing Recovery would be a more reasonable choice
[Magisk] sergej_7:
how do I know which backup is the correct one before canary broke?
[Magisk] zgfg:
Properties, look at the dates

Usually, you need only the latest

Btw, Magisk Delta deletes by itself all but the latest
[Magisk] sergej_7:
thx Solid Explorer was not showing any dates found 25206 in sdcard and flashed with Franco Kernel Manager adaway works again now :)
[Magisk] pndwal:
To multiboot?... Magisk is absolutely the perfect tool for this: John Wu spruiked MultiROM support as a feature Magisk is quite capable of enabling himself, and apparently no 3rd party multiboot initiative like uboot or grub is even needed!

What's more, John actually achieved this himself with a POC for systemless overlayed OSs:

...So completely systemless approach may be best approach even now... Or not... 😬

John's Magisk MultiROM project sadly stalled, but I put links etc here:

Research and do it?...

I'd love to see this picked up by some capable Dev! 👍 PW
[Magisk] ctcx:
Just want to start mentioning: I already began studying all the stuff:

Magisk Tools

The Magic Mask for Android

topjohnwu.github.io

Magisk/scripts/boot_patch.sh at master · topjohnwu/Magisk

The Magic Mask for Android. Contribute to topjohnwu/Magisk development by creating an account on GitHub.

github.com

I still have a long way to go, but for the time being I think my only way would certainly be @ipdev 's way: without root, unpacking the *.so 's from apk directly and use them manually.

Just, looking at the Github code above, when setting the flags precisely, I have no idea what that "config" file could be. If someone could give a clue...
[Magisk] ctcx:
Already tried looking at Magisk code, but it's still a bit complicated for me yet...

How does Magisk determine whether device is "ramdisk" or not? Could I find this out with just adb shell someway?
[Magisk] ctcx:
I began practicing with an already old Motorola unsupported device: a 2015 model with non-A/B partitioning, using recovery.img instead of boot.img, and LOS 17.1.

From the phone downloaded Magisk 25.2 apk from Github, and installed directly from there.

Surprises:

---no "Uninstall Magisk" button at all

---Magisk said "Ramdisk: yes", but when trying to install/patch a boot.img just for testing, the only options I was given was the vbmeta-related one. No option of whether patch ramdisk or recovery...

I had to rename Magisk apk to uninstall.zip and adb sideload it in recovery, in order for the damned "uninstall" button to appear.

Is all of this expected? Was it because it's an old device, or is it in ALL devices?
[Magisk] Fry-kun:
Just updated to 25210 (canary) and lost systemless hosts:

* AdAway can't apply anymore

* Uninstalled systemless hosts module, reboot

* Tried to install systemless hosts from magisk settings - says applied, but doesn't show up in modules list

Sounds like a bug ☹️
[Magisk] pndwal:
Y u p . . .

Read back...

Several issues related to selinux/module rule refactoring from 25207... Other issues with 25208... Some issues fixed w/ 25209 but still module issues etc... Got worse with 25210... Some reverted to 25209... Others recommend waiting on 25206...

... Well it's canary! 😉 PW
[Magisk] Fry-kun:
Thanks for reply/recap!

Any easy way to revert from the phone? Or need adb connection/etc?

Edit: found a YT video that explains you can download the APK, rename to .zip, and install it as a module. Hopefully that works 😯
[Magisk] J.Michael:
I don't know what Youtube video you watched, but I'm pretty sure you never install the Magisk APK as a module.
[Magisk] zgfg:
Again, read the posts from the last ten days in this thread
[Magisk] Fry-kun:
I'm sure it's not designed to be used this way, but it certainly worked! I'm probably very lucky I still have a bootable phone 🤪

(Also lucky I kept the old APK)

youtu.be/VLWDxn2pQzU
[Magisk] zgfg:
@Fry-kun, @J.Michael

It's not recommended but maybe it works. AFAIK, there were posts time ago here about

Magisk apk is actually a zip file that can be used for TWRP for flashing (with the 'newer' TWRP versions, one even does not need to rename apk to zip)

In the Magisk app, when installing a 'module', it maybe also correctly recognizes that Magisk apk was the installation zip file...
[Magisk] J.Michael:
Do you understand the difference between the Magisk manager app and the magic part of Magisk that gets embedded in the boot or recovery image?

When you first install the Magisk manager app APK, you have installed an Android app. If you want to uninstall it, there is probably a button in the system app info.

The "Uninstall Magisk" button in the Magisk manager app would be to uninstall the magic part. If you never installed the magic part, there is nothing to uninstall.

I think over time John Wu tried to make it easier by not showing buttons he doesn't think you need. So if you patch a file named "boot", he doesn't offer a "Recovery" button. If you patch a file named "recovery", he probably uses the Recovery option without asking you.

As for patching the ramdisk, that's what happens with or without the Recovery option -- whether you patch boot or recovery, a ramdisk gets patched. (If there is no ramdisk, one gets created, and the lawyers can argue about whether that qualifies as being "patched.)

And you need to pay attention to what you call "install/patch": There is no "install/patch", you can use the Magisk manager app to patch a boot image (or a recovery image), put you have to do something else to "install" that patched image.
[Magisk] pndwal:
Just a check for factory (not Magisk/manually added) ramdisk in /boot...

Ramdisk=no devices are only legacy SAR A-only boot type, ie. single 'slot' Android 9 devices circa 2018, 2019...

You can check boot image code for ramdisk cpio...

Recovery mode will only show for Ramdisk=no devices and will be checked by default to indicate that Magisk in boot probably won't work... The toggle is offered because Magisk in boot actually does work for many Ramdisk=no devices, notably Xiaomi, so Magisk always adds a basic ramdisk in boot where missing just in case bootloader is inexplicable compatible with ramdisk in boot (Magisk still indicates Ramdisk=no correctly, is. no factory ramdisk) and allows users to deselect Recovery mode (ie. to use boot mode) Magisk...

👀 PW
[Magisk] pndwal:
(Finer points)

Well if there's no factory ramdisk in boot he sets Recovery mode as default as lack of ramdisk there is a good indicator that bootloader will be incompatible. He offers the Recovery mode toggle in these cases however (and has added a routine where Magisk always adds a basic ramdisk if missing in /boot so boot.img can still be Magisk-patched correctly and tried by user) just in case the manufacturer has inexplicably supplied a bootloader compatible with ramdisk in boot... So while recovery mode is checked by default, John doesn't exactly 'use the Recovery option without asking you' because it shows up and users can disable it..

Yes, it's patched, and successfully what's more if recovery mode is deselected (especially important for Samsung devices as mode determines how AP binary is patched), but flashed magisk-patched-boot.img often won't work (as expected) due to bootloader incompatibility... The only way to know if it will work is to try...

And yes, if it doesn't work user is back to square one and must patch recovery.img, ie recovery ramdisk must be patched to contain magiskinit... Magisk is always installed in ramdisk... PW
[Magisk] pndwal:
Actually, that's a good known trick, but I hadn't considered it for bypassing inbuilt Magisk downgrade prevention (Magisk daemon now checks App version as well as signing keys and will forcibly uninstall an app with different keys or older version)... I'm adding it mentally!...

The official way to use older or different builds is either to uninstall Magisk (ie. Mask/core, not App) or to install Debug build, both of which will disable version (and signature) checks allowing users to downgrade App etc and then take Direct install to install corresponding binaries (Mask/core)...

👍 PW
[Magisk] pndwal:
Options in Magisk mostly show per device now... Check convo thread here:

https://twitter.com/i/web/status/1297833910320021504

👀 PW
[Magisk] pndwal:
Remember this?:

Then you're too old!... So-long Lollipop...

www.twitter.com/topjohnwu/status/1636674099492835328

@canyie would like one more lollipop flavoured Magisk... PW
[Magisk] podiwadda:
Hey. Need support on this

I've installed Magisk latest and installed few modules. Including Magisk bootloop protecter. + magisk hide and universal safety net fix. This happened after I install the bootloop saver module. Once I restart the device magisk app remain in the phone but root access gone including all modules. Then I reflashed the magisk. Still the same, app remaining in the phone but no root or can't install any modules. Tried few times now . Still the same , then I tried to dirty flash my current Rom. Still the same. Magisk app remaining but reflashing doesn't show the magisk installed. Only app installed.
[Magisk] jons99:
just flash your patched boot img in fastboot

"fastboot flash boot patchedboot.img"
[Magisk] zgfg:
If it happened after you installed a particular module, reinstalling or reflashing Magisk will not change/help since Magisk will always again find the problematic module in /data/adb/modules

If you have TWRP, use its Advanced File Explorer, go to that folder

and find there various subfolders,beach one corresponding to one of your modules

Recognize the subfolders by their names (should resemble module names)

Disable problematic module(s) by placing an empty or not file named disable into the particular

/data/adb/modules/<subfolder>

and reboot

Upon rebooting that module will be disabled

If you use the file name remove, that will uninstall/remove given folder

---

Alternatively use Android Safe Mode or adb - go to Magisk GitHub, Documentation, FAQ and read Q1:

Frequently Asked Questions

The Magic Mask for Android

topjohnwu.github.io
[Magisk] rodken:
If fastboot flash boot patchedboot.img doesn't work

-- fastboot flash boot_a magisk_patched.img

-- fastboot flash boot_b magisk_patched.img

..... In the event that the device has an A/B partition.