[Xiaomi Redmi 4X Questions & Answers] ro-jc:
This is my first time posting on this forum, please do correct me if I'm doing something wrong or haven't provided some information I should have.

I have a Redmi 4 running MIUI Global 11.0.2 (NAMMIXM) which is about four years old and whose bootloader I've been trying to unlock for the past 2-3 days and running into issues.

I run linux on the system I use on a day to day basis, so my first option was XiaoMiTool V2. I enabled developer options, OEM unlocking, added my account in the Mi Unlock Status option and logged in successfully from within the tool but while running the operation to unlock the bootloader through it, I hit an error telling me that there was a serviceToken that was missing. I did find a thread on here that linked to a github issue for the tool, which recommends changing a line (or a few) in the source code and rebuilding the tool. I'm yet to try this, but I figured finding a windows laptop and using the official tool may be easier.

I got my hands on a laptop running windows 10 Pro and downloaded the mi unlock tool version 6.5.224.28 from the official website which when launched prompted me to get the latest version which was apparently 6.5.314.30. After logging in and fumbling around with the drivers for a bit, I got it to recognize my device in the fastboot mode and it finished verifying my device and launched the unlocking process but stopped when it reached 99% with the error "Can't get info, connect again". That's when I found some threads suggesting I enable Mi Cloud and Find My Device and did that, to no avail.

I logged into my Mi account in a browser and located my phone through it as a thread suggested and waited for more than a day (again, what seemed to have worked for someone in the thread). This time I tried with my PC with a clean install of windows 10 dual booted with linux. I still get the same thing error about not getting info, even using drivers installed using a previous version of Mi Unlock tool (the latest one seemed to be missing the program to install the drivers). I tried unlocking with previous versions of this tool too (3.5.1108.44, 4.5.813.51) but with them, on logging in I would just be taken to what seemed like would be my Mi Account page and left there with no obvious indication as to what I'm expected to do next - just connecting my device in the fastboot mode didn't seem to do anything.

I had a look at the logs of the Mi Unlock tool (latest version) :

2022-3-27 Version:6.5.314.30 Process<00003708> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Begin List Enviroment Variables.
...
DEBUG <16:43:16.635,T:13496> : Login success and get user detail
DEBUG <16:43:16.702,T:13496> : WA_AccountLogin
DEBUG <16:43:16.702,T:14344> : WA_AccountLogin
DEBUG <16:43:16.702,T:14344> : get set_check_page msg
DEBUG <16:43:16.704,T:14344> : longin page switch to check page
DEBUG <16:43:16.704,T:5844> : check right function start
DEBUG <16:43:18.091,T:5844> : sign result:{
"code" : 0,
"descCN" : "成功",
"descEN" : "success",
"description" : "成功"
}

DEBUG <16:43:31.699,T:14032> : auto refresh device list
DEBUG <16:43:31.703,T:14032> : use desp:USB Composite Device instead of Android
DEBUG <16:43:31.705,T:14032> : use desp:Android Composite ADB Interface instead of ADB Interface
DEBUG <16:43:31.709,T:14032> : new usb\vid_2717&pid_ff48\6b803337d440
INFO <16:43:31.709,T:14032> : fastboot devices
DEBUG <16:43:31.816,T:14032> : auto refresh device list
DEBUG <16:43:31.819,T:14032> : use desp:USB Composite Device instead of Android
DEBUG <16:43:31.821,T:14032> : use desp:Android Composite ADB Interface instead of ADB Interface
INFO <16:43:31.824,T:14032> : fastboot devices
DEBUG <16:43:31.931,T:14032> : auto refresh device list
DEBUG <16:43:31.933,T:14032> : use desp:USB Composite Device instead of Android
DEBUG <16:43:31.936,T:14032> : use desp:Android Composite ADB Interface instead of ADB Interface
INFO <16:43:31.938,T:14032> : fastboot devices
DEBUG <16:43:32.102,T:14032> : auto refresh device list
DEBUG <16:43:32.106,T:14032> : use desp:USB Composite Device instead of Android
DEBUG <16:43:32.108,T:14032> : use desp:Android Composite ADB Interface instead of ADB Interface
INFO <16:43:32.111,T:14032> : fastboot devices
DEBUG <16:43:37.662,T:14032> : auto refresh device list
INFO <16:43:37.668,T:14032> : fastboot devices
DEBUG <16:43:37.803,T:14032> : auto refresh device list
INFO <16:43:37.807,T:14032> : fastboot devices
DEBUG <16:43:43.906,T:14032> : auto refresh device list
DEBUG <16:43:43.909,T:14032> : use desp:Android Bootloader Interface instead of Android
DEBUG <16:43:43.912,T:14032> : new usb\vid_18d1&pid_d00d\6b803337d440
INFO <16:43:43.912,T:14032> : fastboot devices
DEBUG <16:43:44.024,T:14032> : auto refresh device list
DEBUG <16:43:44.025,T:13616> : -s 6b803337d440 oem device-info
DEBUG <16:43:44.027,T:14032> : use desp:Android Bootloader Interface instead of Android
INFO <16:43:44.029,T:14032> : fastboot devices
DEBUG <16:43:44.165,T:13616> : (bootloader) Device tampered: false
(bootloader) Device unlocked: false
(bootloader) Device critical unlocked: false
(bootloader) Charger screen enabled: true
(bootloader) Display panel: Ò’ƒ¾§EÈò5gggíxŠz ‰§fžÿ…§ÍåÊ3†”ÓMí£
OKAY [ 0.006s]
Finished. Total time: 0.006s
DEBUG <16:43:44.165,T:13616> : getvar product -s 6b803337d440
DEBUG <16:43:44.271,T:13616> : product: santoni
Finished. Total time: 0.001s
DEBUG <16:43:44.272,T:13616> : getvar tokenversion -s 6b803337d440
DEBUG <16:43:44.384,T:13616> : tokenversion: 6b80333
Finished. Total time: 0.001s
INFO <16:43:44.384,T:13616> : tokenversion: 6b80333
Finished. Total time: 0.001s
INFO <16:43:44.384,T:13616> : tokenversion=6
DEBUG <16:43:44.384,T:13616> : oem get_token -s 6b803337d440
DEBUG <16:43:44.612,T:13616> : FAILED (remote: 'unknown command')
fastboot: error: Command failed
INFO <16:43:44.613,T:13616> : FAILED (remote: 'unknown command')
fastboot: error: Command failed
DEBUG <16:43:44.613,T:13616> : to check erase feature for 6b803337d440
DEBUG <16:43:44.615,T:13616> : Begin login unlockApi
ERROR <16:43:46.310,T:13616> : 2 req url https://in-unlock.update.intl.miui.com/sts?d=bl_01f3e0e93ab5329dab777a9b453ac160&ticket=0&pwd=0&p_ts=1648379597000&fid=0&p_lm=2&auth=ALRhbCOwLwCVP4G8%2B0HGkyQJdN4UyJTLqcT%2FXwe0aZEIJ5gYJh7CgdEmYOyxwrtV1uFDOJ1YJF126OUqwXUTBK7EWkaiOs%2FF099ycMzhxjyTcwoySarBgXJq1hrfb7CNIgfCpo5%2Fejs7agoSOw69KB9XyjXbZThnEhC0V4g0V8g%3D&m=4&tsl=1&nonce=s5orK%2FNcr%2BgBozRh&_ssign=YFNhkFVWn%2FAUc6bTqDP1yWN9A68%3D&clientSign=xb1TM%2Fhxp16l5gPlyyiEEW7uZsg%3D
ERROR <16:43:46.310,T:13616> : 2 req cookie
DEBUG <16:43:46.615,T:13616> : End login unlockApi
DEBUG <16:43:46.981,T:13616> : An unlocked device is an easy target for malware which may damage your device or cause financial loss.
DEBUG <16:43:49.177,T:14344> : User click unlock button!
DEBUG <16:43:54.794,T:13616> : -s 6b803337d440 oem device-info
DEBUG <16:43:54.929,T:13616> : (bootloader) Device tampered: false
(bootloader) Device unlocked: false
(bootloader) Device critical unlocked: false
(bootloader) Charger screen enabled: true
(bootloader) Display panel: Ò’ƒ¾§EÈò5gggíxŠz ‰§fžÿ…§ÍåÊ3†”ÓMí£
OKAY [ 0.006s]
Finished. Total time: 0.006s
DEBUG <16:43:59.808,T:13616> : VerifyDeviceInfo
INFO <16:43:59.809,T:13616> : product:santoni
DEBUG <16:43:59.810,T:13616> : getvar tokenversion -s 6b803337d440
DEBUG <16:43:59.948,T:13616> : tokenversion: 6b80333
Finished. Total time: 0.001s
INFO <16:43:59.948,T:13616> : tokenversion: 6b80333
Finished. Total time: 0.001s
INFO <16:43:59.948,T:13616> : tokenversion=6
DEBUG <16:43:59.948,T:13616> : oem get_token -s 6b803337d440
DEBUG <16:44:00.058,T:13616> : FAILED (remote: 'unknown command')
fastboot: error: Command failed
INFO <16:44:00.058,T:13616> : FAILED (remote: 'unknown command')
fastboot: error: Command failed
WARNING<16:44:00.058,T:13616> : Cannot get token.
INFO <16:44:29.472,T:15240> : new app version:6.5.314.30 url:http://miuirom.xiaomi.com/rom/u1106245679/6.5.314.30/miflash_unlock-en-6.5.314.30.zip
DEBUG <16:46:19.529,T:14032> : auto refresh device list
DEBUG <16:46:19.537,T:14032> : remove usb\vid_18d1&pid_d00d\6b803337d440
INFO <16:46:19.537,T:14032> : fastboot devices
DEBUG <16:46:27.971,T:14344> : Close app after cef_close
DEBUG <16:46:27.990,T:14344> : miflash_unlock exit

From what I can make out from it, it seems to me that running the oem command get_token is the point of failure but unfortunately, I have no idea what that command does or is supposed to do. I have tried running the fastboot commands that the log indicated that the tool was running from a powershell/command prompt window and they give me the same results (one thing I did notice while trying out some commands was that running "fastboot getvar all" seemed to give me a set of variables, one of which was called "token", but I'm not sure if that's relevant here).

I'm not sure how to go ahead diagnosing from here as I couldn't find much information about the oem commands of Xiaomi devices. I'm not sure if there's some step I'm missing in the process or if the latest version of the tool has something different that just doesn't work with my device.

I would greatly appreciate any help on this, either with things to do that might fix the issue or even just references to pages that might clear things up regarding the error I'm getting. Please do let me know if there's any other information I have to provide.

Thank you!