I decided to replace MIUI 12.0.3 on my POCO F1 with a custom ROM because the phone will get no further update from Xiaomi. I have written the entire procedure in three parts:

How

This step is to replace the stock recovery image with the venerable Magisk android application. The reason for using Magisk is to replace the recovery image on the phone permanently. Otherwise, MIUI will replace TWRP with the stock recovery image every time the phone reboots, in which case, I will have to re-run steps below to boot into TWRP image.

Watch the video to get an idea the entire procedure using MS Windows, https://www.youtube.com/watch?v=ZKEHRco06Eo Below I describe what I had to do differently using Fedora 34 Workstation.

Also important as emphasised in the video is that I have decided to retain “Encryption and Credentials” encrypted on the phone. This will mean having to perform backup and restore personal files if I opt for a custom ROM which does not support OTA and want to update it.

  1. Download the latest Magisk APK from https://github.com/topjohnwu/Magisk/releases and save the APK file on the phone

  2. Download the latest Android platform tools from https://developer.android.com/studio/releases/platform-tools

  3. Unzip the package anywhere, e.g. /tmp/platform-tools

  4. Download the latest TWRP specific to the phone from https://twrp.me/xiaomi/xiaomipocophonef1.html I was actually confused by the instructions given on the page. In the end, what really mattered was to download the image file and do nothing else. At this time, the file was twrp-3.5.2_9-0-beryllium.img

  5. Copy the image file to /tmp/platform-tools and rename it as twrp.img for convenience, and also copy it to the phone.

  6. On the phone, go to Developer Options to enable USB debugging

  7. Connect the phone to the computer using the original (or fully USB2 compliant) cable

  8. Test connectivity between them. The output should display one device detected. If not, try other USB ports on the computer. Avoid USB-3 ports if possible because there’s reported issues involving USB Hub.

     cd /tmp/platform-tools
     sudo ./adb devices
    
  9. Use adb to reboot to “fastboot” mode. After the command, the phone should reboot to a static “fastboot” image.

     sudo ./adb reboot bootloader
    
  10. Test connectivity again to be sure but using fastboot command this time. Again, the phone should be listed.

     sudo ./fastboot devices
    
  11. Boot to TWRP image. When TWRP main menu shows up on the phone, disconnect the USB cable. From here on, follow every step exactly given in the video which I have listed below for convenience.

     sudo ./fastboot boot twrp.img
    
  12. On TWRP main menu, select “Install image” and browse to the TWRP image file previously copied to the phone, and select “Recovery”. When complete, select Home option to return to main TWRP menu, select Reboot - Recovery

  13. Rebooting back to TWRP main menu, select Install and browse to Magisk APK file previously copied to the phone. Reason for doing this step is well explained in the video. When done, Reboot System.

  14. Test that TWRP has replaced the stock recovery image successfully, switch off the phone. Press Volume-up and Power button at the same time to go into recovery mode. It should show TWRP main menu now.