Note: please use this guide at your own discretion. I will not be responsible if Aliens finds you for this.
To successfully flash Lineage OS to Mi 5s, there are few things to take care of.
1- Need Xiaomi account. Link in step 3 for applying.
2- USB debug should be enabled in the phone from developer mode.
3- The unlocking process to be honest is painfully long and need a bit of patience. Like you will need Xiaomi account, then attach you account in the phone settings in developer mode for unlocking. At this point it will say phone locked. You will need to unlock the phone by applying for unlocking. (http://en.miui.com/unlock/)
4- You will also need windows for the next step to unlock(download the unlock app). Then go to fastboot by shutting down the phone and start it while holding Vol key down + power button. The steps are self explanatory in the app itself.
After this, download TWRP, Lineage OS for Mi 5s, Google apps(if thats your thing).
Download TWRP for Mi 5s(also called capricorn).
Download Google apps(ARM64, 7.1, nano)
After download connect your phone to your PC(Ubuntu here) and copy over the files(Lineage and G apps). This step can be done later too with command line.
Power off your phone and start it while holding Vol key down + power button. You will see fastboot.
Open terminal and lets install the necessary libs:
sudo apt install adb fastboot
While in fastboot, check that your phone is detected.
sudo fastboot devices
If all good, lets boot with TWRP from your machine. Please change the path from /backups/Applications/Mi5s to the dir where the file is located.
sudo fastboot boot /backups/Applications/Mi5s/twrp-3.1.1-0-capricorn.img
The phone will be booted with TWRP. Tap Wipe and then advanced. Clean delvik/art cache, cache, system, data.
Go back to main screen and tap Install. Choose Lineage OS zip file to install(if you get stuck, check the troubleshoot section below), after successful installation do the same with Google apps. Reboot and wait for the initial setup to finish.
Camera is working fine, battery is stable compare to MiUI. I personally have no issues so far with it.
If you get stuck with update error 7 and verify_modem with red color. Its easy to fix.
Extract the archive of Lineage OS on your PC and go to META-INF -> com -> google -> android and open the updater-script file in editor. Remove this line:
assert(xiaomi.verify_modem("2017-07-05 22:57:20") == "1");
Save and create a zip of the extracted files.
Push this to your phone with adb. Please change the path to the newly created file.
sudo adb push /backups/Applications/Mi5s/lineage-os-0724.zip /sdcard/
Try to install again.