[Xiaomi Mi A3 ROMs, Kernels, Recoveries, & Other De] axon7fan:
My installation instructions

I appreciate that others have posted how to install the Pixel Experience, however I had a lot of problems, maybe because I didn't read the instructions thoroughly enough, however I've decided to write my own steps from a Xiaomi Mi A3 phone ordered from tobydealsau.com. The phone is a model M1906F9SH with 4GB RAM/64GB flash.

To flash I first downloaded TWRP from this thread (twrp-3.3.1-2-unofficial-laurel_sprout.img and twrp-3.3.1-2-unofficial-installer-laurel_sprout.zip).

Note that if you use twrp-3.3.1-15-laurel_sprout-mauronofrio.img then the PixelExperience ROM zip file will not install in TWRP because it will give an error (4 or 7, I forget) and if you do the following while attempting to install the ROM in TWRP:

adb shell
logcat

... you will get the error message:

03-10 13:14:49.277 449 593 E libc : The property "ro.build.fingerprint" has a value with length 96 that is too large for __system_property_get()/__system_property_read(); use __system_property_read_callback() instead.

So use the generic TWRP!

The first thing I had to do was save a copy of the stock boot image (in case I got into trouble later and needed to flash the boot partition from fastboot in future). This involves installing TWRP into the inactive slot (there are two slots on the phone, A and B, by default a new phone starts with slot A active) and then copying the boot image from slot A.

Turn on the brand new phone, and go through the setup, but do not put in a SIM card, do not connect to the Internet via WiFi, you do not want the OS to upgrade itself! Once the system has booted and you are in do the following:

Swipe up from bottom > Settings > About Phone > Tap Build Number 7 Times

Settings > System > Advanced > Developer options > USB debugging to on

Settings > System > Advanced > Developer options > OEM unlocking to on

Now we will unlock the phone. Reboot to the bootloader.

adb reboot bootloader

Wait for the boot loader image to appear. Then unlock the phone (this will trigger an erase then a reboot and you'll have to go through the above stages again to set up the phone all over again):

fastboot flashing unlock

Once again you'll have to reboot from the system to the bootloader so you can unlock again:

adb reboot bootloader

Wait for the boot loader image to appear. Then type:

fastboot flashing unlock_critical

Again the phone will erase and reboot and you'll have to go through setup again. But now the phone is fully unlocked.

adb reboot bootloader

Now find out the currently active slot (A or B):

$ ./fastboot getvar current-slot
current-slot: a
finished. total time: 0.002s

Switch to the inactive slot ("b" if the above returned "a", or "a" if the above returned "b").

$ ./fastboot set_active b
Setting current slot to 'b'...
OKAY [ 0.039s]
finished. total time: 0.039s

Verify that you've activated the other slot (in this case "b"):

$ ./fastboot getvar current-slot
current-slot: b
finished. total time: 0.002s

Now flash TWRP image file to the boot partition of this other slot.

$ ./fastboot flash boot twrp-3.3.1-2-unofficial-laurel_sprout.img
sending 'boot_b'...
OKAY [ 1.087s]
writing 'boot_b'...
OKAY [ 0.191s]
finished. total time: 1.279s

HOLD DOWN the VOLUME UP key before executing the next line and KEEP HOLDING until the TWRP logo appears:

$ # HOLD DOWN the VOLUME UP key before running the next command
$ ./fastboot reboot
rebooting...
finished. total time: 0.050s

Now TWRP logo has appeared.

Save a copy of the boot images.

$ adb shell
laurel_sprout:/ # dd if=/dev/block/by-name/boot_a of=/sdcard/old_boot_a.img
131072+0 records in
131072+0 records out
67108864 bytes transferred in 0.724 secs (92691801 bytes/sec)

laurel_sprout:/ # dd if=/dev/block/by-name/boot_b of=/sdcard/old_boot_b.img
131072+0 records in
131072+0 records out
67108864 bytes transferred in 0.744 secs (90200086 bytes/sec)

laurel_sprout:/ # exit

$ adb pull -p /sdcard/old_boot_a.img
$ adb pull -p /sdcard/old_boot_b.img

You should now have old_boot_a.img and old_boot_b.img on your desktop/laptop for safe-keeping. The old_boot_a.img is important, it is the untampered stock boot image.

Now install TWRP into both slots by copying the TWRP zip file and then installing it.

$ adb push twrp-3.3.1-2-unofficial-installer-laurel_sprout.zip /sdcard/

In TWRP go to INSTALL and then choose the TWRP zip file and choose install.

Next I downloaded the PixelExperience ROM from this thread. And I downloaded stable Magisk zip and Magisk Manager apk from this thread. I also obtained patch_no_fde10.zip from this thread I think.

To install PixelExperience I had to first change slot to the original primary ("a" in my case) because TWRP flashes ROMs to the other slot (!!! I didn't realise this for a long time).

Go to TWRP reboot menu, choose the primary slot (that you don't want to install the ROM into), then choose to reboot into recovery. TWRP will re-appear.

Next choose the wipe menu from TWRP, choose to wipe "dalvik", "system", and "data" (yes, data needs to be wiped or PixelExperience stays stuck on the loading screen forever with the Google Icon, actually I tried formatting data in TWRP before PixelExperience actually worked so maybe that is necessary).

ADVANCED_NOTE: if you want to be able to encrypt your phone (encrypt the data partition) then you'll have to custom format the data partition before you install PixelExperience ROM. I'll make a separate post about this.

Push the ROM, Magisk installer, and patch_no_fde10.zip to the phone:

$ adb push PixelExperience_laurel_sprout-10.0-20191110-1230-OFFICIAL.zip /sdcard/
$ adb push Magisk-v20.1.zip /sdcard/
$ adb push MagiskManager-v7.4.0.apk /sdcard/
$ adb push patch_no_fde10.zip /sdcard/

Now, in TWRP, double check (from the reboot menu) that you are in the primary slot (not the slot you want to install the ROM on, in my case "a" because I was installing to the inactive slot "b").

Install the PixelExperience ROM zip from TWRP.

Install the TWRP zip (again) from TWRP. You must do this every time you install a ROM.

Now go to the reboot menu, and choose the secondary slot (in my case "b"), and then reboot into recovery.

When TWRP restarts double-check you're now on the secondary slot (in my case "b").

In TWRP, install the Magisk zip. It will patch the current slot's boot image to root it.

In TWRP, install the patch_no_fde10.zip file.

Now you are ready to boot into system. Hopefully all has gone well and PixelExperience boots after 5-10 minutes.

If you find yourself in PixelExperience without problems you can navigate to your sdcard in File Manager, find the Magisk apk, and open it, Magisk should confirm that your phone is rooted.

I attempted an upgrade of PixelExperience so went to the Settings > System > Advanced > System updates setting page and downloaded the latest PixelExperience. I tried running the Install from the menu but it did nothing. So I reboot to TWRP (hold down VOLUME UP while rebooting to go back into TWRP). I switched to the slot I wasn't using (I was using slot "b" for my ROM so I went to the reboot menu in TWRP and chose slot "a" and then reboot to recovery).

Then after rebooting to TWRP recovery again, and confirming I was, indeed, on slot "a" (the slot I wasn't using), I proceeded to install the update ROM from /data/system_updates (I think).

Immediately afterwards I used TWRP to install TWRP zip again (necessary).

Then I chose the slot I was using for PixelExperience (reboot menu, choose slot "b", reboot to recovery).

Then I installed the Magisk zip again (necessary to restore root).

Then I installed patch_no_fde10.zip again.

Then I rebooted to system. It worked for me.

What's not working for me? I can't seem to encrypt the system from the Settings > Security > Encryption & credentials > Encrypt phone menu.