[Xiaomi Mi A2 Lite Guides, News, & Discussion] Maik93:
[Update in 1st September 2018] Magisk v17 stable has been released, so the August security update: a new method, more OTA-compliant, is written.

Hi all, this section is quite gaunt, so I'll post my experience on unlocking and rooting my brand new Mi A2 Lite.

I'm not responsible if you make some mistake and accidentally transform your phone in a stone (but it's almost impossible)... <3

How to root

0. You need "debug usb" and "oem unlock" enabled under "developer options" on phone's settings.

1. First, if you don't have already done it, unlock phone's bootloader:

adb reboot bootloader
fastboot oem unlock

ATTENTION: THIS WILL WIPE YOUR DEVICE, ALL USER DATA WILL BE LOST! And no, when you'll have finish this guide, you can't lock it again (each lock-unlock operation will wipe the device)

2. Download ROM system image from official site. Pay attention to download the corresponding version of your actual OS (look in system settings your current build number).

3. Extract "boot.img" from the just downloaded archive and put somewhere in your device (e.g. in a microSD, just remember where you put it).

4. Download and install Magisk Manager apk.

5. Open Magisk, choosing "yes" when it asks to install Magisk-v*.zip, then choose "patch boot image" and select "boot.img" copied in step 3.

6. At the end of patching process, Magisk will tell you where "patched_boot.img" is been stored, keep a note on it and close.

Now's the updated part, that will make possible to apply OTAs:

7. Copy "patched_boot.img" on your computer, then run this on a terminal:

adb reboot bootloader
fastboot boot patched_boot.img
fastboot reboot

This will temporarily give you root privileges (until next reboot).

8. Magisk Manager can now make the root permanent: open it and tap "Install", then "direct install (recommended)". This way (instead of flashing directly patched_boot.img) Magisk Manager can remove and reinstall root privileges directly.

9. Just to be sure that your phone doesn't install updates without your acknowledgement, go to Developer Options and disable "Automatic system updates".

Ta-dà! Now you should have Magisk permanently installed (you can check it re-opening Magisk Manager).

-------------------------------------------------------

Time to update? Here's how

If you've followed what is written above, applying an OTA should be quite easy now.

a. Go to Magisk Manager → Uninstall → Restore Images. Do not reboot now or you will have Magisk uninstalled!

b. Now go to Settings → System → System Update and apply OTA. If it fails you've some tweak on system partition that you've forgot to remove, so try to figure it out and retry. Wait for the installation to complete. DO NOT RESTART NOW.

c. Open Magisk Manager again and press Install → Install to Inactive Slot.

d. Reboot and enjoy :)

-------------------------------------------------------

Troubleshooting

- If your phone seems bootlooping, try to switch it off and on again (sometimes it doesn't start on first boot). If it keeps doing that, donnoh, reflash original "boot.img" and start again!

- For someone seems that Magisk 16 doesn't work well, but since the stable branch has reached 17.0, just use it! ;)

- If you already have rooted your phone in different ways that this one explained here (and you don't have "uninstall" option on Magisk Manager), I suppose that the simpliest way to follow this guide is to reflash factory boot.img and start from the beginning of this post again, but if you figure out alternative ways, post them here!

-------------------------------------------------------

References

https://xdaforums.com/mi-a1/how-to/mi-a1-monthly-updates-t3750419

https://xdaforums.com/showpost.php?p=77448469&postcount=49

https://xdaforums.com/mi-a1/how-to/root-mi-a1-oreo-8-0-disabling-ota-magisk-t3728654

https://github.com/topjohnwu/Magisk/blob/master/docs/tips.md#ota-installation-tips

Thanks to BubuXP for the efforts that he puts in this thread, helping anyone who's got problem following this guide.

Have a nice day!