francescotescari/XiaoMiToolV2

Xiaomi procedure failed: [getServiceToken] Missing serviceToken cookie

rodrgz opened this issue · 251 comments

I followed the instructions to unlock my Xiaomi phone, but I found this procedure error in the current linux version and in the Windows version.

Screenshot from 2021-07-13 09-35-19

did u find any solution for it so far?

did u find any solution for it so far?

No, do you reproduce this issue?

Yes I did dude. I am trying to solve my friends blocked bootloader in linux, but this doesnt seem to work sad. You got any other working way?

Yes I did dude. I am trying to solve my friends blocked bootloader in linux, but this doesnt seem to work sad. You got any other working way?

Unfortunately no, the closest I got was through Xiaomitoolv2. I tried with the official tool in Win10, but the line with the USB connection just blinked once and ejected the USB connection. I do not try yet to format the cell phone to an old android and then try again. But I think it's possible a server problem, I don't know, maybe I will wait sometime to try again.

Yes I did dude. I am trying to solve my friends blocked bootloader in linux, but this doesnt seem to work sad. You got any other working way?

Unfortunately no, the closest I got was through Xiaomitoolv2. I tried with the official tool in Win10, but the line with the USB connection just blinked once and ejected the USB connection. I do not try yet to format the cell phone to an old android and then try again. But I think it's possible a server problem, I don't know, maybe I will wait sometime to try again.

That's sad... I just made him unlock with official tool in windows. It worked it seems, nice

I got stuck at the same issue. I think Xiaomi has just made changes to their service and requiring a "serviceToken" for server authentication. I have just 1 more day left before I can unlock my phone. Sad. I don't have a Windows device so I cannot use the Xiaomi official tool. Planning to find an internet cafe with Windows PCs.

I got stuck at the same issue. I think Xiaomi has just made changes to their service and requiring a "serviceToken" for server authentication. I have just 1 more day left before I can unlock my phone. Sad. I don't have a Windows device so I cannot use the Xiaomi official tool. Planning to find an internet cafe with Windows PCs.

U use Linux? Maybe try using windows using kvm. Maybe that will work. Idk a shit about it tho haha. Hope u find someway. Do let me know what u do

I'm getting that too on a Mac

Same issue on Linux

No solution/workaround for it as of now... Sad. Maybe we should as for Linux tool in miui forum. They say people who need unlocked for Linux are very less

I got stuck at the same issue. I think Xiaomi has just made changes to their service and requiring a "serviceToken" for server authentication. I have just 1 more day left before I can unlock my phone. Sad. I don't have a Windows device so I cannot use the Xiaomi official tool. Planning to find an internet cafe with Windows PCs.

U use Linux? Maybe try using windows using kvm. Maybe that will work. Idk a shit about it tho haha. Hope u find someway. Do let me know what u do

I'm a Mac user. I have virtual machine options on Mac (eg. Parallel Desktop) too but I'm too lazy to download a Windows system image. I'm pretty sure most Xiaomi engineers also work on Macs. It's insane they only provide a Windows version of their tool.

I got stuck at the same issue. I think Xiaomi has just made changes to their service and requiring a "serviceToken" for server authentication. I have just 1 more day left before I can unlock my phone. Sad. I don't have a Windows device so I cannot use the Xiaomi official tool. Planning to find an internet cafe with Windows PCs.

U use Linux? Maybe try using windows using kvm. Maybe that will work. Idk a shit about it tho haha. Hope u find someway. Do let me know what u do

I'm a Mac user. I have virtual machine options on Mac (eg. Parallel Desktop) too but I'm too lazy to download a Windows system image. I'm pretty sure most Xiaomi engineers also work on Macs. It's insane they only provide a Windows version of their tool.

Yeah man sad. Why they wanna do all this, permission and all. just let fastboot oem unlock, unlock the bootloader, it'll be simple af and can run it anywhere. Even on phone using bugjaegar

I'm a Windows user, had the common issue of unrecognizable device in fastboot. Flashed a live boot Linux USB drive with Solus OS, got XiaoMiToolV2 working and all, did all the udev shenanigans to allow device access permissions, and got stuck on the same issue. Seeing as this is happening on all three platforms and that all reports of that are all within the last week, I'm highly suspecting of Xiaomi's services instability, really.

I don't know if you have had this other issue as well, but when trying to sync the account to allow for bootloader unlocking, it now fails basically all the time. I think I was lucky on Sunday and got a success response once but that was it; all other responses are something of the likes of "Couldn't execute sync procedure. Please try again".

This behavior makes me think the issues are somehow related. I'll keep you guys posted.

I have been trying to unlock my, now old, Redmi 6 for three days to install a custom rom ... but the error exposed by @erikrodrgz keeps happening to me.

What mistake is that anyway?

PS: I'm on Linux

I have been trying to unlock my, now old, Redmi 6 for three days to install a custom rom ... but the error exposed by @erikrodrgz keeps happening to me.

What mistake is that anyway?

PS: I'm on Linux

It's not your mistake, its xiaomi messed something up I think, right now best solution is somehow get windows and use the xiaomi's official unlocker...

I had the same problem in Linux. I finally did it in windows with the official app. But I needed to run bcdedit /set testsigning on as administrator and then run XiaomiToolv2 to install some needed drivers .

I have same problem. Probably the Xiaomi site changed something

Same with Linux and Windows (kvm + usb redirection)

@uAliFurkanY how did you set up the USB connection?

Using kvm I was unable to get xiaomi recognized not only by XMT2, but not even by MiPC suite... Windows recognizes it, bit Mi softs no...

@CavaleriOmar in qemu you can do this -usb -device usb-host,hostbus=NUM,hostport=NUM where you can find the numbers with lsusb. But it didn't work for me. I don't know if it is a problem with my laptop as also fastboot had problems. Only using a different laptop with windows 10 it worked.

@uAliFurkanY , same VM

Done.

Windows 10 under VM... MI PC suite did not recognize it simply because the Redmi 6 is out of support...

MI Flash Unlock found it right away (yesterday it didn't recognize it because I'm a jerk and I hadn't put it in fastboot).

I got same problem, too.
I had been used it to unlock/twrp/flash many Mi-devices, included Redmi Note5/Note7/Note8/K20/K30/K30s, on my mac (Mojave 10.14.6) without any issue, but recently when I tried to unlock my new Redmi 9T , I got same message and always failed. even I tried to check old success unlock/flash devices, I got same message, too.

I don't have any PC with win7/10, and I also don't use VM with win10.

did MIUI server change rules?

@pixrafal wow, world seems small huh? I'm facing same issue with Redmi 9T, fortunately I seem not alone. Keep monitor this issue guys.

I got same problem, too.
I had been used it to unlock/twrp/flash many Mi-devices, included Redmi Note5/Note7/Note8/K20/K30/K30s, on my mac (Mojave 10.14.6) without any issue, but recently when I tried to unlock my new Redmi 9T , I got same message and always failed. even I tried to check old success unlock/flash devices, I got same message, too.

I don't have any PC with win7/10, and I also don't use VM with win10.

did MIUI server change rules?

Yes seems like Miui server changed something. Sad... This is the worst thing about xiaomi

Having the same issue!. hopefully, this gets resolved soon.

Same issue probably xiaomi changes his APIs

is there any possibility for this to be fixed? I want to unlock the bootloader of my Mi 3c so I can install Ubuntu Touch but I don't want to wait for the official unlocker to be able to unlock the device

Even if this tool would work, you still have to wait because this unlock tool is using Xiaomis APIs.

Снимок экрана 2021-08-11 в 18 25 02

Error when I'm try to unlock locked bootloader on xiaomi redmi note 7 pro prime (after upgrading to miui 12.5 all google services not works and I need root for go back to miui 11..)

Even if this tool would work, you still have to wait because this unlock tool is using Xiaomis APIs.

Oh I thought it wouldnt because I found this on a video that says you dont need to wait and instantly unlock the bootloader of your device. Oh well, i just did a check and found out that my device had already unlocked bootloader so I will only use the program for flashing custom roms

Oh, pensavo che non lo sarebbe stato perché l'ho trovato su un video che dice che non è necessario attendere e sbloccare immediatamente il bootloader del dispositivo. Vabbè, ho appena fatto un controllo e ho scoperto che il mio dispositivo aveva già sbloccato il bootloader quindi userò il programma solo per flashare le custom rom

Dà problemi pure nel flashing, perché prima di flashare una custom rom devi flashare TWRP, e la funzione specifica dà sempre errore... e provare a flashare una custom rom DOPO aver flashato in autonomia TWRP... beh, dà sempre errore.

Praticamente ora è inutilizzabile come programma.

Same issue here.

Not sure if it's of any help, just to report that same issue happening here Linux + Redmi 5 Plus

I also have the exact same issue with my Xiaomi Redmi 9 (galahad)

Having the same issue with my Poco F3.

tomyo commented

Same issue on arch linux with redmi note 10 pro.

Same problem here, Redmi Note 5 with macOS Catalina

Have this problem too. Bug Sur + Mi 10

guys, has anyone been able to build the project from the linux branch and re-package it for the rest of us?
maybe it will work because it's 1 commit ahead of master........

d3417 commented

You need to change the Login URI to https://account.xiaomi.com/pass/serviceLogin?sid=unlockApi&json=false&passive=true&hidden=false&_snsDefault=facebook&_locale=en&checkSafePhone=true and make Phone SMS Verification, after you get the correct cookie for Unlock your devices.

\ò/

d3417 commented

git clone https://github.com/francescotescari/XiaoMiToolV2

src/main/java/com/xiaomitool/v2/gui/controller/LoginController.java Line 39:

Replace that line with:
private static final String LOGIN_URL = "https://account.xiaomi.com/pass/serviceLogin?sid=unlockApi&json=false&passive=true&hidden=false&_snsDefault=facebook&checkSafePhone=true&_locale=" + Locale.getDefault().getLanguage().toLowerCase();
After that do gradle build && gradle run , login with 2FA verification, try to unlock your bootloader!

I've not tried myself because i don't want to use another smartphone for 2FA Verification and to Lock & ReUnlock the Bootloader, but if works, please mention me in this thread and tell me if you're able to unlock bootloader and mod your Xiaomi Smartphone!

https://mega.nz/file/4UAjgKrC#Fk1V172GES7M4IUpg_pCfJkGVYXTBOSKxvIj93kuMeA

Just extract and bash run.sh

Happy modding!

The file you are trying to download is no longer available.
This link is unavailable as the user’s account has been closed for gross violation of MEGA’s Terms of Service.

:( can you upload somewhere else?

PS: I will open a PR for this

git clone https://github.com/francescotescari/XiaoMiToolV2

src/main/java/com/xiaomitool/v2/gui/controller/LoginController.java Line 39:

Replace that line with:
private static final String LOGIN_URL = "https://account.xiaomi.com/pass/serviceLogin?sid=unlockApi&json=false&passive=true&hidden=false&_snsDefault=facebook&checkSafePhone=true&_locale=" + Locale.getDefault().getLanguage().toLowerCase();
After that do gradle build && gradle run , login with 2FA verification, try to unlock your bootloader!

I've not tried myself because i don't want to use another smartphone for 2FA Verification and to Lock & ReUnlock the Bootloader, but if works, please mention me in this thread and tell me if you're able to unlock bootloader and mod your Xiaomi Smartphone!

I tried to do that:

$ git clone https://github.com/francescotescari/XiaoMiToolV2                                                               
Cloning into 'XiaoMiToolV2'...
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (2566/2566), done.
remote: Compressing objects: 100% (778/778), done.
Receiving objects: 100% (2569/2569), 67.78 MiB | 388.00 KiB/s, done.
remote: Total 2569 (delta 1593), reused 2566 (delta 1593), pack-reused 3
Resolving deltas: 100% (1593/1593), done.
Updating files: 100% (332/332), done.
                                                                                                                                     
╭─[morfik@morfikownia] - [/media/debuilder/git-xiaomimitoolv2] - [2021-08-23 23:16:37]
╰─[0] < > $  cd XiaoMiToolV2
                                                                                                                                     
╭─[morfik@morfikownia] - [/media/debuilder/git-xiaomimitoolv2/XiaoMiToolV2] - [2021-08-23 23:20:27]
╰─[0] < > $  geany src/main/java/com/xiaomitool/v2/gui/controller/LoginController.java 

╭─[morfik@morfikownia] - [/media/debuilder/git-xiaomimitoolv2/XiaoMiToolV2] - [2021-08-23 23:20:47]
╰─[0] < > $  gradle build && gradle run
Starting a Gradle Daemon (subsequent builds will be faster)

> Task :buildEnvironment

------------------------------------------------------------
Root project
------------------------------------------------------------

classpath
No dependencies


BUILD SUCCESSFUL in 12s
1 actionable task: 1 executed

FAILURE: Build failed with an exception.

* What went wrong:
Task 'run' not found in root project 'XiaoMiToolV2'.

* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s

Should I do something else to make it work?

d3417 commented

git clone https://github.com/francescotescari/XiaoMiToolV2
src/main/java/com/xiaomitool/v2/gui/controller/LoginController.java Line 39:
Replace that line with:
private static final String LOGIN_URL = "https://account.xiaomi.com/pass/serviceLogin?sid=unlockApi&json=false&passive=true&hidden=false&_snsDefault=facebook&checkSafePhone=true&_locale=" + Locale.getDefault().getLanguage().toLowerCase();
After that do gradle build && gradle run , login with 2FA verification, try to unlock your bootloader!
I've not tried myself because i don't want to use another smartphone for 2FA Verification and to Lock & ReUnlock the Bootloader, but if works, please mention me in this thread and tell me if you're able to unlock bootloader and mod your Xiaomi Smartphone!

I tried to do that:

$ git clone https://github.com/francescotescari/XiaoMiToolV2                                                               
Cloning into 'XiaoMiToolV2'...
remote: Enumerating objects: 2569, done.
remote: Counting objects: 100% (2566/2566), done.
remote: Compressing objects: 100% (778/778), done.
Receiving objects: 100% (2569/2569), 67.78 MiB | 388.00 KiB/s, done.
remote: Total 2569 (delta 1593), reused 2566 (delta 1593), pack-reused 3
Resolving deltas: 100% (1593/1593), done.
Updating files: 100% (332/332), done.
                                                                                                                                     
╭─[morfik@morfikownia] - [/media/debuilder/git-xiaomimitoolv2] - [2021-08-23 23:16:37]
╰─[0] < > $  cd XiaoMiToolV2
                                                                                                                                     
╭─[morfik@morfikownia] - [/media/debuilder/git-xiaomimitoolv2/XiaoMiToolV2] - [2021-08-23 23:20:27]
╰─[0] < > $  geany src/main/java/com/xiaomitool/v2/gui/controller/LoginController.java 

╭─[morfik@morfikownia] - [/media/debuilder/git-xiaomimitoolv2/XiaoMiToolV2] - [2021-08-23 23:20:47]
╰─[0] < > $  gradle build && gradle run
Starting a Gradle Daemon (subsequent builds will be faster)

> Task :buildEnvironment

------------------------------------------------------------
Root project
------------------------------------------------------------

classpath
No dependencies


BUILD SUCCESSFUL in 12s
1 actionable task: 1 executed

FAILURE: Build failed with an exception.

* What went wrong:
Task 'run' not found in root project 'XiaoMiToolV2'.

* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s

Should I do something else to make it work?

Wait few seconds, i'm reuploading it on DropBox.com!

Ok.

d3417 commented

Ok.

https://dubox.com/s/1RLWtwwYzoz6W3R4INjyKbw
Password: nvrs

unzip XiaoMiToolV2(Alpha Version by Denis Sossich).zip

cd "XiaoMiToolV2(Alpha Version by Denis Sossich)"

bash run.sh

d3417 commented

https://mega.nz/file/4UAjgKrC#Fk1V172GES7M4IUpg_pCfJkGVYXTBOSKxvIj93kuMeA
Just extract and bash run.sh
Happy modding!

The file you are trying to download is no longer available.
This link is unavailable as the user’s account has been closed for gross violation of MEGA’s Terms of Service.

:( can you upload somewhere else?

PS: I will open a PR for this

https://dubox.com/s/1RLWtwwYzoz6W3R4INjyKbw
Password: nvrs

unzip XiaoMiToolV2(Alpha Version by Denis Sossich).zip

cd "XiaoMiToolV2(Alpha Version by Denis Sossich)"

bash run.sh

d3417 commented

https://mega.nz/file/4UAjgKrC#Fk1V172GES7M4IUpg_pCfJkGVYXTBOSKxvIj93kuMeA
Just extract and bash run.sh
Happy modding!

The file you are trying to download is no longer available.
This link is unavailable as the user’s account has been closed for gross violation of MEGA’s Terms of Service.

:( can you upload somewhere else?

PS: I will open a PR for this

Thank you very much for correcting the obsolete code by integrating my URI of Xiaomi with the Login 2FA, now all that remains is to try a BootLoader Unlock and see if it works as I predicted, I based on MiUnlockTool that has in a folder a file called app-config, in this file there is the Login URI that integrates the 2FA, just entered the Code via SMS in the Login Box, the App MiUnlockTool registers the user and allows the bootloader unlock.

If I've solved the problem, which is at the root of the software's operation (If it doesn't unlock the Bootloader it can't perform other actions), I'd be pleased to appear in the Credits of Contributing Developers with the name "Denis Sossich".

Ok, I've managed to figure out what was wrong with my setup. Gradle version (4.4.1) was to old for the java version (11.0.12) that my system was using. I had to update gradle to 7.2. Also gradle wrapper needed to be updated, but it updated automatically. Then it worked, but the linux adb/fastboot tools were missing (only exe were in the github dir). I copied the whole res/ dir from XMT2_Linux_20.7.28.run to the github source. Then after running gradlew run the GUI showed and recognized my phone. I selected the unlock the bootloader option, and it looks it works:

https://i.imgur.com/TpJs8UU.png

I still have to wait 3 days, but I think it will work just fine now. :]

d3417 commented

Ok, I've managed to figure out what was wrong with my setup. Gradle version (4.4.1) was to old for the java version (11.0.12) that my system was using. I had to update gradle to 7.2. Also gradle wrapper needed to be updated, but it updated automatically. Then it worked, but the linux adb/fastboot tools were missing (only exe were in the github dir). I copied the whole res/ dir from XMT2_Linux_20.7.28.run to the github source. Then after running gradlew run the GUI showed and recognized my phone. I selected the unlock the bootloader option, and it looks it works:

https://i.imgur.com/TpJs8UU.png

I still have to wait 3 days, but I think it will work just fine now. :]

Perfect, my piece of code it's a fix! I'm happy for this ^_^

@d3417 Congrats on the accomplishment... I'm still considering whether to get another XIaomi to replace my Redmi 6 that's ready to abandon me... this may weigh on my choice

@d3417 thanks a lot, I tested it and looks like it pass 2FA verification, but I got failed message on terminal :

[15:22:40][PSTA ][-------] Start process (826): "./res/tools/fastboot" "-s" "xxxxxxxx: uid or device id" "oem" "unlock" "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.....: huge numbers, maybe it's token or private key?"
[15:08:14][PROC ][][-------]] Process (826) output: FAILED (Command length to RawCommand() is too long)
[15:22:40][PROC ][-------] Process (826) output: fastboot: error: Command failed
[15:22:40][INFO ][-------] Process (826) ended with exit code: 1, output len: 134
[15:22:40][WARN ][-------] InstallException created: unlock_error - Failed to unlock the device, fastboot exit with status non zero or internal error

here is error message from app
螢幕快照 2021-08-25 15 22 58

I did try a lot and get same result, and run-out quota of receiving 2FA code today.

git clone https://github.com/francescotescari/XiaoMiToolV2

src/main/java/com/xiaomitool/v2/gui/controller/LoginController.java Line 39:

Replace that line with:
private static final String LOGIN_URL = "https://account.xiaomi.com/pass/serviceLogin?sid=unlockApi&json=false&passive=true&hidden=false&_snsDefault=facebook&checkSafePhone=true&_locale=" + Locale.getDefault().getLanguage().toLowerCase();
After that do gradle build && gradle run , login with 2FA verification, try to unlock your bootloader!

I've not tried myself because i don't want to use another smartphone for 2FA Verification and to Lock & ReUnlock the Bootloader, but if works, please mention me in this thread and tell me if you're able to unlock bootloader and mod your Xiaomi Smartphone!

I'm trying to follow @d3417's steps and I'm able to start up the program but after selecting the region the window gets stuck in a "loading" loop. The console reports a warning with "miui.com is not reachable but it is reachable on port 80", not sure if it has anything to do with it, though.

A recap of the steps I took (slightly different from above since I had to use gradle wrapper:

  1. Downloaded the ZIP of the linux branch of the project so as to make sure I had all the proper tools (adb and fastboot) to run
    on linux from https://github.com/francescotescari/XiaoMiToolV2/tree/linux
  2. Replaced line 39 with the above suggested code in src/main/java/com/xiaomitool/v2/gui/controller/LoginController.java
  3. I had the same problem as @morfikov but I solved it by changing the suggested commands to use gradle wrapper instead:
./gradlew build && ./gradlew run

I must be doing something wrong but I can't figure out what exactly. I'll keep trying and report back if I find anything else.

I have a Poco F1 and I'm stuck at the same problem.

Any help would be much appreciated. Thank you so much. I'm on Kubuntu 20.04 LTS, and I have ADB and Fastboot installed. I tried with versions 20.7.28 and 9.11.10. Still the same error.

@andresangelini, I see the same messages in the log, but the GUI works without a problem.

Basically, I wasn't aware of the linux branch. You can simply:

$ git clone https://github.com/francescotescari/XiaoMiToolV2
$ git checkout linux

And edit the affected file. In this way, you don't have to do anything else to the source.

Also gradlew (gradle wrapper) is needed instead of just gradle, because the project use the gradle wrapper. I just had to update the gradle/gradle wrapper for java 11+ which is default in my linux.

Ok guys, I've managed to unlock my phone:

Screenshot from 2021-08-27 13-31-25
Screenshot from 2021-08-27 13-31-31
Screenshot_2021-08-27-15-58-07-496_com android settings

Ok guys, I've managed to unlock my phone:

Screenshot from 2021-08-27 13-31-25
Screenshot from 2021-08-27 13-31-31
Screenshot_2021-08-27-15-58-07-496_com android settings

Congrats, man! well done!
Would you please share the binary with us? it'd be really very much appreciated.

i just did it via:

gradlew build && gradlew run

So I don't have any binary, I don't know how to make the .run file.

Most importantly, where is @francescotescari ? This change should be merged and a new release made, because all verify's are going to have this issue until this fix is merged.

okay, so thanks to @morfikov i got the tool to compile and start. But now the tool does not detect my phone. It returns this error:
19:01:42][INFO ][3baf8fb6] Total connected device found: 0 [19:01:42][INFO ][3baf8fb6] Showing no devices visual [19:01:44][PSTA ][2527d55d] Start process (8): "./res/tools/adb" "devices" [19:01:44][PSTA ][2527d55d] Start process (9): "./res/tools/fastboot" "devices" [19:01:44][ERROR ][2527d55d] Cannot execute fastboot command "fastboot devices", reason: Cannot run program "./res/tools/fastboot": error=2, No such file or directory [19:01:46][PSTA ][2527d55d] Start process (10): "./res/tools/adb" "devices" [19:01:46][PSTA ][2527d55d] Start process (11): "./res/tools/fastboot" "devices" [19:01:46][ERROR ][2527d55d] Cannot execute fastboot command "fastboot devices", reason: Cannot run program "./res/tools/fastboot": error=2, No such file or directory [19:01:49][PSTA ][2527d55d] Start process (12): "./res/tools/adb" "devices" [19:01:49][PSTA ][2527d55d] Start process (13): "./res/tools/fastboot" "devices" [19:01:49][ERROR ][2527d55d] Cannot execute fastboot command "fastboot devices", reason: Cannot run program "./res/tools/fastboot": error=2, No such file or directory [19:01:51][PSTA ][2527d55d] Start process (14): "./res/tools/adb" "devices" [19:01:51][PSTA ][2527d55d] Start process (15): "./res/tools/fastboot" "devices" [19:01:51][ERROR ][2527d55d] Cannot execute fastboot command "fastboot devices", reason: Cannot run program "./res/tools/fastboot": error=2, No such file or directory

Obviously it's stuck in a loop.

On the other hand ADB can detect my phone normally.

Any idea what should I do?

Switch to the linux branch:

$ git checkout linux

IT FINALLY WORKED! EUREKA! Thank you everyone! And special thanks to @morfikov!

Congratulations @morfikov! I've been reading a lot of negative experiences regarding how much time people have to wait to get their xiaomi accounts authorized. I'm glad that was not your case.

Unfortunately, I'm still struggling with XiaoMiToolV2 getting out from the "loading" screen. I removed the project folder completely, cloned the project, then switched to the linux branch and finally edited the file as you suggested but still no luck.

As I understand it, the project uses gradle wrapper and so there should be no need to install it on my system. But, would that be my mistake and the reason it is not working?

Most importantly, where is @francescotescari ? This change should be merged and a new release made, because all verify's are going to have this issue until this fix is merged.

I agree completely with you, but unfortunately, @francescotescari has already stated in the project's readme file that this project is semi-abandoned due to lack of time and suggested not too invest too much time on it, so there doesn't see to be much reason for hope. Unless , that is, that somebody else decides to fork it or something.

@andresangelini I've written an article on how I've managed to unlock my phone. Take a look at it. It's in Polish, but all the necessary commands are included for ctrl+c and ctrl+v. :)

Perfect, morfikov! I'll take a look right now.

Good news! Thanks to @morfikov's post I figured out that perhaps I should try installing the Java Development Kit:

sudo apt install default-jdk

Alas, after firing XiaoMiToolV2 again:

./gradlew run

Now I could finally advance to the next stage (choosing whether your phone is working normally or it's bricked).

I'll report back again soon.

Ok. I just bumped with a new problem (possible two but I think they are related).
Since this the device that I'm using for 2FA, I try to log in into my Xiaomi account through XiaoMiToolV2 first, before doing anything to it. However, when I enter my 2FA code sent via SMS, it doesn't recognized it as valid. I eventually was able to bypass this by momentarily disabling 2FA through the Xiaomi website but then, when trying to ask for the authorization token, XiaoMiToolV2 says that Xiaomi servers returned a 20031 error: "This device is not linked to an account" (even though it has been linked since I bought it years ago).

Any ideas? Thanks once again.

When you log into your account on the website (https://account.xiaomi.com/), do you see your phone listed there?

When you log into your account on the website (https://account.xiaomi.com/), do you see your phone listed there?

Yes, I do see it there. Actually, I don't recall having this issue with the XMT2_Linux_20.7.28.run file, so perhaps the key lays on the link we replaced in 39 of src/main/java/com/xiaomitool/v2/gui/controller/LoginController.java. I'll try to look a little bit more into it tomorrow since I almost ran out of 2FA trials for today.

It may take some time until @francescotescari checks out and accept the @vmavromatis' pull request but I'm hoping to fix the problem I'm having anyways just in case anyone is going through the same and doesn't want to wait until a patched version come out.

I've written an article on how I've managed to unlock my phone. Take a look at it. It's in Polish, but all the necessary commands are included for ctrl+c and ctrl+v. :)

Thanks! Following these instructions helped me unlock by bootloader. I couldn't unlock it using the official https://en.miui.com/unlock/download_en.html program (I got a "Your account is not authorized for this operation" error and didn't know what to do), but applying the patch the switching to the "linux" branch did it for me :)

Hello everybody!
I proceed all instructions(clone git repo, switch branch, change string) and now have error:

...
[10:39:51][INFO  ][4d725031] Starting unlock procedure
#
# A fatal error has been detected by the Java Runtime Environment:
#

#  SIGSEGV (0xb) at pc=0x00007f37070b3306, pid=29590, tid=29616
#
# JRE version: OpenJDK Runtime Environment (11.0.12+7) (build 11.0.12+7-post-Debian-2)
# Java VM: OpenJDK 64-Bit Server VM (11.0.12+7-post-Debian-2, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x8d5306]
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /mnt/data/android/XiaoMiToolV2/hs_err_pid29590.log
#
# If you would like to submit a bug report, please visit:
#   https://bugs.debian.org/openjdk-11
#

> Task :run FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':run'.
> Process 'command '/usr/lib/jvm/java-11-openjdk-amd64/bin/java'' finished with non-zero exit value 134

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4m 29s
4 actionable tasks: 2 executed, 2 up-to-date

What i missed or did wrong?
Debian 11, Openjdk 11.0.12.

First and foremost, thank you all for this workaround.

This is what I did to unlock Poco F1 using Fedora 34 workstation.

  1. As at 2021-08-29, there is no more waiting period or manual form to request for unlock approval from Xiaomi. Instead follow every step described in this video https://youtu.be/pByHHTvms4k

  2. Clone and check out linux branch

    git clone https://github.com/francescotescari/XiaoMiToolV2.git && cd XiaoMiToolV2 && git checkout linux
    
  3. Edit one Java source file exactly as described #23 (comment)

  4. Install openjdk-11, sudo dnf install java-11-openjdk

  5. Install gradle by following just Step 2, https://docs.gradle.org/current/userguide/installation.html#step_2_unpack_the_distribution. I didn't bother to set up PATH, etc. described further on the page.

  6. Set up Gradle wrapper. This step will inevitably overwrite a few Gradle-related files in the repo, i.e. gradlew, etc.

    # Step above got me gradle-7.2. Adjust this if you've got a newer release.
    /opt/gradle/gradle-7.2/bin/gradle wrapper
    
  7. Build using the wrapper, ./gradlew build. If this fails, you have probably messed up the Java source code edit.

  8. Run application, sudo ./gradlew run

  9. After clicking on the "unlock bootloader" button in the app, please be patient. My phone showed a static "MIUI" for over 3 minutes which kinda frightened me. But it eventually booted normally into a fresh install (like factory reset) and showed the "unlocked" status under Developer Options.

Thank you all for the guides. I am reaaaaaaally close to making it following @cynici 's guide, however I get exact same issue as @andresangelini :

[15:17:50][INFO  ][34b14602] Unlock request (/api/v3/ahaUnlock) response: {"code":20031,"description":"请在MIUI上绑定账号后解锁:开发者模式下打开设置,搜索设备解锁状态,然后进行绑定","descCN":"请在MIUI上绑定账号后解锁:开发者模式下打开设置,搜索设备解锁状态,然后进行绑定","descEN":"Please add your account in MIUI's Settings > Developer options > Mi Unlock status.","uid":"6492342286"}
[15:17:50][INFO  ][34b14602] Unlock request response: {"code":20031,"description":"请在MIUI上绑定账号后解锁:开发者模式下打开设置,搜索设备解锁状态,然后进行绑定","descCN":"请在MIUI上绑定账号后解锁:开发者模式下打开设置,搜索设备解锁状态,然后进行绑定","descEN":"Please add your account in MIUI's Settings > Developer options > Mi Unlock status.","uid":"6492342286"}

I returns error 20031 says the device is not bound to my account (it is). I am logged in with same account both in phone and tool ..... So I don't know what's going on..... anyway I am happy for almost making it but sad for the error.
If anyone has any ideas, pls share.

Thank you all for the guides. I am reaaaaaaally close to making it following @cynici 's guide, however I get exact same issue as @andresangelini :

[15:17:50][INFO  ][34b14602] Unlock request (/api/v3/ahaUnlock) response: {"code":20031,"description":"请在MIUI上绑定账号后解锁:开发者模式下打开设置,搜索设备解锁状态,然后进行绑定","descCN":"请在MIUI上绑定账号后解锁:开发者模式下打开设置,搜索设备解锁状态,然后进行绑定","descEN":"Please add your account in MIUI's Settings > Developer options > Mi Unlock status.","uid":"6492342286"}
[15:17:50][INFO  ][34b14602] Unlock request response: {"code":20031,"description":"请在MIUI上绑定账号后解锁:开发者模式下打开设置,搜索设备解锁状态,然后进行绑定","descCN":"请在MIUI上绑定账号后解锁:开发者模式下打开设置,搜索设备解锁状态,然后进行绑定","descEN":"Please add your account in MIUI's Settings > Developer options > Mi Unlock status.","uid":"6492342286"}

I returns error 20031 says the device is not bound to my account (it is). I am logged in with same account both in phone and tool ..... So I don't know what's going on..... anyway I am happy for almost making it but sad for the error.
If anyone has any ideas, pls share.

Hi @vmavromatis

Sounds to me you have missed one step before using the XiaomiToolV2. I will edit my comment to fix that.
Watch this video https://youtu.be/pByHHTvms4k?t=106. Pay attention to the step right after enabling USB debugging.

Hello everybody!
I proceed all instructions(clone git repo, switch branch, change string) and now have error:

...
[10:39:51][INFO  ][4d725031] Starting unlock procedure
#
# A fatal error has been detected by the Java Runtime Environment:
#

#  SIGSEGV (0xb) at pc=0x00007f37070b3306, pid=29590, tid=29616
#
# JRE version: OpenJDK Runtime Environment (11.0.12+7) (build 11.0.12+7-post-Debian-2)
# Java VM: OpenJDK 64-Bit Server VM (11.0.12+7-post-Debian-2, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x8d5306]
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /mnt/data/android/XiaoMiToolV2/hs_err_pid29590.log
#
# If you would like to submit a bug report, please visit:
#   https://bugs.debian.org/openjdk-11
#

> Task :run FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':run'.
> Process 'command '/usr/lib/jvm/java-11-openjdk-amd64/bin/java'' finished with non-zero exit value 134

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4m 29s
4 actionable tasks: 2 executed, 2 up-to-date

What i missed or did wrong?
Debian 11, Openjdk 11.0.12.

I had the same with my current Debian installation (sid/unstable). I don't know why it happens and how to fix it. You can download the latest ubuntu lts, and boot the live system and after you do all the steps again, it should work well.

Hello everybody!
I proceed all instructions(clone git repo, switch branch, change string) and now have error:

...
[10:39:51][INFO  ][4d725031] Starting unlock procedure
#
# A fatal error has been detected by the Java Runtime Environment:
#

#  SIGSEGV (0xb) at pc=0x00007f37070b3306, pid=29590, tid=29616
#
# JRE version: OpenJDK Runtime Environment (11.0.12+7) (build 11.0.12+7-post-Debian-2)
# Java VM: OpenJDK 64-Bit Server VM (11.0.12+7-post-Debian-2, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x8d5306]
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /mnt/data/android/XiaoMiToolV2/hs_err_pid29590.log
#
# If you would like to submit a bug report, please visit:
#   https://bugs.debian.org/openjdk-11
#

> Task :run FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':run'.
> Process 'command '/usr/lib/jvm/java-11-openjdk-amd64/bin/java'' finished with non-zero exit value 134

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4m 29s
4 actionable tasks: 2 executed, 2 up-to-date

What i missed or did wrong?
Debian 11, Openjdk 11.0.12.

I had the same with my current Debian installation (sid/unstable). I don't know why it happens and how to fix it. You can download the latest ubuntu lts, and boot the live system and after you do all the steps again, it should work well.

I test it on other pc(debian too), and have error 10000. Find many answers with possible solutions(log out, wait, log in). Wait now...

d3417 commented

Sorry for the late reply, i can't help peoples with Debian because i've ArchLinux, my JDK Version is java-12-j9 (default) and it works without any problem, about the problem of @pixrafal i think that is a problem of getting the Unlock Key for fastboot, i suggest to switch to Java 12 and retry, thanks @CavaleriOmar , you're welcome :-)

d3417 commented

In any case try to run the Tool with sudo or root user, if there are still any problem please reply with the full output and a screenshot of the error and i try to find a solution, my system is:

OS: Archman 2021-05 Mardin
Kernel: x86_64 Linux 5.13.5-arch1-1
RAM: 18377MiB / 23913MiB

I run the tool with sudo ./gradlew run

Hello.
I did something else:
Logout in browser.(i think it helped) Logout in phone, log in phone. Run gradlew run, and now it looks ok - "...wait 7 days...":)
Thank you!

Hi,
I have another issue, it complies, but when getting to login page, the app crashes with exception.
Anyone encountered this error?
I am using linux mint which is based on ubuntu.

Could you post a screenshot?

Could you post a screenshot?

Hi,
I upgraded java version to 16 and it was fixed!
Thanks.

First and foremost, thank you all for this workaround.

This is what I did to unlock Poco F1 using Fedora 34 workstation.

1. As at 2021-08-29, there is no more waiting period or manual form to request for unlock approval from Xiaomi. Instead follow every step described in this video https://youtu.be/pByHHTvms4k

2. Clone and check out linux branch
   ```
   git clone https://github.com/francescotescari/XiaoMiToolV2.git && cd XiaoMiToolV2 && git checkout linux
   ```

3. Edit one Java source file exactly as described [Xiaomi procedure failed: [getServiceToken] Missing serviceToken cookie #23 (comment)](https://github.com/francescotescari/XiaoMiToolV2/issues/23#issuecomment-904082515)

4. Install openjdk-11, `sudo dnf install java-11-openjdk`

5. Install gradle by following just Step 2, https://docs.gradle.org/current/userguide/installation.html#step_2_unpack_the_distribution. I didn't bother to set up PATH, etc. described further on the page.

6. Set up Gradle wrapper. This step will inevitably overwrite a few Gradle-related files in the repo, i.e. gradlew, etc.
   ```
   # Step above got me gradle-7.2. Adjust this if you've got a newer release.
   /opt/gradle/gradle-7.2/bin/gradle wrapper
   ```

7. Build using the wrapper, `./gradlew build`. If this fails, you have probably messed up the Java source code edit.

8. Run application, `sudo ./gradlew run`

9. After clicking on the "unlock bootloader" button in the app, please be patient. My phone showed a static "MIUI" for over 3 minutes which kinda frightened me. But it eventually booted normally into a fresh install (like factory reset) and showed the "unlocked" status under Developer Options.

That works flawless...
Thank you.

hope dev merge the changes...

Hi everyone! I'm happy to report that I've finally been able to unlock my Xiaomi device successfully! In my case, as it is with so many people such as @vmavromatis , I think, is that the instructions found in Youtube tutorials and internet posts are somehow confusing and very often skip important steps, leading us to believe the problem lays in XiaoMIToolV2 when instead all that was needed was to make sure to link your phone to your Xiaomi account (or if it is not working even then, re-link it, which was what I actually had to do).

So, to sum up, these are the step I took to unlock my device from Ubuntu 20.04.3 LTS:

  1. Make sure you have created a Xiaomi account. You can do this by going to their site OR even better yet, from signing in directly from Settings > Mi account in your phone.
  2. In your phone, go to Settings > About phone and tap 7 times on "Mi version" to enter in "developer" mode, which enables "Developer options" in "Additional settings".
  3. Go the to Additional setting > Developer options and turn on "OEM unlock" as well as "USB debugging".
  4. Now, a very important step which many tutorials fail to even mention: go to "Mi Unlock status". It should say "Device is locked" and "Phone is safe" if you have never done this before. Tap "Add account and device" and follow the instructions (it will tell you to turn off your wifi connection and turn on your mobile data connection). But here is the catch, even if you have created an account with this phone years ago, it may give you an error (don't remember exactly what it was). This is what I believe caused the 20031 error, @vmavromatis , because it is exactly what I was experiencing until I found somewhere in the Xiaomi forums that you only need to log out from your phone and log in back again. The problem was that by doing that you are basically creating a new account and I was afraid that could make you wait a long time to get the account authorized. Fortunately I tried it and didn't have to wait at all. And that was all the prerequisites.
  5. Before downloading the XiaoMiToolV2 github project, we need to make sure to install one of its key dependencies; the Java Development Kit (JDK), otherwise the app may open but get stuck in a loading loop screen, which is what happened to me:
sudo apt install default-jdk

5a. (?) You may also need to install adb and fastboot on your system but I'm not sure about this since the project already has them bundled with it. I already had them installed. Does anybody know? Thanks.

sudo apt install adb fastboot
  1. Now clone the github project:
git clone https://github.com/francescotescari/XiaoMiToolV2.git
  1. Change to the just downloaded project directory:
cd XiaoMiToolV2/
  1. Switch to the linux branch:
git checkout linux
  1. Build the project and run it with gradle wrapper. Gradle is an automation tool for developers and gradle wrapper is one of its functions which lets them attach a particular version of it to the project so that all the people working in the project can use the exact same version without having to install it on their system. You shouldn't worry too much about it. All that you need to know is that you shouldn't need to update it unless your JDK is too new for the gradle version that comes with the project, in which case you do need to install gradle so that you can then point gradle wrapper to it, as @cynici explained in Step 4 of his guide.
./gradlew build && ./gradle run

And luckily that should be it for you too. I had no need to wait for the authorization by the way, but I don't know if that was just because I bought this phone years ago or they eliminated the waiting period.

Anyway, the key point to take away of all this mess is that before even trying to use XiaoMiToolV2 to get our Xiaomi account authorized and unlock our phone, we first need to link the phone to our account and turn on OEM unlock as well as USB unlock, for which we first have to enable the Developer mode. And if you get an error trying to link the phone to the account, just sign in and sign out of the Mi account from your phone.

If you don't takes those prerequisite steps you will never be able to unlock the phone and waste days thinking that there is something wrong with XiaoMiToolV2. Seriously, I can't stress this enough.

Thanks to everyone for their invaluable input! I think @cynici's guide above is going in the right direction.

Other issues:

Issue 1: In Step 9, when you try to run:

./gradlew build && ./gradle run

You get the following error (reported by @Clobbe):

> Task :compileJava FAILED
Caching disabled for task ':compileJava' because:
  Build cache is disabled

Task ':compileJava' is not up-to-date because:
  Input property 'classpath' file /root/.gradle/caches/modules-2/files-2.1/org.openjfx/javafx-fxml/11.0.2/1b8a331d5f393b48de0aef59b3c967a312967290/javafx-fxml-11.0.2-linux.jar has been removed.
  Input property 'classpath' file /root/.gradle/caches/modules-2/files-2.1/org.openjfx/javafx-web/11.0.2/49ca03e2fd58cbb0ad94f6a6bd11e0c043e541a7/javafx-web-11.0.2-linux.jar has been removed.
  Input property 'classpath' file /root/.gradle/caches/modules-2/files-2.1/org.openjfx/javafx-controls/11.0.2/5f6929050a744aab39ebfc1e8e5dd03bcd2ad47b/javafx-controls-11.0.2-linux.jar has been removed.
Full recompilation is required because unable to get source-classes mapping relationship from last compilation. Analysis took 0.0 secs.
:compileJava (Thread[Execution worker for ':',5,main]) completed. Took 0.139 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.

Fix: Remove openjfx from Ubuntu 20.04, as @paolodepa suggested (thanks Paolo!).

about the problem of @pixrafal i think that is a problem of getting the Unlock Key for fastboot, i suggest to switch to Java 12 and retry, thanks @CavaleriOmar , you're welcome :-)

@d3417 thanks, now i am using BellSoft Liberica JDK 11.0.12+7 without any issue for any java project, and OK, I will try to upgrade to latest jdk16 then try again.

thank you so much for the support @andresangelini however even though I have tried everything that you mentioned (and more) I am still stuck with this problem https://xiaomi.eu/community/threads/mi-unlock-status-unlocked-but-actually-locked.43787/..... To make things worse Mi Flash tool wont let me do anything because it says that the bootloader is locked.... My only guess is that at some point years ago I unlocked it with another Mi Account and now it got confused because I use another one for both the phone and the tool. Anyway, I will not derail the threaad any more, seems like the culprit of the main issue is found, I am just stuck in xiaomi hell right now.

@vmavromatis, have you ever unlocked this device before and locked it back for some reason? As far as I know, you can lock a Xiaomi phone back provided you have installed the original MIUI OS it came with. Otherwise your phone should already be unlocked and there should be no reason to use XiaoMiToolV2 to begin with.

If the bootloader is locked, but you can't get your account authorized, how about you log out from your phone, make sure it's not linked to any account at all by logging in through the website, and then create a new account from your phone?

There has to be a solution, nobody deserves to be stuck in Xiaomi hell. :(

@andresangelini - thanks for summarizing well above 👍

I tried all of the steps but am getting stuck on step 9. When I run:
./gradlew build && ./gradle run

Should add that I'm too on Ubuntu 20.04 LTS.

Everything seems to go well during the build phase. However when ./gradle run is executed I get the following error msg:

> Task :compileJava FAILED
Caching disabled for task ':compileJava' because:
  Build cache is disabled

Task ':compileJava' is not up-to-date because:
  Input property 'classpath' file /root/.gradle/caches/modules-2/files-2.1/org.openjfx/javafx-fxml/11.0.2/1b8a331d5f393b48de0aef59b3c967a312967290/javafx-fxml-11.0.2-linux.jar has been removed.
  Input property 'classpath' file /root/.gradle/caches/modules-2/files-2.1/org.openjfx/javafx-web/11.0.2/49ca03e2fd58cbb0ad94f6a6bd11e0c043e541a7/javafx-web-11.0.2-linux.jar has been removed.
  Input property 'classpath' file /root/.gradle/caches/modules-2/files-2.1/org.openjfx/javafx-controls/11.0.2/5f6929050a744aab39ebfc1e8e5dd03bcd2ad47b/javafx-controls-11.0.2-linux.jar has been removed.
Full recompilation is required because unable to get source-classes mapping relationship from last compilation. Analysis took 0.0 secs.
:compileJava (Thread[Execution worker for ':',5,main]) completed. Took 0.139 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.

I get that it seems to be some files missing, but since I'm no Java-expert I can't really figure out how to fix this...

Got any input/feedback on what's going wrong here? Thank you for any help!
Like many others of you, I'm tired of being stuck behind the Xiaomi-walls =)

Consider also removing openjfx packages if installed: gradle downloads and runs its own version and finding different libraries on the system can create confusion...

Consider also removing openjfx packages if installed: gradle downloads and runs its own version and finding different libraries on the system can create confusion...

Thanks @paolodepa that seems to work. Now the app is starting properly and I was able to successfully unlock the bootloader. Cheers!

ZlllC commented

Any way out for MacOS users there? it seems the workaround to bypass 2FA only works on Linux? Any help would be much appreciated.

@Clobbe, sorry for the late replay, and @paolodepa, thanks a lot forma solving his problem. I have updated the guide above with a new "Other issues" section with the issue @Clobbe was having and its fix. The idea is to add there new issues and their fixes as they appear.

@ZlllC, have you tried to follow the suggestions people have given in this issue but using the Mac branch of the project? I don't use a Mac so I'm not sure what are the commands you need to use, let alone what come installed in MacOS, but maybe we can help you somehow.

@Clobbe try sudo ./gradlew build && sudo ./gradlew run

I did all from above steps but now I'm getting this
Screenshot_20210905_124333
Screenshot_20210905_131214

adb and fastboot are working.
arch linux and pocophone f1 global (miui 12.0.3)

Thank you all for the guides. I am reaaaaaaally close to making it following @cynici 's guide, however I get exact same issue as @andresangelini :

[15:17:50][INFO  ][34b14602] Unlock request (/api/v3/ahaUnlock) response: {"code":20031,"description":"请在MIUI上绑定账号后解锁:开发者模式下打开设置,搜索设备解锁状态,然后进行绑定","descCN":"请在MIUI上绑定账号后解锁:开发者模式下打开设置,搜索设备解锁状态,然后进行绑定","descEN":"Please add your account in MIUI's Settings > Developer options > Mi Unlock status.","uid":"6492342286"}
[15:17:50][INFO  ][34b14602] Unlock request response: {"code":20031,"description":"请在MIUI上绑定账号后解锁:开发者模式下打开设置,搜索设备解锁状态,然后进行绑定","descCN":"请在MIUI上绑定账号后解锁:开发者模式下打开设置,搜索设备解锁状态,然后进行绑定","descEN":"Please add your account in MIUI's Settings > Developer options > Mi Unlock status.","uid":"6492342286"}

I returns error 20031 says the device is not bound to my account (it is). I am logged in with same account both in phone and tool ..... So I don't know what's going on..... anyway I am happy for almost making it but sad for the error.
If anyone has any ideas, pls share.

On your phone:

  1. Go to Developer Options > Mi Unlock Status
  2. Add your account. If it fails to add, sign out in Accounts and sign in again, then repeat this step
  3. Try running XiaoMiTool v2 again.

Thanks a lot guys, I was able to get this working. Now I just need to wait the canonical 168 hours and I'll be finally able to unlock my phone!

I did all from above steps but now I'm getting this
Screenshot_20210905_124333
Screenshot_20210905_131214

adb and fastboot are working.
arch linux and pocophone f1 global (miui 12.0.3)

I'm reproducing it