yashsingh1/xdaforums huggingface dataset:
[Magisk] zgfg:
I'm telling you from the first hand experience that patching Boot and flashing is enough

The whole procedure for (various) Xiaomi phones (with various Android versions) has been extensively discussed and confirmed also in this thread

I'm just telling you, don't complicate when not needed. But if you insist on vbmeta, your choice

And frankly, if you would strictly follow the official guide, you would probably go for patching and flashing Recovery (not Boot), because your Magisk app probably reports Ramdisk No

But again, disregard and just patch and flash Boot because that is confirmed by all of us Xiaomi users here and elswhere

(In fact, on your old phone you can also install Magisk by flashing the apk renamed to zip - although that procedure is officially not 'recomended')
[Magisk] pndwal:
Correct.

Optional, but Magisk in Boot usually works on Xiaomi as mentioned, although I've seen users with Magisk in Recovery ramdisk working on Xiaomi also in recent times... But why would you?? 😁

Covered by others also; just type and execute the CLI line officially given if you wish to do this...

No it doesn't!!!... it explicitly says "(Optional) ... you can patch the vbmeta partition..." as in 'if you so wish', or 'if it pleases you'! 😛

Then give it a go without extra patching first... If this doesn't work, consider researching forums for your device and patching the vbmeta partition!

Magisk installation is complicated by a plethora of boot protochols (4 basic types each with variations on init, partition schemes etc etc), but amazingly the standard app settings and flash instructions slated "For most devices..." just work...

John gives optional methods in addition for when these don't....

🤠 PW
[Magisk] Slluxx:
Is it possible to patch a boot.img file on the phone triggered by a command via adb?

this would be very helpful and reduce the time i have to spend on this step by a lot

Edit to clarify:

I have an sdcard in my phone which i have basically set up in raid mode (i guess). my phones internal storage and sd storage are combined and i later noticed that i can not access the sdcard this way in TWRP. so i have to download every ota update manually, push it via `adb push` within twrp, then extract the boot.img file and get it on my phone after it restarted, just to patch it, get it from my phone and install it via fastboot.

I could write a simple script that does everything automatically if Magisk binary supports a patch argument (which i have not found).
[Magisk] laur89:
Correct, but this is xiaomi-specific exception, also hinted at in the wiki.

You might've quoted wrong part from my post, but

unticking

Recovery Mode option is clearly right thing to do, as we're patching boot.img and

not

recovery.img - this has nothing to do with the whole vbmeta debacle.

Well the wiki is a bit ambiguous there imho. I interpreted it being 'optional' as in only if your device has a separate vbmeta partition. Or maybe it's my poor reading comprehension :)

To be clear, without patching the vbmeta partition as y'all are recommending, one would tick the '

Patch vbmeta in boot image'

option in Magisk Manager when patching boot.img?
[Magisk] pndwal:
You said "... adb shell ls -l /dev/block/by-name returns an instance of vbmeta, hence my phone has a separate partition for it. This means ... I untick both the Patch vbmeta in boot image & Recovery Mode options."

This doesn't follow; as you state, patching boot or recovery has nothing to do with vbmeta... That's precisely the point, and as such it remains optional...

Maybe... No ambiguity to me; optional is optional, 'you can' doesn't mean 'you must'.

No! You have vbmeta in separate partition as you established, not in boot image! 🙃 PW
[Magisk] ipdev:
Not officially supported (anymore) but, yes you can.

To patch an image while booted into system (with root).

Post # 49,094

To patch an image while booted into system (without root).

Post # 49,112

Not an exact answer for your situation but, it should get you on the right path.

Cheers. :cowboy:
[Magisk] laur89:
Yes that was bad wording on my part - conflating unrelated items. Regardless, unticking 'recovery mode' is correct as we're patching boot.img. (again, this bit has nothing to do with vbmeta whatsoever).

That ticking 'Patch vbmeta in boot image' question was more targeted towards u/zgfg:
[Magisk] zgfg:
In the /data/adb/magisk you will find boot_patch.sh that is supposidely used by Magisk itself when patching. The functions in script are partially commented what they do

Once understanding how it works, you should be able to adapt and use through Terminal app

Alternatively, you could also take Direct install (actually, Direct update) from Magisk app, (Magisk) Install option - it will patch in live to your Boot

You also don't need to transfer the patched boot img to PC (even if you don't have TWRP to flash). You can use dd (disk-dump command:

dd if=/sdcard/Download/<patched boot img> of=/dev/block/bootdevice/by-name/boot
[Magisk] taietley:
Magisk won't install any zip files

android 12 API 32

arm64

magisk 24.0 (support android 12)

24.0 no install zip files, root only

24.1 not checked

24.2 not cheked

24.3 no install, root only

25 no install, root only

Anyone know how to install damn xposed framework? All my installation process stoped on step:

-Copying zip to temp directory
[Magisk] Slluxx:
Since i cant use OTA updates directly, i must involve my pc no matter what.

and i rather extract the bootimage from the zipfile instead of trying to dd it from my system after install.

All i really want is for the magisk binary to accept a patch argument and a path to the boot image to do everything it currently does, just triggered in an automated way, instead of me having to touch buttons and locate the file manually. ill check the sh file you were talking about though
[Magisk] zgfg:
Likely it's not about A12 but the file explorer you are using when browsing and selecting the module zip file

At that moment (copying zip file) Magisk did not start its installation yet, it is still the prep step where the file explorer copies the zip file

There were previously few other users reporting the same problem ('installation' not passing copying the zip file step). Maybe not for A12, but they resolved the problem when they installed an alternative file explorer and selected that file explorer when browsing for the zip file
[Magisk] taietley:
Don't you know can I install zip files via terminal with root?
[Magisk] zgfg:
I did not say to disk-dump the (unpatched) boot.img.

In my dd command if= (source) was the patched boot img in Download folder and of= (target) was the Boot partition.

Hence the disk-dump was to replace copying the patched boot img to PC and flashing it there by Fastbot
[Magisk] pndwal:
But you simply can't in your case as it doesn't exist... He means traditional magiskpatched-boot.img...

Nb. John only added the extra vbmeta options to instructions in January... PW
[Magisk] laur89:
Which implies I might as well ignore anything to do with vbmeta and just patch boot.img (without ticking the vbmeta option), flash it, and move on.

Feel like I'm making this way harder than it needs to be, but there's just so much conflicting info out there.

Thanks for helping out guys, think I got this now.
[Magisk] Slluxx:
aah i see. well, its not an issue to boot to fastboot and do it there. the main problem is to actually patch it in an automated way.

but i might try out the dd command once everything else works

EDIT:

the shell script you mentioned seems to work just fine

Spoiler content hidden.
[Magisk] zgfg:
Yeah, exactly 😃

It's important that the (simple) procedure (without bothering with vbmeta) is proven and works
[Magisk] zgfg:
Run the comnand magisk from Terminal and read its help (man page) about the --install-module option.

I didn't try myself though
[Magisk] taietley:
I'd link additional file explorer and zip was installed. many thanks to you, my dear friend. I waste all weekends before met you))
[Magisk] Slluxx:
Here is a quick and dirty "auto update" script. (please dont blindly use)

Spoiler content hidden.

It still requires manual interaction but i dont think thats avoidable. Two things i would love to get properly resolved:

1. "adb reboot sideload" does not work with TWRP. It boots into recovery but not into the sideload mode.

2. adb seems to have "adb wait-for-bootloader" but once the device is in bootloader, adb doesnt detect it anymore, while fastboot can. Sadly fastboot has no such "wait-for-device" argument, therefore i had to solve it with a while loop, fetching the connected devices and then continue.

Im going to make this script a little more pretty but .. it works!
[Magisk] zgfg:
Interesting. It requires Python installed to PC but it looks that everything can be rewritten to PowerShell (maybe even to the primitive batch)

2) Cannot you execute ( I never tried and I'm not by the PC now):

adb wait-for-bootloader

and then (when it proceeds) follow with:

fastboot flash ...
[Magisk] Slluxx:
Right now it requires python because its simpler to work with than primitive batch. but yeah, everything can be converted to it.

Python can be build to standalone windows, mac and linux binarys too.

Yes, i can execute that and adb will wait for a connection but the connection is never established, even with a device in bootloader mode. It would just wait forever.

EDIT: I think i didnt really thought this through.

Once a new updates gets sideloaded, root is gone, so it cant access "/data/adb/magisk/boot_patch.sh" anymore. One way around this is to patch the boot.image before the sideload happens but i think the correct update/firmware needs to be installed for the boot.img to be correctly patched. Maybe i can find a different way of accessing that script?

My question:

Can i patch a boot.img without having the update installed?

(patch new boot.img on old update, install update, install patched boot.img)
[Magisk] ipdev:
I checked on a couple more devices.

Now Magisk version 25001 (71205bc53)

--

OnePlus 6T. [Stock OOS (Android 11).]

It was still on Magisk 24312 (d3fe3a711). 😛

Updated Magisk and installed Momo.

Momo only found Debugging and OnePlus's broken TEE.

Not the unlocked bootloader.🙃

OnePlus 6T does not support HA so I use minimal changes to pass SafetyNet and get Play certification.

- Magisk Denylist is enforced.

com.google.android.gms and com.google.android.gms.unstable in the denylist.​

Reset sensitive [secure] properties on boot.​

--

Pixel 5a [Official Lineage 19.1 (Android 12L).]

Thought this would be a quick response since my first few tests Zygisk was not found.

Then..

Momo finds Zygisk inconsistently on my 5a. :confused:

It seems to depend on clearing Momo's cache and rebooting. ?

Stop app and clear Momo's cache before and/or after a reboot. :confused:

I can get Momo to find Zygisk when I use Shamiko.

Sometimes it is after one reboot, other times it takes two or three reboots for Zygisk to be found.

When Zygisk is found, all I have to do is stop and clear Momo.

No reboot necessary.

When Zygisk is not found.

Sometimes just a stop and clear of Momo, Momo will then find Zygisk.

Not always.

I have not able to reproduce the same results (Momo finding Zygisk) using DenylistUnmount instead of Shamiko.

Since I can not consistently reproduce the problem, I am not sure how to find it. 🙃

Maybe Shamiko is a bit too aggressive?

Running Momo too quick after a (re)boot to test?

---

Hope it helps in your venture on finding and hopefully fixing the problem. 🙂

Cheers. :cowboy:

PS.

This was a fun experiment. 🙂

I should have been working on other projects but, I needed some time away from other projects. 🙃​

Notes:

Odd modules in my screenshots.

I resurrected mHide SafetyNet a few months ago for testing and reference.

I will archive mHideSN once I get back to USNF PR158.

USNF v2.2.1-j was my last test build.

PPS.

Time to turn on some Dead and get to one of the other projects. 😛

Terrapin Station feels like a good start for tonight.

YouTube - Terrapin Station​
[Magisk] mvlad:
Hey guys,

Having issues with magisk v25 on my mi 9 se.

I've been trying for the past few days to uninstall Magisk 25 (due to it causing issues with my lock screen, making my built in fingerprint sensor not work and making it so I can't interact with my screen on any wake up, only when I lock it back and wake it right back after) and go back to 24.3 but I cannot change my magisk version at all.

Ive tried flashing my og boot img, flashing the installer but renamed to uninstall.zip, using the in-app uninstall method, installing 24.3 on top of the existing setup, and attempted to update to the canary version, but I cannot seem to get away from this version, no idea why.

My latest steps were:

1. Reboot to recovery

2. Flash uninstall zip

3. Flash boot.img

4. Flash rom zip (MIUIMiX, a modded version of MIUI, if it matters. Haven't had issues with magisk before in the year I've been using it)

5. Reboot

6. Open hidden magisk app, it prompts to install the full app to recover

Install full app (from separate apk or prompt, doesn't matter), open it, it says magisk v25 still needs to do some stuff to complete the installation

Magisk log: https://pastebin.com/udUSEnSv
[Magisk] pndwal:
Many thanks... Doubtful I'll find a fix... good info for understanding varying mileage per device though... Hope Canyie / team will fix...

My objective was simply to get clarity on whether bank apps / ItsMe ID are actually now detecting zygisk as a couple of members have now asserted that this is occurring... The jury's still out for me for reasons I've mentioned...

Notice you uncheck (it seems) that one Momo process in denylist sometimes... Please can you say what difference it's making / if it can improve results...

Thank You For The Music! 👍 PW
[Magisk] pndwal:
Your original issue should gone as it seems you have successfully uninstalled Magisk (mask itself)!

Seems your problem is only with stub APK, which tries to update its data w/ Magisk binary to provide obfuscation for App (which is only a dashboard/manager for Magisk).

To install another Magisk build you need to uninstall hidden app; locate it in Device settings, Apps if you have trouble locating... Uninstall any other Magisk App you may have. Next, install new app from Magisk GitHub home, Downloads, and start fresh.

Tip: Taking Restore the Magisk app option before updating, downgrading or uninstalling prevents most issues with an un-hidden app failing to recognise stub... Some app/stub versions are also just incompatible.

🤠 PW
[Magisk] zgfg:
Yes. That's the way I do updates. I extract boot.img from the zip before updating, patch and then I flash the zip update, immediately followed by flashing its patched boot img

But in my case it's just for convenience because Magisk app can patch the boot.img even before the Magisk is installed - must be, it does not execute that script from /data/adb/magisk

You could also think of copying the sh script to Download folder and rewriting it that its output goes directly to the Download folder. Then, you should be able to execute the script without the root and the rest of your adb and fastboot commands do not require root

But it's simpler that you extract and patch the boot.img from update.zip before you flash the update.zip, while you still have previous version of ROM but with the root

(You could even make your new update.zip where you already replace its not-patched boot.zip with your patched one. Then you just flash that zip and you have at once the update already with the new root. In that case you must be careful if zip contains and compares the hashes of images, ie the hash of the boot.img it wants to flash)
[Magisk] Timmmmaaahh!:
What do you mean, "Partition is mounted abnormally"? Your partition is mounted abnormally, Momo! 🤬 The audacity, sheesh!

So, stock OOS 11.1.2.2 (full data/storage wipe) on a OnePlus 6T, hidden Magisk cacf8736 (25001, Canary), Zygisk enabled, DenyList configured & enhanced with Shamiko v0.5.0 (110). This allows most apps with root detection to run but not all. Momo (4.1.0) is detecting abnormally mounted partition and 'TEE broken' as suspicious trace. Will I have to go down the LSPosed path again to achieve better hiding or can I avoid this?
[Magisk] Eng.Raman:
New Zygisk_LSPosed support Dex Optimizer Wrapper and for that property to work it will Mount --bind 2 dex files named ( dex2oat32 and dex2oat64 ) founded in:

( $MODDIR/bin/ ) to ( /apex/com.android.art/bin/ ).

Momo detects this abnormal mount if your ( /, /system and /apex/com.android.art/ ) NOT fully support RW.

I had that detection also in my device ( realme X2 Pro / A11 ) but i Solved/Fixed it and now my Momo 4.2.0 is happy BUT i can't share the method ( May be blocked by LSPosed Dev's ). :)(y)
[Magisk] m0han:
wow! glad to have met a dead fan here! what a long strange trip it's been!
[Magisk] Stillhard:
lol, iknowdafeel :LOL: eviltwisted
[Magisk] mvlad:
Then shy would it still say version 25 is installed at the top in the app, even when a different app version is installed? I also previously tried uninstalling from the app itself which removes the app only for the stub apk to return
[Magisk] zgfg:
At the top it says which version of Magisk (service, mask, whatever you want to call it) is installed.

The second 'paragraph' shows which version of Magisk app (former Manager) is installed

Please distinguish Magisk from Magisk app.

You can have first without the second and vice versa.

Or you can have one with the different version than the other

(Eg, you update the Magisk app but you didn't update the Magisk yet - then it will show that Magisk version is older than Magisk app version

Or you install Magisk app to the non-rooted phone - it will show that Magisk app is installed but not Magisk, etc)

To work properly, make sure that both Magisk app and Magisk are installed and with the same version. That's why it shows both

If not clear, please read the official documentation on the Magisk GitHub page
[Magisk] m0han:
are you using LSPosed stable builds - currently at v1.8.3-65

5

2? or, (always?) the beta ones - currently at v1.8.3-65

7

2?

Spoiler content hidden.
[Magisk] mvlad:
I am distinguishing between the two, it literally still says magisk 25 at the top in the magisk section, no matter which magisk app version I have installed, so it has nothing to do with the app
[Magisk] Eng.Raman:
Zygisk_LSPosed v1.8.3-6572
[Magisk] zgfg:
No you don't distinguish

You have Magisk version 25000 installed (Beta probably) and Magisk app 25001 (Canary).

25000 not equals to 25001

You can hundredth of times install Magisk APPLICATION 25001, it will not make you to update the Magisk itself to 25001

Go to Settings and make sure to have Update channel set to Canary

Go back to front page and press that Update (don't you see that - asking you to update the Magisk, not Magisk app)

And either do Direct update or Patch and Flash - you need to know how you install Magisk to your phone.

If needed, read the official Documentation how to install Magisk (not Magisk app) from the Magisk Github

Then, and upon reboot, both Magisk and Magisk app will show the SAME versions 25001
[Magisk] mvlad:
Mate, you're going around in circles, I said, in my original post, that it doesn't matter which app I have, cause I tried 24.3, 25 and canary. No matter which app I use with which method I go for ("update" on canary, install on 24.3, or uninstall on either of the 3) the version is still 25 when I come back after a reboot. The difference is if I install anything but 25 it prompts me they it needs to do some things before root is complete, still on 25. I know what I'm doing, I've had magisk for years now, this isn't it.
[Magisk] zgfg:
And if you go to /data and delete adb folder.

And if you flash then the boot image patched by 25001 (as I described how to)
[Magisk] Timmmmaaahh!:
Mysterious... That doesn't bring me much closer to a solution though. Why can't it be shared?
[Magisk] zgfg:
Ok, let's ago from the BEGINNING

Open your Magisk app (Canary, v25001), go to Settings and make sure that Update channel is set to Canary

Go back to first page, take Install , take Select and patch the image.

Pay attention to the box where it prints the log.

Save the LOG and ATTACH back

ATTACH also your SCREENSHOTS (I really want to see the PROOF what's going on your phone), like I attached my screenshots

See my screenshots and log, please attach the SAME from your side - THEN we'll see did patch with the proper 25001 version, what was the patched img file and we will proceed furthwr
[Magisk] Eng.Raman:
Try to fix LSPosed Mount point by another different command than ( mount --bind ) OR change the mount path. ;)

Sharing the complete fix may be blocked in the upcoming versions of LSPosed archives.

Good Luck. :)
[Magisk] Slluxx:
Thank you @zgfg and @ipdev . I have a fully working and automated script to both update my phone and patch & flash the magisk boot.img file. The only thing thats missing is the autoreboot after sideload but i guess TWRP has to implement this feature.

The script can both be used as standalone or class to modify it for custom stuff. Ill continue to work on the repo and make everything neat, as well as working on windows and linux binarys & a gui for people that have no idea how to use scripts.

Thank you guys for your help, this will save so much time for me and maybe even other people (at least i hope it will be used). :)

Here it is on github
[Magisk] badabing2003:
Just be careful, in your example you're not setting KEEPVERITY and KEEPFORCEENCRYPT, depending on your phone, you might need to set those.

Just do a binary diff with the one generated by Magisk UI to make sure they match

adb wait-for-bootloader might not work, but flashing waits for bootloader, no?

You might want to take a look at

PixelFlasher on XDA or PixelFlasher on Github

It's written in Python as well :) and it's a GUI App, source available, so you can customize it to work for your phone/needs, although I suspect it should do the job out of the box.

To be honest, I find working with a full factory image easier and more reliable, and it's not any slower either.

If you need something added to PixelFlasher to suite your needs and it is something that can benefit others, I'm open to adding it or accepting a PR, as long as it is not just one corner user use-case.

If the Python script is packaged with PyInstaller, it's a single executable that can be run without Python pre-existing on the system, that's how PixelFlasher does it.

Incidentally, In the PixelFlasher scripts directory, there is a Powershell script, it started as a Powershell script, and then eventually shifted to a full UI App.
[Magisk] pndwal:
Oh, I missed that; just read your description...

Seems twrp uninstall.zip didn't work for whatever reason... (What Magisk.apk did you rename to uninstall? What android version? What twrp version?... May not be compatible, and this is fraught for same reasons installation via custom recovery is post SAR...)

To confirm some stuff:

You never patched recovery.img via App did you? (I see OEM boot Ramdisk = no)... Not booting via recovery either? (If you are, it would explain uninstall.zip failure; none of the custom recovery functions are compatible with Magisk in recovery ramdisk.) And Recovery mode is NOT selected in app? (Should be unselected when installing Magisk in boot, which generally works fine on Xiaomi as you may know...)

You still need to remove that hidden app (stub) as a priority for reasons I mentioned... Then, with root, it should be a simple matter of taking Magisk Install, direct install (Recovery mode deselected) to update Magisk to 25001, or uninstall app and replace with an earlier version and then take Direct Install to get Magisk (mask) matching package / App...

Not sure this will work (probably will however) if you are booting system w/ Magisk via recovery (w/ key combo)... May need to flash unpatched recovery and start fresh, or at least do this after successful Direct Install to update Magisk...

Without root, you can try magisk as zip installer via twrp (assuming you have compatible twrp /android; Nb. no twrp is compatible with Android 12 yet), but best to use App patch, fastboot flash method on SAR / 2SI devices... PW