yashsingh1/xdaforums huggingface dataset:
[Xiaomi Mi A1 Guides, News, & Discussion] Tish997:
Do not unlock bootloader if you are on May Security patch because as soon as you run command "fastboot oem unlock" it will unlock the bootloader but WIPE ALL YOUR DATA... Dont knw its an glitch in May patch whatever don't do this unless you have backup of all your data and apps.

Otherwise answer of your Question is that you need to unlock the bootloader to boot the patched boot image bcz after installing patch boot image if you locked your bootloader your phone will not boot... As once i tried to lock the bootloader after installing patched boot my phone gave an error message screen at start up and didn't boot.

---------- Post added at 10:52 PM ---------- Previous post was at 10:47 PM ----------

You should simply run this command "fastboot boot patched_boot.img" if your bootloader is unlocked... Dont run "fastboot oem unlock" it will WIPE YOUR ALL DATA.
[Xiaomi Mi A1 Guides, News, & Discussion] KermitNinja:
Noted! Thank you so much for useful information. I was about to unlock the bootloader again even it's still unlocked lool :D
[Xiaomi Mi A1 Guides, News, & Discussion] ngohoainam:
totally correct! using "Install in second slot is unreliable" is risk if u have no knowledge to restore phone when your phone is bootloop. "using the direct install" is safer. :)
[Xiaomi Mi A1 Guides, News, & Discussion] Opfergott:
is it possible to disable ota updates?

And can I block that notification that will pop up every now and then that I should update my phone?
[Xiaomi Mi A1 Guides, News, & Discussion] noobcurioso:
Não funcionou

I did the procedure described here, still I can not update via OTA. Not even removing root and restoring the image I can not update via OTA.

PS: I had problem on WiFi when returning from a custom ROM, so I spent a fix that this in this post below PATA solve the problem. This may be preventing you from receiving updates via OTA?

https://xdaforums.com/mi-a1/how-to/easiest-quickest-to-fix-wifi-custom-t3779040

I'm sorry, but I had to use a translator, I hope you understand.
[Xiaomi Mi A1 Guides, News, & Discussion] Smultie:
New May update. Does the old patch boot.img (from the first May update) still work?
[Xiaomi Mi A1 Guides, News, & Discussion] fixxxer102:
No, not working
[Xiaomi Mi A1 Guides, News, & Discussion] vaibhav011286:
Here is the latest patched_boot.img for v9.5.13.0 (may update)
[Xiaomi Mi A1 Guides, News, & Discussion] Mmihir:
Unlocking bootloader still wipes data?
[Xiaomi Mi A1 Guides, News, & Discussion] Midomad:
Yes.
[Xiaomi Mi A1 Guides, News, & Discussion] geremias23:
I tried this image, after OTA updating to last patch (the one with ~58MB), and Magisk Manager (5.7) only says Magisk isn't installed. I tried uninstalling the app and do all steps again, same result. I'm missing something?

I confirmed version 9.5.13 in System. Btw, why there isn't this version in xiaomi stock rom site? The last one there is 9.5.11

-> Edit:

Ok, what I did so far:

1. Flashed stock rom 9.5.11, but data.

2. Booted and did two OTA updates, to .12 and then .13, ending with 9.5.13

3. Booted to fastboot, flashed the patched boot.img, reboot.

4. Installed Magisk Maneger 5.7

5. I open it and it suggest to install Magisk 16.0.0, I click ok, and then I have the option to just download and to patch boot image :(

I'm lost here :(. Maybe someone can upload the stock 5.9.13 boot.img, and I try to patch it here? I don't know what to do anymore...
[Xiaomi Mi A1 Guides, News, & Discussion] marniel647:
Does your data not wiped? I also ended up flashing stock rom 9.5.11 via MIflash and select save user data but after reboot my data is gone. Will unlock the bootloader first and try to install the new May update.
[Xiaomi Mi A1 Guides, News, & Discussion] geremias23:
Well, I extracted the stock rom tar.gz and removed from flash_all_except_storage.bat the lined that unlock/lock the bootloader, as it may wipe /data. My booloader was and still unlocked.

I tried booting twrp through fastboot, and there flashing Magisk, no error, nothing appears to be wrong, but Magisk Manager still indicating Magisk isn't installed and offers to patch bootimg :(.

Here what I did:

1. fastboot boot recovery-3.2.1-2-oreo.img

2. adb sideload Magisk-v16.0.zip

Here is the TWRP log (Magisk install is in the end): https://pastebin.com/KqQtbyYk

=> Edit:

I SOLVED this by swapping to slot B (it was on slot A, check logs), and now Magisk is working properly :). Hey :highfive:
[Xiaomi Mi A1 Guides, News, & Discussion] vaibhav011286:
Yes same happened here... Unlocking bootloader causes data wipe but thanks to TWRP for data backup n restore... After auto wipe I restored the latest data backup to get everything except internal storage..
[Xiaomi Mi A1 Guides, News, & Discussion] marniel647:
I only have the file from MI website that's the one i use in MI flash. I'm already in latest patch. Will root now and change the kernel. Does sideload command means flash?
[Xiaomi Mi A1 Guides, News, & Discussion] mnu01:
Root mi a1 after May second update

I want to root my mi a1 without losing ota updates

phone is running on may second update please help me
[Xiaomi Mi A1 Guides, News, & Discussion] Chris_Bellamy:
Should I download april patch or may patch or both? I'm currently with locked bootloader, no custom recovery and not root with may update. I wanna do all of that but I don't know if having may update will cause any trouble.
[Xiaomi Mi A1 Guides, News, & Discussion] illithid:
So i tried downloading the 2nd May OTA update after restoring images from Magisk and the update process stopped with "Installation Problem".

How to make it works and how to update to the latest version without wiping data?

I'm on the 1st May update.
[Xiaomi Mi A1 Guides, News, & Discussion] marhensa:
It breaks my WiFi, any workaround?

EDIT:

it turns out patched boot for earlier May (.11),

it's doesn't match, so it breaks thing.

for later May (.13), the patched boot is here:

https://xdaforums.com/showpost.php?p=76651910&postcount=1146
[Xiaomi Mi A1 Guides, News, & Discussion] biswasrahulraja:
mi a1 security patch

may 5 security patch plz.... old may patch not working..
[Xiaomi Mi A1 Guides, News, & Discussion] MadjijaHacker:
Hey, so i tried metod in the first post, my phone factory reseted, and magisk asks for img file to be installed, any help?
[Xiaomi Mi A1 Guides, News, & Discussion] semiphoto61:
I have a problem after unlocking bootloader. Wifi cannot work. try switch on but nothing happened. Any help?
[Xiaomi Mi A1 Guides, News, & Discussion] Ahmed Ziada:
oem unlock formatted the phone and after booting patched boot.img and rebooting magisk didn't show direct method option :(
[Xiaomi Mi A1 Guides, News, & Discussion] Milos8989:
If im on latest security update.How to root it ?Flash again may patched boot or is there any new boot.img for 5may security patch? Thanks for help
[Xiaomi Mi A1 Guides, News, & Discussion] Zereus:
i did the may boot.img.

the system still asks for ota, when i start the update it stucks in step 1 of 2 without an error.
[Xiaomi Mi A1 Guides, News, & Discussion] aveejnasv:
Can I install ota with the unlocked bootloader?
[Xiaomi Mi A1 Guides, News, & Discussion] zap-o-post:
oem unlock formated my phone.

can I swap from slot a to b to get my data back?
[Xiaomi Mi A1 Guides, News, & Discussion] spicediablo:
No, the slot is only to store your os and not your data

Sent from Sagit
[Xiaomi Mi A1 Guides, News, & Discussion] paolocorpo:
If the unlocked bootloader is the only modification to the stock phone (I mean : no Magisk, no TWRP, no kernel , no xposed ...) ...

... YES: you can install OTA wo issues
[Xiaomi Mi A1 Guides, News, & Discussion] neo.codename47:
Unlocking boot loader wipes data with May security updated

patched boot img wifi / data not working.
[Xiaomi Mi A1 Guides, News, & Discussion] Boobseekr:
Not working bruh. It roots but won't install any modules. After I reboot the phone it's not rooted again.
[Xiaomi Mi A1 Guides, News, & Discussion] vaibhav011286:
After booting with patched_boot.img, use magisk manager to direct install and patch the stock boot.img so that you can have permanent root even after reboot...
[Xiaomi Mi A1 Guides, News, & Discussion] probotzor:
there is no such option...

when i boot with patched_boot.img, wifi does not work and magisk does not look good

when i restart and try again, it does not offer direct install
[Xiaomi Mi A1 Guides, News, & Discussion] Boobseekr:
Will try. Thank you
[Xiaomi Mi A1 Guides, News, & Discussion] ibooth2004:
After flashing Magisk sometimes when I reboot my baseband version says unknown and I have to reboot to fix it, does anyone know a solution?
[Xiaomi Mi A1 Guides, News, & Discussion] georgetoneverland:
Can I relock my bootloader after root to avoid the ugly splashscreen?
[Xiaomi Mi A1 Guides, News, & Discussion] TheBigBoom:
That's pretty much guaranteed to cause trouble. You see the screen only for a few seconds when you restart, does it really matter?
[Xiaomi Mi A1 Guides, News, & Discussion] georgetoneverland:
Absolutely not, I've been rooted my nearly new phone to resolve the low volume 'feature' by Xiaomi and I would have liked to forget that :cyclops:
[Xiaomi Mi A1 Guides, News, & Discussion] TheBigBoom:
Sorry, no way to remove the bootloader unlocked message as far as I know. And you can't have a rooted phone with a locked bootloader, so if you lock it it most likely won't boot at all.. and then reunlocking it will wipe all your data from it (another new "feature" from the may update). So my advice is - leave it as it is
[Xiaomi Mi A1 Guides, News, & Discussion] NeatWolf:
Hi there,

I discovered too late that fastboot oem unlock would wipe my phone (May Update), so I'm kind of stuck with a grayed out "OEM/bootloader unlocked" (or similar translation) option in the dev options, and that ugly warning screen at boot.

Now, I don't really care about relocking it, as OTA updates still seem to be working (I can't fully tell until next update), even if I was only going to install Google Camera and relock it. Of course I'm not going to relock it at this point, as I suspect that would wipe my mobile again.

Now, since the bootloader is already unlocked, is it relatively "safe" the root procedure explained in post 1, of course skipping the oem unlock/locking part, with May Update already installed?

Are there boot.img May versions available?
[Xiaomi Mi A1 Guides, News, & Discussion] rajdedhia10:
Doubt regarding

I have heard that fastboot oem unlock command is wiping data of phone on May security patch. Is it true??
[Xiaomi Mi A1 Guides, News, & Discussion] TheBigBoom:
Yes

---------- Post added at 01:22 PM ---------- Previous post was at 01:14 PM ----------

Whether the bootloader is locked or unlocked has no impact on whether the updates work. I don't think relocking it wipes again but yes, the root procedure in post 1 is safe (though you'll have to find the latest May patched boot somewhere in the last pages, I don't think the one in the first post got updated for the second may update. I'd also advise watching this video and follow it what to do when a new OTA comes - DON'T follow the guide in the first post about installing Magisk in second slot when an OTA comes. And of course, disable automatic updates in dev options
[Xiaomi Mi A1 Guides, News, & Discussion] makinapufterpup:
For those that aren't seeing the "direct method" option with the mayroot.zip, it is because of what marhensa said. The May .13 update patched_boot.img posted in the 28-May-2018 post by vaibhav011286 worked for me. Hope this helps.
[Xiaomi Mi A1 Guides, News, & Discussion] freekarol:
I want to root my phone now and I have these 2 questions:

1.There is no June update patched_boot.img so after rooting I will have to search for new updates, right?

2.Isn't enough to uninstall Magisk, update phone and then install Magisk as it can be seen it this video(time 4:46):https://www.youtube.com/watch?v=2wanENWhE9I
[Xiaomi Mi A1 Guides, News, & Discussion] bubundas17:
Yap got it.
[Xiaomi Mi A1 Guides, News, & Discussion] sballato:
Hello and thank you for your work

I have a problem with magisk, after doing the whole procedure, when I install the apk magisk manager 5.5.3 I stay on the home screen and do not go further

I tried a mistake and come back but nothing

Tips?

I solved, the problem was that magisk started from sd and not from internal memory
[Xiaomi Mi A1 Guides, News, & Discussion] BBOrno:
need help: after install selinux and active i restart ,y phone. but it stuck on *android one logo* what should i do??
[Xiaomi Mi A1 Guides, News, & Discussion] goofball2k:
Is this after a factory reset from Oreo,

or

did you have Nougat with Magisk with the upgrade to Oreo?
[Xiaomi Mi A1 Guides, News, & Discussion] Ammo thind:
does it require latest adb and platform tools to work
[Xiaomi Mi A1 Guides, News, & Discussion] goofball2k:
You need updated fastboot, as older fastboot does not understand a/b partitions so it won't execute when trying to flash to a/b.
[Xiaomi Mi A1 Guides, News, & Discussion] Ammo thind:
will you please tell what lates adb available
[Xiaomi Mi A1 Guides, News, & Discussion] goofball2k:
https://developer.android.com/studio/releases/platform-tools.html#tos-header
[Xiaomi Mi A1 Guides, News, & Discussion] SrikanthMergu:
After doing above steps

Download latest magisk manager from online . You can get it on apkmirror

Then install magisk installer from magisk manager using direct method

You didn't mentioned these steps

Add these
[Xiaomi Mi A1 Guides, News, & Discussion] Rajeev:
OTA will not work if we did some changes in System. Correct na?
[Xiaomi Mi A1 Guides, News, & Discussion] jashancheema:
Yes use magisk modules only
[Xiaomi Mi A1 Guides, News, & Discussion] Rajeev:
Hmmm... Without changing system files I can't live ... :D
[Xiaomi Mi A1 Guides, News, & Discussion] Bhagyesh19:
Can i install OTA updates after rooting mi a1 with this method ??
[Xiaomi Mi A1 Guides, News, & Discussion] varunCrazy:
Safety net shows false

ctsProfile: false

basicIntegrity: false

Why? Please help
[Xiaomi Mi A1 Guides, News, & Discussion] jashancheema:
Direct install magisk in magisk manager and reboot
[Xiaomi Mi A1 Guides, News, & Discussion] _mysiak_:
No :) You need to have stock boot.img to install OTA.
[Xiaomi Mi A1 Guides, News, & Discussion] Vikrantsinh:
Can you please share with me boot.image for MiA1?
[Xiaomi Mi A1 Guides, News, & Discussion] blondeal:
Is there any way to unroot the phone after root performed with this method ?
[Xiaomi Mi A1 Guides, News, & Discussion] Bazilli:
e: search worked
[Xiaomi Mi A1 Guides, News, & Discussion] ibooth2004:
I'm experiencing an issue with using Magisk (16.0 and 16.4) on the stock ROM, this happens on both stock 8.0 and the leaked 8.1 build, Magisk works but occasionally when I boot my IMEI and baseband version both say unknown, simply rebooting fixes the problem but it's still really annoying, any help would be appreciated as I've looked all over Google and XDA and can't find a solution.
[Xiaomi Mi A1 Guides, News, & Discussion] Bazilli:
Can someone share 9.5.11 untouched boot image? I made factory reset and now Magisk works still but my backup is gone for next OTA. :(
[Xiaomi Mi A1 Guides, News, & Discussion] Dimcode:
How can we check whether the system files has been modified or not and which file is modified?

I never succeeded to do OTA update through Magisk systemless option, always fallback to generic method resetting the system partition which is painful and tedious.

I'd appreciate it if anyone know how to know the system state. Thank you.
[Xiaomi Mi A1 Guides, News, & Discussion] hipratik2008:
need may patch

need the may patch
[Xiaomi Mi A1 Guides, News, & Discussion] xda_joze:
I can root the phone as described in the 1st post, but after restart, the root's gone - the magisk is not installed anymore. Any idea? I tried both may patched boot.
[Xiaomi Mi A1 Guides, News, & Discussion] TheBigBoom:
Did you do direct install or just booted with the patched boot and left it like that?
[Xiaomi Mi A1 Guides, News, & Discussion] xda_joze:
thx

What does direct mean? Installing Magisk directly and no via manager?
[Xiaomi Mi A1 Guides, News, & Discussion] TheBigBoom:
After you boot with the patched boot open Magisk, click "install" and then "Direct install (recommended)" like shown here
[Xiaomi Mi A1 Guides, News, & Discussion] xda_joze:
First I could not see this option. :(

.. but after reboot I could see that Magisk was installed, so I uninstalled, and when I try to install it again I could see the options, I think it was also important to be connected on WiFi.

But after, a few times the phone stuck during the (re)boot.

Anyway now I have root (permanently).
[Xiaomi Mi A1 Guides, News, & Discussion] Boobseekr:
I got rooted successfully but the wifi is no longer working. Please help :(

---------- Post added at 02:12 AM ---------- Previous post was at 01:29 AM ----------

is your wifi working? I'm now rooted even if I reboot my phone but my wifi isn't working. Please help
[Xiaomi Mi A1 Guides, News, & Discussion] xda_joze:
In my case it works. Did you use may boot patch from the 1st post, or one from another post from 28th of May?
[Xiaomi Mi A1 Guides, News, & Discussion] koenichlich:
I have the same problem. As soon as I use the patched boot.img (tried both April & May from 1st post), wifi won't enable.
[Xiaomi Mi A1 Guides, News, & Discussion] xda_joze:
Have you tried patch mentioned here:

https://xdaforums.com/showpost.php?p=76592260&postcount=1094
[Xiaomi Mi A1 Guides, News, & Discussion] koenichlich:
Thanks for the quick reply. I have just done so - same as before.

Magisk itself does run, but wifi won't enable.
[Xiaomi Mi A1 Guides, News, & Discussion] ngohoainam:
i have the same problem with yours. this issue occurs because patch_boot file has bug. you can use your 3G/4G to install. after install and restart, your phone will turn on wifi normally :)
[Xiaomi Mi A1 Guides, News, & Discussion] koenichlich:
I forgot to mention - my old phone uses a mini-SIM and I haven't yet received the micro-SIM needed for the A1 :silly:

I'll test again as soon as I have it and let you guys know.
[Xiaomi Mi A1 Guides, News, & Discussion] elflois:
Hi there,

I followed every step: Unlock OEM/Depuration>install magisk>boot may patch>run magisk(direct install)

and when the phone reboots I dont have IMEI/Baseband any idea why?

I tried a diferent method flashing magisk zip through TWRP and have the same result. I kind of panicked as I don't have EFS backup but flashing stock via mi flash restored IMEI/baseband. In any case I'm a little worried about touching anything again as it seems it doesn't work for me.

I purchased de Mia1 beacause I thought it would be easy to root...I have been a year with a phone with the bootloader locked and I miss Viper4android a lot, adaway too but the viper4android its a dealbreaker for me.

Can someone help me understand what can I have done wrong? also if there is a way to backup EFS without root I'll apreciate if you let me know :)
[Xiaomi Mi A1 Guides, News, & Discussion] elflois:
Nevermind, I tried again using the May boot_patch from the first page and managed to get it working, thank you for everything
[Xiaomi Mi A1 Guides, News, & Discussion] elflois:
Me again ^^, I just realized that as son as I install magisk I have either baseband/IMEI or don't, I mean, when I restart the phone sometimes I have my sim detected sometimes not, and I have to restart it again in order to work. I think I read that someone had a similar problem, is there anything I can do?

Also I try to backup EFS (now that I have root access) and seems like there is no EFS folder, tried searching the folder via Root browser, and tried an app called EFS backup wich says no efs Folder availible.

Hopefully someone could tell me what I m not doing right

thanks!
[Xiaomi Mi A1 Guides, News, & Discussion] Johnn78:
Now I have unlocked bootloader & rooted with magisk. I didn't do this from this thread but with adb & twrp method. If I want to get ota can I follow the "USE THIS GUIDE WHEN OTA ARRIVES" of first page or because I haven't flashed the "patched_boot.img" then I can't get ota now ?
[Xiaomi Mi A1 Guides, News, & Discussion] timeiscoffee:
I've followed all the steps and cannot seem to get OTA to work. Is there a way to determine what the issue is?

I've tried flashing april, may and the other may patched_boot.img with no success...
[Xiaomi Mi A1 Guides, News, & Discussion] leosvycichl:
Magisk update

Hey guys, just wanna ask what to do when the Magisk says it needs an update to 16.0.

I may look like an idiot, but I really don't know what to do. Please help :(

There are 2 options

Download Zip only and Patch image file.
[Xiaomi Mi A1 Guides, News, & Discussion] sgloki77:
I had the exact same issue, as soon as you install magisk, the phone will boot without data/imei, just boot it again and is normal then, I have read several people having the same issue

I created a thread on questions and answers but got no workable solution, just install magisk and every time you boot, you have to boot twice, is annoying but it works
[Xiaomi Mi A1 Guides, News, & Discussion] Rnayar18:
never happened before after entering it wiped my phone why
[Xiaomi Mi A1 Guides, News, & Discussion] TheBigBoom:
Unlocking the bootloader wipes the phone as of the May update, it's been mentioned a lot lately
[Xiaomi Mi A1 Guides, News, & Discussion] btripin:
As above really, followed the instructions on the first page (may update) and upon opening magisk there is NO direct install option, had a play with download zip and patch image file but cant get it to work, can someone please guide me and leosvycichl in how to get magisk working and perhaps update the first page to a working method?
[Xiaomi Mi A1 Guides, News, & Discussion] StenniS-NL:
June patched boot image?

Has anyone found a patched boot image from June?

Your help is appreciated.
[Xiaomi Mi A1 Guides, News, & Discussion] gdimakiss:
So now that we have the June Ota update we proceed with the update and we do not lose the root??
[Xiaomi Mi A1 Guides, News, & Discussion] DeV91:
Here, i just created this boot.img. 8.1 June 1 with Magisk 16.4
[Xiaomi Mi A1 Guides, News, & Discussion] Bennybtc:
How do you update to 8.1? Please provide steps you proceed to update without losing magisk root. Thanks in advanced
[Xiaomi Mi A1 Guides, News, & Discussion] freekarol:
I tried an alternative method and it was working for me: https://xdaforums.com/mi-a1/how-to/alternative-root-mi-a1-twrp-disabling-t3764271
[Xiaomi Mi A1 Guides, News, & Discussion] DeV91:
Well, I did the mistake and tried to update with Magisk (Install to second slot after Update - as written here).

I already knew this would probably not work, i was stuck in a bootloop after i tried. You should not try to do this with Major/Minor updates (e.g. major 7 -> 8 or in this case minor 8.0 -> 8.1). Security Updates are fine tho with this method.

If any of you guys tried this - just run 'fastboot set_active other' and it will revert to 8.0 and a message will appear: failed to update

Instead, just do a clean update (you will loose Magisk obviously).

After that, just repeat the rooting process - just a matter of 10 min.

1. 'adb reboot bootloader'

2. 'fastboot boot [twrp.img]' -> read only

3. flash Magisk via twrp

And you'll still have OTA capability
[Xiaomi Mi A1 Guides, News, & Discussion] Bennybtc:
Did you successfully flash magisk via twrp? Because a while ago, i did want to flash something via twrp boot, and it failed

And 1 more question, did unlocking bootloader on 8.1 june wipes data?
[Xiaomi Mi A1 Guides, News, & Discussion] DeV91:
Yes, I did. Never failed for me.

I unlocked bootloader a while ago (mid 2017). And never relocked / reunlocked. Not able to help you with this.
[Xiaomi Mi A1 Guides, News, & Discussion] Sticky92:
fastboot set_active other is not doing anything. what should i do?
[Xiaomi Mi A1 Guides, News, & Discussion] skkardam:
June patched file please
[Xiaomi Mi A1 Guides, News, & Discussion] marhensa:
damn, i don't realize there's two 8.1 releases.

1st June and 5th June security update.

your patched boot.img is not compatible with 5th June security update.

it breaks WiFi and causing bootloop when flashed to latest update.