yashsingh1/xdaforums huggingface dataset:
[Magisk] pndwal:
You should always patch / use boot image from current ROM, whichever it is, (unless you can confirm that a custom kernel is fully compatible)...

If unsure of current ROM, you should identify in device settings, or a device info app.

Just download (if needed) exact corresponding ROM, extract boot image (may need a payload dumper app if Android 11+ I think?), patch and flash and you should be good again... I doubt mismatched kernel has messed up your system, but you could dirty flash complete ROM first if worried (or if you still have issues)...

Another trick is to backup / locate / save boot.img from TWRP if you have TWRP (before patching). Backup will be .win file... Can rename or just patch that. Nb. This generally works, but is not an official method.

Just use matched boot.img for current ROM... 👍 PW
[Magisk] kramer04:
after canary 24300, all canary i've update

i tried also uninstall and re installs stock boot.img kernel from twrp then magisk but can't boot to system

the only option active are zygisk and enforce Denylist
[Magisk] pndwal:
How did you get this stock boot.img? Is it from current Android 10 ROM?

Ok, just checked your device; Samsung w/ Release Version Android 8.1, upgraded to 10 stock?

I believe in cases like yours, official instruction stating "If your Samsung device is NOT launched with Android 9.0 or higher, you are reading the wrong section" is in error.

My understanding is that legacy ramdisk boot type devices are automatically updated to 2SI ramdisk (converting partition structure to Dynamic Partitions) after updating to Android 10.

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

This means that you will now need to follow carefully the instructions for Samsung here:

https://topjohnwu.github.io/Magisk/install.html#samsung-system-as-root

to make Magisk work. (Nb. John considers 2SI a form of SAR while Google doesn't).

I believe you can no longer properly install Magisk via .zip / custom recovery as you could w/ Android 9 due to this conversion either...

Sammy users with devices updated from Oreo or earlier to 10 (NB. Pie devices don't convert; they're 'stuck' with 'legacy' SAR) may confirm this information.

🤠 PW
[Magisk] kramer04:
I saw instructions so if i understand i have to install before magisk apk ?
[Magisk] reiryuki:
I'm uploads my modules to pling.com instead of github.com releases. Can update.json support pling.com for direct updates via Magisk app?

For my custom recovery, the sepolicy rules dir is /persist/magisk. The /persist partition is unmounted by default and it's unmounted too after installing modules. While installing module, the sepolicy rules dir is not detected and the sepolicy.rule file is not installed except I put `mount /persist` first at the customize.sh (maybe `mount /metadata` is required also). Probably, `mount /persist` and `mount /metadata` have to be included at the top of copy_sepolicy_rules function inside util_functions.sh only if $BOOTMODE == false.

I have to modify some files inside /my_product and /odm partition but Magisk is not handle them yet. But it's not a big deal because I can use `mount -o bind` for them.
[Magisk] zgfg:
If you are developing your own modules(s) and if you studied in Magisk documentation and how the update me banks works for other modules, you can easily test in few minutes with your own module.prop, your module.json, your changelog.md and your module's zip file (the last three must be hosted somewhere, usually on GitHub but you should test if they can be hosted and accessed from Piling)

Eg, in the Shamiko's module.prop you will find:

updateJson=https://lsposed.github.io/releases/shamiko.json

Copy/paste (or just click on) that https url to the browser and see what will be opened and how (no login page, user is not required to accept any cookies or whatever) - test yourself but screenshot is also included

Furthermore, look now into that raw json file just opened in the browser and you will see two links there:

zipUrl": "https://github.com/LSPosed/LSPosed....ad/shamiko-106/Shamiko-v0.4.4-106-release.zip",

"changelog": "https://github.com/LSPosed/LSPosed.github.io/raw/master/releases/shamiko_changelog.md"

Again, copy/paste the https changelog link (without quotes) to the browser and check what and how will open

Similarly, copy/paste the zipUrl https link to the browser - it will directly start downloading the Shamiko module zip file, without opening any page to select mirror server, accept some terms or whatever

If you can get such links from your Ping, then ok. If not, it will not work (Magisk app is not supposed to open a page where user has to accept some terms, click this or that to continue with accessing the Changelog or starting to Download the module zip file)
[Magisk] pndwal:
I'm not a Samsung user, but because of these instructions:

Never, ever try to restore either boot, recovery, or vbmeta partitions back to stock! You can brick your device by doing so, and the only way to recover from this is to do a full Odin restore with data wipe.

To upgrade your device with a new firmware, NEVER directly use the stock AP tar file with reasons mentioned above. Always patch AP in the Magisk app and use that instead.

my guess is that, if you can boot a stable system with 24300, just use the current 24306 app to patch current stock Android 10 AP tar per instructions, then transfer it to PC and using Odin, flash magisk_patched.tar as AP, together with BL, CP, and HOME_CSC.

I'm assuming that this should fix any issues with vbmeta or other partitions also... If not, you may now need to backup user data (you should while you can anyway), restore full stock w/ Odin (factory reset / full data wipe), and install Magisk per instructions for initial installation (ie flash magisk_patched.tar as AP, together with BL, CP, and CSC for full data wipe).

Nb. DON'T transfer files between phone and PC using MTP! Use ADB as mentioned...

😛 PW
[Magisk] reiryuki:
Yeap, the ZipUrl must be a file link, but there is no direct file link with the pling.com, only a direct page. I think it's impossible with pling.com.
[Magisk] squirtle27:
I flashed the correct boot.img but that alone wasn't enough to fix it. I installed twrp and made a backup which didn't include boot etc. which I thought would do a fresh install with user settings. I think I got stuck in a bootloop after that so I decided to wipe everything. After wiping, I booted normally but I didn't get the default phone setup probably because I had a password on my phone. Then I used the phone's factory reset button to set it up properly but I haven't been able to boot at all after that.

Adb won't connect and I can't get into fastboot with the button combination. Infinite bootloop with nothing I can seemingly do softwarewise. I got so close to unbricking too :(
[Magisk] pndwal:
That's sad, and I've lost track of your changes... Probably you have too... ☹️

Anyway, a tip that may help recover:

In the past, holding down vol- while connecting usb to PC allowed some (all?) devices to enter 'download' mode even while bootlooping. (I've only used this on MTK devices: vol- allowed vcom driver to connect...)

I'd be giving that trick a go with proper fastboot ROM and installer for your device loaded on PC. Activate the flash before connecting if possible... Nb. It is actually possible to access fastboot / download mode with a black screen in some cases...

Failing getting connected w/ standard fastboot / download mode, you should be able to recover using an Emergency Download mode (EDL)... Often needs battery removed / disconnected to access... Check your device forums...

Sadly, some OEMs like Xiaomi, now require a 'Authorised Account' (paid) to use EDL recovery mode for security reasons... (Users must either go to an authorized agent or connect with a live PC connection to an Authorized Account holder Via Team Viewer etc..) Hopefully this won't apply to OnePlus, or that you don't need EDL mode anyway...

All best with it! 😬 PW
[Magisk] squirtle27:
Removing battery requires me to melt the glue first, but since it doesn't seem to be working at all anymore that seems like a good choice! Anyways, thanks for helping, I'll let you know how it goes, whatever I end up doing! :)
[Magisk] pndwal:
May be your best option (if needed to use EDL) BUT NOT till you've exhausted ideas to use standard download/fastboot mode! Still likely vol- or other trick will enable this, even blind (black screen)! ...

EDL is called Emergency DownLoad for a reason... It's the Ambulance option (when device will only show as "Qualcomm QUSB_BULK", "Qualcomm HS-USB QDLoader 9008" or similar in the device manager). It's a full Low Level firmware download mode requiring some special program like QPST.

Sometimes a Defibrillator option - special software to rebuild IMEI, BT, SN, other device IDs, etc - is also needed... Don't want to go there! ... 🤪 PW
[Magisk] J.Michael:
What device do you have?

Do you have a copy of the original software that came on that device?

When you did a factory reset, did you get walked through a normal Android setup? So, for a while, you had Android running? And then you tried to reboot and it failed to boot?

How does your bootlooping phone respond to you holding down the power button? Any menu?
[Magisk] zisinikos:
Hey, I just updated to 23.4 and I dont know what is going on. From a quick research I found out that the magisk hide now is "Zygisk" but still.. I can't pass safety net. Also i installed a module named "Shamiko" because a tutorial told me to! My main goal was to get billing apps to work (which worked) but saftey net does not pass.
[Magisk] Lughnasadh:
You probably meant 24.3?

Have you tried installing this to pass SafetyNet?

You can also go here for the more information about Zygisk, passing SafetyNet, etc...
[Magisk] zisinikos:
yea sorry 24.3. The SafteyNetFix (1.1.0) you provided didn't work BUT i did some further reaserch and i found out that there is a new SafteyNetFix (2.2.1) that works with zygisk! That seems to have fixed it!
[Magisk] Lughnasadh:
Glad you got it going. Yeah, I wasn't suggesting you install USNF 1.1.0. I was just pointing you to that thread. The title of the thread is outdated, but the latest version can always be found in the Github (link is in the OP of that thread), which I see you found 👍
[Magisk] squirtle27:
Oneplus Nord CE 5G, don't have original system files.

My phone booted after wiping with TWRP, I then factory reset because I didn't get the normal android setup where you're able to log into your google account and get all of your settings back that way. Never booted since.

Power button works fine but can't access any menus, just the normal "bootloader is unlocked" message before starting the oneplus animation after which I get a black screen for ~30 seconds and then it goes back to the oneplus animation etc. etc.
[Magisk] J.Michael:
Can you power down? (complete shutdown; power off)
[Magisk] squirtle27:
On the black screen I can get power off and restart menu open
[Magisk] squirtle27:
Turns out you can never ruin a oneplus! :D When all else failed EDL took under 5 minutes to completely restore my device. Thanks everyone I would have given up without your help! :)

https://xdaforums.com/t/opnordce-oo...l-to-restore-your-device-to-oxygenos.4332445/
[Magisk] humpty321:
I've tried to root my Pixel 4a 5G (LineageOS 18.1) following Magisks installation instructions. These say "If you are patching a recovery image, check the “Recovery Mode” option". But there is no such option:

View attachment magisk-option-recovery-missing-on-bramble.webp

Magisk does patch the recovery.img that I retrieved from LineagOS, BUT is the patched outcome usable as I could not set the required option?
[Magisk] pndwal:
🤔 Does Magisk say ramdisk = no for you?...

If not, why are you trying to install Magisk in recovery? - Pixels all support Magisk in boot AFAIK... Magisk in recovery is only needed for A only legacy SAR devices (from 2018)...

Your device is 2SI boot type... Most A/B 2SI have no recovery partitions anyway (they use a hybrid ramdisk and recovery in boot partition), although some (OnePlus, others?) Have recovery_a/_b, and A only 2SI have recovery...

While that image may be usable as a recovery partition image on some devices having such a partition (see above), many A/B devices can only boot to such an image from PC fastboot, and flashing is done once booted either by special recovery functions that patch recovery in boot partition using the recovery.img, or by running a recovery.zip that does the same. Magisk is installed by patching boot partition on these devices also, not by patching recovery.

Even if Magisk in recovery is possible on P4a 5g, it is not necessary, is a more difficult solution than Magisk in boot in any case, and the mode is therefore not supported in 2SI devices. PW
[Magisk] zgfg:
It depends now on your phone.

I have two Xiaomi phones, running A11 (MIUI 12.5+), both running the latest Magisk Canary 24306.

On the first it offers me to patch as Recovery, on the second not:

1) Mi 9T

Not A/B device, and having both Boot and Recovery partitions.

Magisk recognizes as Ramdisk=No.

It offers me to choose do I want to patch as Recovery or not - but it is well known (for Xiaomi) that one must patch Boot omg (not Recovery) although the Magisk docs suggests the opposite.

Screenshots named _Ramdisk-No, _Recovery

2) 11 Lite 5G NE

A/B device, with Recovery integrated into the Boot partition.

Magisk recognizes as Ramdisk=Yes.

It does not offer me to patch as Recovery but it offers me to install to the inactive slot.

Screenshots named _Ramdisk-Yes, _Slot

PS: Stupid XDA does not display attachments in the order I upload them. It doesn't either in the alphanumerical order.

Hence pay attention to the screenshot names as listed above

I never understood in which order it sorts them but it's a shame how this forum and specially the XDA app is unfriendly and bad managed (one needs to have PhD in Physics to understand how to search in threads - problem was reported half a year ago and the staff and admin did not even bother to comment the problem)
[Magisk] mGforCe:
EDL has been a saver for me a few times, in last 9 yrs of handling multiple Redmi/Xiaomi phones.

Any idea, from which phone series have they started this paid Authorized Account thing?
[Magisk] zgfg:
I don't know precisely but I'm sure that when I bought my (now old) Mi 9T back in 2019, it was a common solution on Mi 9 series forums, channels, etc - for those who bricked the phones and MiFlash did not help, to look for the paid EDL support to unbrick the phones
[Magisk] humpty321:
When I rooted my older phones I always took the boot.img out of the LineageOS zip. The zip for the 5a 5G does not contain a boot.img. That is why I tried the recovery route. In the meantime I have looked into both (11 and 12) of the stock ROMs that I have here. They do each contain a boot.img (both date from exactly the identical time and have identical byte sizes. Nevertheless the sha256 sums are different).

So I am asking myself and of course you, if I should let Magisk patch Googles boot.img from the version 11 package. It looks like that it might be the one used even after LineagOS is installed, because this has not brought an own version along.

Btw. in my first post there are screenshots in webm format, which might go unnoticed because seemingly the forum software does not handle them as it would jpeg.
[Magisk] zgfg:
Maybe the boot.img is not packed because the ROM installation does not require to change it from stock.

Maybe that recovery.img is packed bcs it installes as custom recovery

You can always try - take that stock boot.img and patch

Then boot with - but without flashing permanently:

fastboot boot patched-boot.img

If it would work fine, then flash permanently:

fastboot flash boot patched-boot.img

That way you don't risk to damage your system if something was wrong with the (patched) boot img - you just tested without flashing permanently

Observe the difference in the two fastboot commands - in the first command the verb "flash" was omitted
[Magisk] pndwal:
Are you sure you used EDL? Flashing fastboot type ROM flashing has always worked fine w/ personal account login only in fastboot mode, even when tricks may be needed to get phone to connect...

As far as I knew, all 'EDL' (term is Qualcomm exclusive, but MediaTek have similar Emergency Download mode; I'll use it loosely here for both) flashing must involve Authorized Account now (and be paid; Xiaomi started charging Authorized Account holders per flash, and also had flash quota limits), but things may have changed.

I had to do this twice on a Redmi 6 a couple of years ago now. (Service in Vietnam available then flashed / fixed hard brick for $20 over TeamViewer). This is MTK device.

I understand that Qualcomm devices are very difficult to hard brick; you generally need to do something dumb. MediaTek is notoriously easy to hard brick however; mine occurred simply flashing a TWRP build that was working for other R6 users (different ROM version?), and this, combined with paid 'EDL' flashing, has also caused the abandonment of many custom ROM projects (for MTK Xiaomi devices) here on XDA. (Devs brick often, and can't afford time / expense using paid service each time it happens.) Several devs here warn members to choose Qualcomm Xiaomi if modding....

The change to paid EDL flashing was apparently due to Xiaomi taking security concerns more seriously than others. Some time ago now, penetration (vuln) testers successfully demonstrated that EDL mode can not only bypass factory reset wipe when flashing, but, using other tricks and specially modified ROM, password protection could also be bypassed on locked / encrypted phones, and all user data obtained / accessed. Potentially, locked stock stolen phones & data could be hacked.

Xiaomi's answer was to require Authorized Account live connections and vet service providers holding such accounts. It's really a lock, stock and you're-over-a-barrel answer however. 😜😬 PW
[Magisk] pndwal:
From Android 11 you just need to use a 'payload dumper' utility to extract images. They are there... PW
[Magisk] zgfg:
Snapdragons can be also easily bricked. Common case (I've seen so many questions for help):

- users flash with MiFlash

- they take the wrong fastboot/tgz file (like downgrading without disabling rollback protection, or taking a firmware for Pro on the non-Pro model, or so)

- they don't disable the default setting in MiFlash that relocks Bootloader (trap for newbies - EDL school is costly)

Hence they brick the phone with the wrong firmware.

Since they relocked Bootloader, they cannot take another chance to flash with the correct firmware.

And they cannot unlock Bootloader again because they can no more boot to the system
[Magisk] pndwal:
Sure...

I said

By 'dumb' I mean something you shouldn't do / are often warned against...

w/ Mediatek, one can hardbrick easily following proper posted instructions / doing everything 'right'... This is what led to Devs abandoning MTK projects, recommending Qualcomm and warning about modding Xiaomi MediaTek. PW
[Magisk] humpty321:
Patching the the stock boot.img has worked out fine. Thank you very much for your valuable suggestion.

I've only now noticed a log file on the phone that Magisk had written when I had let it patch the recovery. It states that Magisk had detected a stock boot image:

- Device platform: arm64-v8a
- Installing: 24.3 (24300)
- Copying image to cache
Parsing boot image: [/data/user_de/0/com.topjohnwu.magisk/install/boot.img]
HEADER_VER [3]
KERNEL_SZ [11807598]
RAMDISK_SZ [12102068]
- Unpacking boot image
OS_VERSION [11.0.0]
OS_PATCH_LEVEL [2022-03]
PAGESIZE [4096]
CMDLINE []
KERNEL_FMT [lz4]
RAMDISK_FMT [lz4_legacy]
VBMETA
Loading cpio: [ramdisk.cpio]
- Checking ramdisk status
- Stock boot image detected
[Magisk] shoey63:
That's because it is a modified boot.img that temporarily gets flashed to boot so you can install lineage. Thereafter recovery is inside the stock lineage boot image. Pixels don't have a dedicated recovery partition.
[Magisk] ghettiguru:
Edit* ok two things I have finally managed to get rooted on an Android TV amlogic device running Android 10 with magisk! But problem 1: it detects an old su binary that came pre-installed and hidden by chmod permissions in this user debug firmware I am running so you had root ADB shell. Now magisk wants me to remove the other su binary I chmodded to 777 in /system/xbin/su that came w debug build. How to chmod hide from execute or detection or remove that? And problem #2: have a twrpof a different device but with the same motherboard but it's a .zip with no recover.img fastboot boot recovery.img, to boot to twrp..how to compile the zip to a twrp img or finish porting my own?
[Magisk] pndwal:
Please consider my response however.

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

I wouldn't mind betting you are now using a kernel not properly matched (it's included in boot image). These often work, but users have issues with hardware, especially Comms (network, bt, WiFi) but also other issues.

Devs spend much time on the kernel to add / improve functionality. Some amateur custom ROMs or basic ports will leave boot image truely stock, but I doubt this occurs with advanced ROMs such as LineageOS. I put something about this here:

Post in thread 'Magisk General Support / Discussion' https://xdaforums.com/t/magisk-general-support-discussion.3432382/post-86602497

Nb. Magisk generally packs images with zeros to ensure size matches original boot image to improve compatibility with many ROMs, so don't assume same size means same boot image...

That's detecting the image you fed it however... As noted above, revovery.img is also a boot image... And I believe John uses 'stock' and 'unpatched' interchangeably, so this will indicate 'stock' even for a custom boot image.

I strongly advise you to extract (using a payload dumper) and use properly matched boot image / kernel. 👀 PW
[Magisk] zgfg:
If you have TWRP packed to the zip file, unzip and you will most likely find the img file inside

However, be careful about two things:

- You say it's TWRP for another device (with the same motherboard?), does it really fit to your device

- It could be zip file only because of 'transport' - somebody zipped bcs he could not attach the img somewhere (in that case zip contains nothing but the img file inside).

But it could be zip because it requires special installation procedure (that will be executed by another custom recovery already running on that device)

Hence, do not flash the img permanently but only try to boot to that TWRP temporarily:

fastboot boot TWRP.img

(observe that the verb "flash" is omitted above!!!)

If it would work fine and if that TWRP requires special installation procedure - then you can flash your TWRP.zip file now, when you temporarily booted (to the TWRP.img).

Or you may find an option inside the TWRP (Advanced tab or so) like "Install this TWRP" - it will then know how to permanently install itself.

That applies eg to devices with Recovery integrated to Boot (where you cannot flash to recovery)
[Magisk] zgfg:
Fine but that would apply if his LOS installation archive contains something like (a huge) payload.bin - @humpty321 must check about, I don't recall he had mentioned something similarly so far
[Magisk] zgfg:
Btw, let's sort out does your device have separated Recovery or not

Use a root explorer (like MiXPlorer) and check the content of:

/dev/block/bootdevice/by-name

Or dump it's content from Terminal:

su
ls /dev/block/bootdevice/by-name

And check does it list recovery or not

Eg, it will list boot.

Or boot_a and boot_b if A/B device - that can be also checked by:

getprop ro.build.ab_update