LineageOS on Poco X3 Pro

Menu

LineageOS and Xiaomi

LineageOS is the Android distribution I have been using for the last six years. I really like it. It is privacy-conscious and allows to de-Google your phone. The result is more control on your data and a far less distracting experience.

I have also been using Xiaomi phones for quite a few years now. Xiaomi builds excellent phones and they are very well supported by LineageOS. The installation of LineageOS, however, requires a rather convoluted procedure to unlock the phone, which includes launching a Windows-only app.

This post describes how I managed to unlock the phone on an Arch Linux box, using a virtual machine with Windows 11. The post provides also the links to the required software.

If you have a simpler solution, drop me an email, and I will update the post accordingly!

Prepare a Windows 11 Virtual Machine

Install qemu and virt-manager, which will be used to run the virtual machine:

sudo pacman -Ss qemu virt-manager

Download a Windows 11 development environment from the Microsoft website. I downloaded the VirtualBox Image, but there are other virtual machine images here, if you use a different virtualization platform.

Convert and VirtualBox image to a qcow2 image, by extracting the vmdk image from the ova file and converting it to a qcow2 image:

tar xvf WinDev2202Eval.ova 
qemu-img convert -O qcow2 WinDev2202Eval-disk001.vmdk \
         WinDev2202Eval.qcow2 

Run the Windows machine using virt-manager or similar software; I prefer virt-manager, since it simplifies USB forwarding on the guest.

Very Important!! Install the Xiaomi drivers for the phone on the Windows guest. If you don’t do that, the phone will not be seen by the unlocking app.

  1. Download the Xiaomi drivers for the Poco X3 Pro, found here: http://bigota.d.miui.com/tools/xiaomi_usb_driver.rar1
  2. Install a RAR unpacker from the Microsoft Store.
  3. Disable driver signature enforcement. The drivers shipped by Xiaomi, in fact, do not include a signature. A good guide can be found here: How to Disable Driver Signature Enforcement on Windows 11/10?
  4. Install the Xiaomi drivers following the procedure for legacy USB drivers.

Unlock the Phone

We are now ready to unlock the phone … ahem, ask Xiaomi to unlock the phone. Xiaomi, in fact, imposes a grace period of 130 hours before allowing one to unlock the phone.

The unlocking instructions are available on the LineageOS wiki for vayu. The first two steps include:

  1. Getting an account with Xiaomi’s website, if you don’t have it already
  2. Downloading the MI Unlock app and following the instruction on the app.

The app requires to insert a verification code sent via SMS. In my experience, the validity expiration set by the app for the first two/three attempts is much shorter than the time needed for the actual SMS to arrive. The first few attempts might thus timeout. Keep asking for a new token.

The phone has to be explicitly mounted on the virtual machine. This is done by selecting Virtual Machine > Redirect USB Device from the Virt Manager window and then by checking the “Google Android” device.

Install LineageOS

We are now ready to install LineageOS. The procedure is straightforward: follow the instructions available on Install LineageOS on vayu and you are all set!

LineageOS being installed

Footnotes:

1

The link can easily be found on this page 图文详解小米手机驱动 安装! … and, if you are wondering, no I don’t speak Chinese: I found the link in Pinyin from this page: [GUIDE][UNLOCK][ROOT] How to unlock bootloader, flash ArrowOS v11.0 ROM and root Xiaomi Poco X3 Pro