Indeed, my apologies, it was post #4.
The precise error reported is pretty much identical (This is a copy paste from #4):
error: adb: preparesytemimage: error: {"error":{"code":1,"cmd":"C:\\Users\\tman1\\AppData\\Local1\\Temp\\1z2CZhpznORyjIPpqvVgfFBXFGZ\\resources\app.asar.unpacked\\node_modules\\android-tools-bin\\dist\\win32\x86\\adb.exe -p 5037 shell mkdir -p /cache/recovery"},"stderr":mkdir: '/cache/recovery": required key not available"}
The error prevents the installer from reporting it has completed, that is to say it never completes.
The phone now always boots to UBPorts Recovery or fastboot. The original MIUI is no longer available. So not bricked,
I followed what I thought were the steps outlined in the reply (use an older version being 0.8.9). It is entirely possible that I missed something however.
I am thinking now that after the phone unlocked its identity changed invalidating any previous authorization adb had made. I cannot remember if the adb authorization step was carried out again or not. Could this be a cause of this symptom? However, I am certainly able to use adb and even run a shell when UBPorts Recovery is running, although this may have no bearing on the issue (required key not available).
In any case I'll now locate the mentioned recovery and prepare to reflash the original firmware back in as per your advice.beta
EDIT: Further to the further...... SUCCESS !!!
So I download 0.8.8-beta following advice from another post. Then various people had the same issue as me with this version too (so that's 0.9.1, 0.8.9 and 0.8.8) when a person said this issue is caused by infomation left in a user paritition from a previous OS. He said you must wipe the user data. So following that advice I checked the wipe data setting before running. It worked!
I now have the UBPorts Ubuntu operating system running on my phone. I am very happy too
Thanks for your help it is greatly appreciated and I hope this helps someone else.