yashsingh1/xdaforums huggingface dataset:
[Magisk] 3dwizzard:
I tried both flashing the zip that I renamed from .apk to .zip and I tried to also update it from my last currently working one v21.1 to the newest one v22.1 but none of these 2 methods worked.

When I flash v21.1 from my TWRP recovery it always works, no matter how many times I install it or uninstall it.

When I try flashing v22.1 or anything above v21.1 I get to my phone's desktop and I find a magisk android icon that I tap and it leads me to the 3 steps that I posted in these screenshots.
[Magisk] pndwal:
Ok, sorry I was a bit confused/distracted by description! 😜

Still guessing, but it seems you had earlier Magisk hidden... Think you may have missed my Nb. about that in last reply. 😬

Release notes (appears When clicking Install / update App or Magisk) makes clear you need to unhide / restore old Magisk Manager BEFORE updating to new Magisk App (22.0 or 22.1) due to new / incompatible App Hiding method.

If this is the case, uninstall all of the following: Any stub, renamed (hidden) Manager (you may need to search apps carefully if you forgot name assigned), AND new App that exists. Next, re-install new App.

This should fix new App / old Manager conflict, and App should now show Magisk Mask version installed in ramdisk. 👍

Nb. Previous Magisk settings / Modules etc will survive App / Manager uninstall since they are saved at /data/adb.

Hope this helps, PW
[Magisk] 3dwizzard:
There is no hidden app and there is no stub. I tried reinstalling it cleaning it, flashing the whole stock rom again but nothing helped.

However just a few minutes ago, I was able to patch the boot.img and flash it and I got a very weird result.

Root verification works, I can grant root access to apps, however magisk manager doesn't see the latest version installed it still says N/A instead of version 22.1 and basically it runs as if there is no root access, not giving me any hiding options or the modules button.
[Magisk] pndwal:
Interesting... All the symptoms of Manager / App conflict.

Clutching at straws now, but have you tried (in this order) uninstalling new App, reverting to working 21.4 etc, then checking if option to UNHIDE Manager appears in Magisk Settings? (Unhide if it does.)

Other than this, there are still issues extant with same symptoms (seem to affect Android 6 & 7, - Samsung only? - in particular). Eg:

https://github.com/topjohnwu/Magisk/issues/4174 (See XDA page referenced here also.) PW
[Magisk] Tanvir Rezwan:
After restart device everything is ok

Bt after hours like 18 20 24 hours only pubg lag and hangs on very much.. Whenever again i restart its get ok.. And again after hours behave same...

Is there any solution?

Device : sony xperia xz premium G8142

Magisk version : canary 22104

Using lsposed riru cloudfare latest module.

Also pubg in magiskhide.
[Magisk] pndwal:
If you have Systemless Hosts, disable or remove it from modules.

OTTOMH this is a major cause of instability in kernels with f2fs loopback bug present.

If your kernel has this bug, there may be other causes also, especially other Magisk modules. PW
[Magisk] Tanvir Rezwan:
Yes systemless host module is on.

Im just removing it.

Lets see what happen next

Thank you
[Magisk] hackwerk:
Log seems perfectly normal and ok:

Device platform: arm64-v8a

Installing: fb8000b5 (22104)

Copying image to cache

Unpacking boot image

Checking ramdisk status

Stock boot image detected

Patching ramdisk

Repacking boot image

Output file written to blahblahblah

All done!

In Magisk app (before flashing/patching):

Installed - Not Available

Ramdisk - Yes

A/B - Yes

SAR - Yes

After flashing (flash boot magiskblahblah.img) and reboot, the device goes through Android One boot screen, then Mi logo screen (inc Windows sound of USB connection while plugged in), and after 1 minute reboots again to stock recovery with corruption error.

After a flash of the stock boot i'm back to normal.

I have no options of Recovery mode etc while patching btw, but I dont have or use recovery.img files as I have an A/B phone, with boot.img only.
[Magisk] pndwal:
Thanks for this information.

Appears you may now be try this suggestion of yesterday, from an experienced Mi A3 rooter who encountered the same issue:

https://xdaforums.com/t/guide-root-...ith-magisk-without-twrp.3958509/post-84925217

Please let us know if that fixes it for you. 😛 PW
[Magisk] sk8223:
I'm stuck in a strange limbo.

On my Pixel 4a, I finally found a way to unroot.

​

The above is what I also posted in the LineageOS 18.1 thread for the Pixel 4a.

But the weird thing is, whenever I try to flash the latest LOS nightly for this device using LOS Recovery (adb sideload method), it just gets stuck on the LOS boot animation

Now, this can't be a Magisk issue right? Because at this point Magisk is uninstalled and the only thing that remains is the Manager app, but it doesn't even have root access. It's a regular app. By all means, I should be able to flash any OTA without issue. Yet I'm still either getting stuck on the LOS boot animation upon rebooting the phone after installing an OTA, or I'm getting this weird recovery error.

Anyway, if anyone else is running into issues uninstalling Magisk on Android 11, follow these instructions:

Using a file explorer (like Solid Explorer), go to the root folder > /data

There will be a magisk folder there with a hash string in its file name (i.e. magisk[hash]). Go to the folder and copy the boot.img.gz in there (this is the stock boot image from the initial Magisk install, if you choose the Direct Install option). Paste the boot.img.gz copy in the root of the /data folder

Rename boot.img.gz in root of /data to stock_boot_0.img.gz

On Android 10, go to root folder > sbin > .magisk and edit the config file there. Make a backup of this file just in case. Then use a text editor (should be built into your file explorer) to change SHA=[hash] to SHA=0

On Android 11, go to root > /dev > Tson9 (or a folder named similar to this) > .magisk and dit the config file there. Make a backup of this file just in case. Then use a text editor (should be built into your file explorer) to change SHA=[hash] to SHA=0

Go back to the Magisk app and hit uninstall > Restore Images. This method should work now.

If the above doesn't work for you, find the same ROM file you are currently on, whether it's a stock ROM or a custom ROM

Extract the boot.img (if it's not already available to you). Use payload dumper to dump all the files if required.

Grab boot.img from the ROM. Boot into fastboot mode. Enter "fastboot flash boot [enter boot.img path here". It should flash successfully. If you are still getting errors here then you need to check your boot.img, you may be using the wrong ROM. The boot.img has to match the same version you have installed.

Reboot into system and Magisk Manager will not give you any root options, which means you are unrooted.
[Magisk] J.L.C.:
Has anyone successfully patched the stock boot.img from the Coral (pixel 4xl) April release?

I still get stuck at "system is starting" until I re-flash the stock boot.img. I'm unable to root.
[Magisk] pndwal:
OTA expects all non r/w partitions to be unaltered. Eg, there can be no system mods (ie. unless they are systemlessly achieved).

Safe way to perform OTA is to ensure no system mods have been made, or Restore system image, restore boot image (unpatched), and restore recovery image (if installed custom recovery, or as a precaution in case it has EVER been altered, eg mistakenly by doing Magisk Direct Install (update) w/ Recovery mode selected 😬). Stock ROM OTAs may also require you to restore vendor image etc if altered, eg by a custom ROM. More here:

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

Magisk Uninstall / Restore Images, if it works, is exactly the same as flashing back unpatched boot.img and/or recovery.img. It leaves Magisk settings, Modules etc, and these will be restored in a later Magisk Installation and won't affect OTA as they are stored in /data/adb.

It is probably much simpler just to extract recovery and boot images from currently used ROM archive (package) and flash these from PC using fastboot.

Of course, as an alternative to downloading / extracting unaltered boot image from a ROM package, you can use the gz compressed image you found (uncompress & extract raw boot image), or even a TWRP backup image made before rooting (just rename boot.emmc.win to boot.img) to flash from fastboot if you wish. 🤠 PW
[Magisk] mars28:
I missed the moment when the method of installing the Magisk changed and it was necessary to restore the original Magisk before updating to the new version. So I did as I did for the last few months which was TWRP ROM update, then I installed the Magisk from zip file in TWRP, booted the system and then updated the Magisk and it's app to the latest versions. Now, after starting the Magisk, it shows me "Magisk - installed N/A, ramdisk Yes" and "App - Latest 22.1, Installed 22.1". But I can't change any options, eg hide Magisk app - it's kind of invisible option. I see the icon of this hidden Magisk application (with a different name) but clicking on it has no effect, from time to time I also get a message that it has been stopped. Root is rather active because applications that require it, however, work. How can I now completely uninstall Magisk and perform a clean install of it?
[Magisk] Ti64CLi++:
I have a Redmi Note 7 with Xiaomi.eu 12.0.2 ROM and I tried several times to install the latest version of Magisk, without success. Each time, I had a problem with my data partition which I had to format every time after trying to install Magisk. Even flashing the zip in OrangeFox recovery, and trying to install an older version such as 21.3 didn't work.

I don't know what to do
[Magisk] pndwal:
You don't need to uninstall Magisk (Mask).

Release notes re. need to unhide / restore old Magisk Manager before updating to new Magisk App were for v22.0 & 22.1 (or 21402 Canary build)

In your case, uninstall ALL of the following: Any stub, renamed (hidden) Manager (you may need to search apps carefully if you forgot name assigned), AND new App that exists. Next, re-install new App.

This should fix new App / old Manager conflict, and App should now show Magisk Mask version installed in ramdisk. 👍

Nb. Previous Magisk settings / Modules etc will survive App / Manager uninstall since they are saved at /data/adb. 👍 PW
[Magisk] pndwal:
I'm on Stock MIUI, and don't know about your data corruption issue.

However, I'd try this:

Avoid using TWRP, at least initially as this can introduce a number of problems. For this reason flashing in custom recovery is no longer recommended, and exists only for legacy device support.

Simply Uninstall any Magisk Manager or App you have currently. Then extract boot.img and recovery.img from ROM package for your current ROM.

Flash recovery.img to recovery partition from PC using fastboot. This will remove twrp if you have it, and ensure any any recovery image that was altered inadvertently (eg by patching or Direct Install from Magisk App with Recovery mode selected) is replaced.

Next, follow the official Installation Instruction ( https://topjohnwu.github.io/Magisk/install.html ) recommended method, but with the following exception: If Magisk App says Ramdisk - no, ignore this! (Most Xiaomi devices actually have boot ramdisk support in bootloader, and therefore support Magisk in boot partition.) So:

- Download and Install latest Magisk App and open it.

- Click Install, Ensure Recovery mode is DESELECTED, click Next, check Select Patch a File, select boot.img you extracted, click Lets Go.

- Locate the patched boot image file, transfer it to PC and flash it to boot partition from PC using fastboot.

Reboot and profit! (... Hopefully.) 😛 PW
[Magisk] Ti64CLi++:
Thanks for the detailed instructions.

I will try that and hopefully it will work.

I just have one minor issue, I can't find any recovery.img in the zip of Xiaomi.eu v12. 0.2. I only have a boot.img.

So I don't know what to do...
[Magisk] pndwal:
Ah, yes, custom Xiaomi.eu ROM likely doesn't include or alter recovery partition / image.

Restoring this may not in fact be critical, even for any OTA updates from Xiaomi.eu. team as OTA is unlikely to update recovery.

However, it may be critical to restore an unaltered (unpatched) recovery image, especially if you suspect you ever did Direct Install, or patched from Magisk Manager or App with Recovery mode selected.

You could either download latest official fastboot stock ROM (check https://xiaomifirmwareupdater.com/miui/ ), extract recovery.img and flash that, or flash an original custom recovery image for your device (never patched) to ensure this. 👌 PW
[Magisk] Ti64CLi++:
Thanks I will download the fastboot stock ROM (and not the recovery ?) and flash the recovery.img from the zip.

I hope it will work !

Thanks again for all your help, I'll give a feedback wether it works or not
[Magisk] pndwal:
? It should include the stock recovery.img. Just extract it. PW
[Magisk] Ti64CLi++:
Yes I know, what I meant is that on the link you gave, there are two files for MIUI 12 for Redmi Note 7 Global, one with Type : Recovery, and one with Type : Fastboot.

I just don't know what it means
[Magisk] pndwal:
Oh... but you said "I will download the fastboot stock ROM (and not the recovery ?)" ... Sounded like ROM without recovery. 😬

As I said, select official FASTBOOT ROM. 😉

Fastboot ROM = flash from PC thru ADB Fastboot.

Recovery ROM = flash from custom recovery.

Fastboot ROMs are defacto official standard, and usually include all partition images (except Low Level partitions).

Recovery ROMs often don't include all partition images needed. PW
[Magisk] Ti64CLi++:
Ok thanks for the informations, I was already downloading the FASTBOOT ROM, I only asked that out of curiosity ;)
[Magisk] sk8223:
I never made any modifications to the system outside of Magisk, and restoring the boot.img Magisk saved at the initial install did successfully uninstall Magisk... I wonder if it's the Magisk settings and modules that remained behind that are causing the update to fail. Then again, you said that it shouldn't affect the OTA at all.

I did flash the latest sunfish LineageOS 18.1 recovery for 04-29 after restoring the boot.img (and thus losing root), which worked just fine. It's just the 04-29 ROM that keeps getting stuck on the boot animation. Gonna have to try erasing my data, flashing an older LOS version and then trying to update it via OTA--it could be an issue with the ROM for all I know. Thanks for the response.

But if I'm able to update in the above scenario, I'll still be at a loss as to why rooting and unrooting with Magisk won't let me install LOS updates. Fingers crossed...
[Magisk] Ti64CLi++:
@pndwal I've got an issue. Since I flashed the stock recovery.img, my phone won't boot...
[Magisk] pndwal:
So are the nightlies full ROMs, or incremental OTAs?

And are ALL non r/w partitions restored? Ie, does recovery.img etc match the ROM?... That is what is expected for an incremental OTA, so more than just Magisk's Restore Images may be required to take OTA, eg if you flashed custom recovery.

Sorry if I'm stating the obvious, but it may help. PW
[Magisk] pndwal:
Did you use 'fastboot flash recovery recoveryxx.img'? With recoveryxx.img in ADB directory? PW
[Magisk] Ti64CLi++:
I did exactly that yes
[Magisk] pndwal:
As long as you didn't flash it to other location (eg boot), try flashing custom recovery back. PW
[Magisk] Ti64CLi++:
Ok that did work. Should I try to flash a stock recovery once again ? Or flashing a clean custom recovery is enough to continue the standard installation of Magisk ?
[Magisk] hackwerk:
Thanks!

As you can read in that thread, where I was already posting, it is SOLVED!

Amazing but true. A clean flash of a complete stock fastboot package and then flashing a Magisk patched boot.img DOES work. Strange!

Edit 1: And even better news is that SafetyNet (2 x) works for the first time in months so all banking apps etc work again!
[Magisk] hamid3pnn:
Hi "complete uninstall" option doesn't work in application and i had to do it from recovery, and renamed magisk.apk to uninstall.zip that magisk files removed but , still "SAR" is "yes" in application, it means still device is rooted? thanks for help
[Magisk] J.Michael:
No, SAR, A/B, Ramdisk are all statements of the way your device was built. They will not change for your device.
[Magisk] OMAKE:
Hello.

Tried to place some scripts to /data/adb/service.d.

For example custom.sh 775 +x with content "touch /data/local/tmp/touch.txt" or "stop logd".

Doesnt work. I can execute script manually in terminal emulator.

Device is Redmi 5+, Android 8.1, MIUI 11, latest official global.

Magisk 22104
[Magisk] sk8223:
The LOS nightlies are full ROMs, aren't they?

I was able to run a logcat at boot and I believe there's something weird going on with Google Apps and Magisk (rooted or unrooted) on the device.

With Nikgapps core apps installed, I get a massive error at the top of the logcat:

E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: main
E AndroidRuntime: java.lang.IllegalStateException: Signature|privileged permissions not in privapp-permissions whitelist: {com.google.android.gms (/data/app/...

This is what I'm trying:

-I formatted data in LOS recovery, then installed the ROM

-I installed MindtheGapps immediately after it (rebooted to recovery again), per LOS's official instructions

-I booted into the ROM, set it up as usual, no issues

-I installed the latest Magisk APK and patched my ROM's boot.img, then flashed that patched boot.img in fastboot using "fastboot flash boot <boot.img>"

-Rebooted back into the ROM and Magisk is installed

-Now to try for an update: I restored the boot.img in Magisk and unrooted. I booted into recovery and tried to flash a newer nightly, which went through no problem

-But when I boot into system, it gets stuck on the LOS boot animation, even though the ROM shouldn't have any Magisk modifications or anything...

I tried the same method with Gapps but without root and I had no issues updating.

I tried the same method without Gapps but with Magisk and I had no issues updating.

I don't know why, but the combo of Magisk + MindTheGapps-11.0.0-arm64-20210412_124247.zip is causing the system to get stuck at the boot animation. I need to run a logcat from recovery so I can find out why but running adb logcat -d > logcat.txt at the bootloop animation isn't working.

EDIT: I found the solution and it was a pretty obvious one and one I am already familiar with on older, non-A/B devices. I had to flash the nightly, then MindtheGapps, and finally Magisk in order to boot.

It looks like LOS's built-in OTA updater is pretty useless (on this ROM). It causes conflicts between Magisk and Google apps for me. Maybe I don't have my device set up right, even though it's got A/B slots? IDK. I'm just glad I've finally resolved this!
[Magisk] pndwal:
Good!

Any UNPATCHED compatible recovery should be fine for custom ROM update, including Xiaomi.eu custom MIUI ROMS.

For Stock ROMs (eg. official MIUI), specific matching stock recovery will be needed to safely apply OTA updates. PW
[Magisk] pndwal:
SAR indicates device uses System As Root.

Nb. This is NOT to be confused with 'system is rooted'! It refers to root directory used, NOT to superuser access being granted!

Nb.2. This is SAR as defined for Magisk purposes - ie. FINAL rootdir is System - and it includes later devices that aren't officially considered SAR. Google considers only how the kernel boots the device - ie. INITIAL rootdir is System.

https://topjohnwu.github.io/Magisk/boot.html#discussion

Successful root (superuser access) is indicated by Magisk Installed version in Magisk App.

If it says N/A, you will generally not have root. However, due to issues / bugs causing App not to see root, N/A can appear in error when root has, in fact, been achieved. PW
[Magisk] pndwal:
I believe so, but I'm not familiar with Official LOS...

"fastboot flash boot <recovery.img>"

Hope that's a typo. 😬

Have you tried updating with root? (- Of course, only if you have the COMPLETE ROM, not OTA.)

There may well be issues with GApps and Magisk (especially for A11), but these may also be version dependant.

Interestingly, I have Unofficial LOS 18.1 (A11) on Mi Pad 4, and users incl. me can't boot at all with either no GApps, or with OpenGApps test builds for A11, but device boots fine with NikGApps, with or without Magisk. This is a different problem, but shows there are anomalies with some recent GApps builds.

Glad you found a working solution.

John's notes on requirements for taking OTAs with Magisk, Google changes for A/B device OTA delivery and their repercussions, methods etc, may give some additional insight:

https://github.com/topjohnwu/Magisk/blob/master/docs/ota.md 🤠 PW
[Magisk] Ti64CLi++:
Then I did what you said, and I can happily tell you that it worked (for now). I was able to reboot my phone without any problem, and Magisk is now installed. Hopefully it will continue to work.

Anyway, thanks a lot for all your help :)
[Magisk] hamid3pnn:
thanks for answer, so i can't unroot device with magisk? even after uninstall magisk, i can't use banking apps, how can i unroot device?
[Magisk] Didgeridoohan:
Of course you can unroot, and from the sound of it that's what you've done. But there are many things that apps can detect about your device and deem it untrustworthy, even without having Magisk installed.

Only way to be relatively sure that an app will work is to restore the device to a fully stock configuration and then lock the bootloader again (but be careful, doing it wrong could mean a full on permanent brick).

And even then there are things that could trigger an app looking for, as an example, other apps and files/folders on your device that they see as signs of your device being compromised.
[Magisk] pndwal:
I thought you said you'd unrooted successfully using uninstall.zip from TWRP!

As I said above, if Magisk Installed says N/A, you can assume you don't have root! (In case of rare issues, App will fail to see root however.)

If Magisk Mask (not App) is actually uninstalled (ie. a boot image without Magisk in ramdisk replaces Magisk patched boot image), device IS unrooted! - Magisk and root are synonymous.

What you may be missing is that unrooting will NOT help with your Banking Apps, which generally use SafetyNet API to detect a number of signs of a 'modified insecure environment'.

Further, while they will often state 'Jailbreak or Root has been detected', they are using these terms extremely loosely, and really mean 'a modified insecure environment' has been detected.

One of the key indicators of such an environment is unlocked bootloader, since AVB (Android Verified Boot) is bypassed.

For this reason, the ONLY ways to pass SafetyNet on unrooted devices are:

1) Run a custom ROM which integrates spoofing techniques to pass for a CTS (Compatibility Test Suite) certified device, and to otherwise hide AVB bypass (unlocked bootloader).

2) Restore full Stock ROM (ie. flash stock images to all partitions), and re-lock bootloader. Often OEMs provide their own unique software solutions for this purpose.

WITH Magisk root however, as things are presently, we can generally hide the 'insecure modified environment' from such Apps using Magisk Hide and modules to supplement this.

These solutions include:

- MagiskHide which can hide root from a bank (or other security centric) app's processes as well as from Google Services Framework.

- Magisk modules which can spoof a certified CTS 'fingerprint' (for uncertified ROMs including Chinese stock, and custom ROMs) and hide AVB bypass (unlocked bootloader), namely MagiskHide Props Config and Universal SafetyNet Fix modules.

The current ability to bypass SafetyNet with unlocked bootloader whether using custom ROM without root, or Magisk root spoofing techniques, will certainly be lost when the big G fully implements Hardware Keystore Attestation. No-one (except Google execs/security staff?) knows when this will happen.

When it does, the ONLY option for running Bank apps etc, will no doubt be to restore devices to locked stock state.

Hope this clarifies your current options! 🤠 PW