[TOOL][WIN/LIN/MAC] MiUnlockTool - Unlock bootloader of xiaomi devices on mac & linux

Search This thread

mssadewa

Member
Oct 28, 2018
21
7
Jakarta
thank you for this great tool!
...but unfortunately i got an unknown error :(

[14:29:23][INFO ] Querying unlock server for unlock key
[14:29:27][ERROR ] Unlock request replied with error code 20041
[14:29:27][ERROR ] Error meaning: Unknown error: %d

does anybody know this error?

regards
tilbud

did you have create unlock request xiaomi?
make sure you have enable oem unlock and usb debugger in developer options..
 

Candymannetje

New member
Nov 5, 2018
1
0
Hi

Solved: problem seem to be with my computer usb controller half dying.

I am trying to unlock a Poco F1 using this tool on linux and I am stuck at "Obtaining device info...". I have let it run at that stage for up to 20 minutes. I have tried through the GUI and console modes, same result.

I am using Ubuntu 16.04 and I have installed Java using this instructions. Using the open java implementation with openjfx packet did still produce an error when trying to run the GUI.

This is what I have done:

  1. Update the phone
  2. Enable developer mode and check USB debug and OEM unlock
  3. In the phone, sign in to my Mi account (which is a few years old), I have not verified my phone number if that matters
  4. Start your program, input Mi account login and password, and wait for it to ask me for fastboot mode phone
  5. Put Poco F1 in fastboot mode and connect it to computer

Your program recognizes the device and goes to "Obtaining device info...", just to get stuck there (both with GUI and console modes).

Any help appreciated.

I had the same problem with Debian 10.
When it went to 'obtaining device info' I waited for 2 minutes then I booted in to fastboot again and the proces continued.
 

Pa-Jo

Senior Member
Apr 27, 2012
55
10
Malý Čepčín
I'm getting %d error on Ubuntu 18.10, I am unable to read how long I need to wait for unlocking my phone's bootloader. (Error 20036)
 

Pa-Jo

Senior Member
Apr 27, 2012
55
10
Malý Čepčín
Is this tool working only for accounts which were not trying to unlock the bootloader with oficial unlock tool and get no reject with waiting time? I'm asking because if this modded unlock tool gets the token based on MiAccount which has been already signed on Xiaomi server with waiting time, it causes the %d error I think.

Can somebody confirm that bootloader can be unlocked while the MiAccount is bounded in Developer settings and this account hasn't been used with oficial unlocking tool and rejected by waiting time?

I am trying to unlock on Ubuntu with no luck, tryied both GUI and CLI methods.
 

devrruti

Senior Member
Jan 23, 2011
681
198
I'm getting %d error on Ubuntu 18.10, I am unable to read how long I need to wait for unlocking my phone's bootloader. (Error 20036)
It doesn't report how much time remains until you can unlock. The official windows app does.
It's one month for all xiaomis manufactured since June, except pocophone (3 days)
Count starts since you add a xiaomi account to the phone
 

Soygdl

Member
Mar 15, 2017
36
1
Gets stuck in reviewing bootloader status... help, any solution?:crying::crying:
I'm in elementary OS based on Ubuntu 16.04
 

Black_Stark

Senior Member
Sep 24, 2012
3,498
1,020
GOA

Lol...using linux and dont know about sudo. We start with sudo for some actions if we want to run comand with admin rights.

R u using terminal right?

Then u need sudo command sometime.

If u want to install app then u say
sudo apt-get install nameofapp
Or just go to ubuntu store and search android tools fasboot


Then open terminal and run fastboot commands
Connect phone to pc.

fastboot devices

fastboot oem device-info

If its hangs use

sudo fastboot oem device-info
Enter password
 

Soygdl

Member
Mar 15, 2017
36
1
Install android fastboot tools.

Use sudo

sudo fastboot oem device-info


I already did. I have worked the disconnect and remove and put back in fastboot mode and reconnect, and in advanced but I failed to wait hours and try again, now the question is how many hours should I wait? , it is unfortunate not to be able to visualize the number of hours to wait in Linux version, in advance thank you very much for the work the developer did I hope the tool better with the passage of time,
 

Black_Stark

Senior Member
Sep 24, 2012
3,498
1,020
GOA
I already did. I have worked the disconnect and remove and put back in fastboot mode and reconnect, and in advanced but I failed to wait hours and try again, now the question is how many hours should I wait? , it is unfortunate not to be able to visualize the number of hours to wait in Linux version, in advance thank you very much for the work the developer did I hope the tool better with the passage of time,

We are very lucky he reverse engineered it for linux.
I dont know if will improve it. He never replied to thread. Dont know if he is active.

Did u bind ur account in developer option.?
Enable oem and usb debugging?

How many hours of waiting time it is showing?
 

Soygdl

Member
Mar 15, 2017
36
1
We are very lucky he reverse engineered it for linux.
I dont know if will improve it. He never replied to thread. Dont know if he is active.

Did u bind ur account in developer option.?
Enable oem and usb debugging?

How many hours of waiting time it is showing?

Already activated debugging USB and OEM, regarding the hours, as commented there is a bug which does not say the hours in Linux only says $% or something like that
 

Black_Stark

Senior Member
Sep 24, 2012
3,498
1,020
GOA
Already activated debugging USB and OEM, regarding the hours, as commented there is a bug which does not say the hours in Linux only says $% or something like that
Your number should show activated.
And no device show in "other device" option.
And keep mi cloud sync on for data if u dont have wifi.
Ur phone info should sync with mi server.

What is ur current miui rom version?

Dont change rom from beta to stable or vice versa or update rom .
 

Attachments

  • IMG_20181123_211502.jpg
    IMG_20181123_211502.jpg
    86.9 KB · Views: 573
Last edited:

Michal_M1

Member
Nov 13, 2014
6
0
Prague
error code 20041 ???

Hi,
I tried unlock my phone Xiaomi Mi Mix 2s [Global] with MiUnlockTool under Linux (Debian 10/x86-64, Java 1.8.0_191-b12), but without success. :(

Code:
sudo java -jar bin/MiUnlockTool.jar account_number password
[12:20:01][INFO  ] Starting login procedure
[12:20:05][INFO  ] Login procedure succeeded
[12:20:05][INFO  ] Checking account unlock permission
[12:20:06][INFO  ] Unlock permission confirmed
[12:20:06][INFO  ] Waiting for a fastboot device
[12:20:47][INFO  ] Device connected: eac3ed71
[12:20:47][INFO  ] Obtaining device info...
[12:20:47][INFO  ] Device info obtained
[12:20:47][INFO  ] Checking if unlock will erase data and server message
[12:20:49][INFO  ] Unlock procedure will erase userdata
[12:20:49][INFO  ] Server message: An unlocked device is an easy target for malware which may damage your device or cause financial loss.
[12:20:49][INFO  ] Querying unlock server for unlock key
[12:20:51][ERROR ] Unlock request replied with [B]error code 20041[/B]
[12:20:51][ERROR ] Error meaning: Unknown error: %d

Any solution?
 

nunoMaga

New member
Nov 27, 2018
1
0
on Ubuntu 18.04. Does it work with java 11? it was what i installed but it doesnt run.

sudo ./MiUnlockTool.sh


Exception in thread "main" java.lang.NoClassDefFoundError: javafx/application/Application
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at com.xiaomitool.miunlock.Main.main(SourceFile:46)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 10 more


:~/Downloads/MiUnlockTool$ java -version


java version "11.0.1" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)
 

DanDroidOS

Senior Member
Jul 26, 2009
454
104
Southern California
eosdev.org
on Ubuntu 18.04. Does it work with java 11? it was what i installed but it doesnt run.

sudo ./MiUnlockTool.sh


Exception in thread "main" java.lang.NoClassDefFoundError: javafx/application/Application
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at com.xiaomitool.miunlock.Main.main(SourceFile:46)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 10 more


:~/Downloads/MiUnlockTool$ java -version


java version "11.0.1" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)

I am having the exact same issue!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 53
    [TOOL][WIN/LIN/MAC] MiUnlockTool - Unlock bootloader of xiaomi devices on mac & linux

    Ciao xda users, I'm here to introduce a new tool of mine, MiUnlockTool.
    MiUnlockTool is an unofficial tool used to unlock bootloader on Xiaomi devices. This tool is copied from the original windows MiFlashUnlock tool and works the same way. The main feature of this tool is compatibility with linux and mac operating system (and windows too).
    If you want more information about the tool and the story behind you can read below, if you just want the download link, here it is:
    DOWNLOAD LINK
    Requirements: java (javafx for gui if not included in your jdk/jre)

    Usage:
    - Download and extract the zip file
    - If you don't have it, install java
    - On windows:
    -- open MiFlashUnlock.bat for graphical interface or:
    -- open a cmd windows and cd into extracted dir and use "MiUnlockTool.bat username password" command for command-line usage
    - On linux:
    -- open a terminal window and cd into extracted dir and use "sudo ./MiUnlockTool.sh" command for gui interface or "sudo ./MiUnlockTool.sh username password" for command-line
    - On mac:
    -- open (double click) MiFlashUnlock.command for graphical interface or
    -- open a terminal window and cd into extracted dir and use "./MiFlashUnlock.command username password" for command-line
    - Attach your locked device in fastboot mode.
    - If you are using gui just follow what you see on your screen
    - If you are using command line version remember that there is no confirmation request before unlock and no check if the bootloader is already unlocked.

    Possible errors:
    - If you get a permission related error on linux or mac when launching the tool, open a terminal and cd into extracted dir and use "chmod 777 MiUnlockTool.sh" (or MiUnlockTool.command on mac) to set the executable permission.
    - If your device isn't recognized:
    -- On windows: install adb drivers
    -- On linux/mac trying launching the tool with sudo (sudo ./MiUnlockTool.sh on linux or sudo ./MiUnlockTool.command on mac)
    - Other problems launching the tool: try running "java -jar bin/MiUnlockTool.jar" command
    - If you get some errors with javafx class not found stuff when you try to launch the gui, then you are missing javafx library. See openjfx package on linux.
    - Any other problem: provide feedback in the comments.


    Additional info: original MiFlashUnlock tool is just a bridge between fastboot, you (and your account login credentials) and xiaomi server: the tool gets device info from the device and send them to the server together with the account login token, the server checks wherever you satisfy all their requirements (account authorized, account associated with device in developer settings etc) and if everything is okay the server reply with the unlock key for your device instance (every time you reboot your phone you need a new key). Then the tool send the key to the device with a custom build of fastboot and if the key is right then the device is unlocked, else it reboots. After I discovered all the process behind the original unlock tool (and all the security encryption techniques) I decided to replicate it with a java (cross-platform) tool which embeds a custom fastboot version and replicates what the original tool does. That's a simple explaination of how my tool works (obviously it's more complicated than that).
    This tool requires all of what is required by the original tool (an authorized xiaomi account binded to the device through developer options for three days if I remember correctly).

    FAQs:
    - Is this tool safe to use?
    Yes, the main part is communication between tool and server, a safe thing. Also the unlock procedure itself is safe: or the key is correct or it is not. In both cases the device will not be damage.
    - How did you find out how to replicate the original tool?
    Thank you for your question. It's been a bit difficult since the original tool has been obfuscated and virtualized (protected against reverse engeneering) with a powerful protector: VMProtect. I've spent some time to reverse it (and custom fastboot too) and I finally did it. I will not explain in details how I did it.
    - Is this tool more powerful than the original on? why should I use it on Windows?
    Absolutely not, my tool is worst than the original one (it will have more bugs and on windows it doesn't manage drivers for example), that's why you should NOT use it on Windows. I made it work even with Windows because it was very simple to do. You can use it one Windows just to test it if you like, but I recommend using the better original tool MiFlashUnlock.
    - Wow, you did a tool already done by developers paid by xiaomi, who is paying for the effort you put into this?
    No one, I try to help people and getting appreciation for my work is a bit of a reward to me, but if you want to show your gratitude even more and support me as a developer you can make a donation, I will appreciate that even more ;) (donation link below)
    - I have to put my xiaomi account credentials, should I trust this?
    I'm the developer of XiaoMiTool, I hope that a little bit of my reputation together with the hopefully good early feedback of reckless users on this tool is enough. If you are more a geek you can track the traffic and see that the only server connected are xiaomi and miui.
    - I wanted too see the source of this tool but I see it is a bit obfuscated, why?
    Xiaomi clearly doesn't wanted people to see how MiFlashUnlock works (since they obfuscated it a lot), I don't want to disrespect xiaomi decision by releasing the source plain, so I decided to obfuscated it a bit just to make it a bit harder to see (even if my tool is 100 times easier to reverse than the original)
    - Can I share this tool?
    Of course yes, but I would like you to share it using the xiaomitool.com link (not mega.nz one) so that if I release an update new people will get that and not the old version (there is no tool update enginge built in).
    - You're english is not wonderful...
    I know, hopefully it is understandable enough


    Feedback.
    I love feedback, feedback is the best you can do to help me improving this tool. I have not time to answer everybody's questions but I generally read feedback and do my best to make the tool work. If the tool worked or if the tool didn't worked you can write it in the comments, adding additional information like what error you get, what screen you see when the tool get stuck or even what you tried to solve the problem are precious to me. I have not all of xiaomi devices, I fully ested my tool only with two devices (a redmi 4x and a mi note 2) and only on two operating systems (linux and windows), so any new combination could lead to new errors or problems. Please include also your operating system when leaving feedback. Sometimes there are problems on gui which are not on command-line version, so if the tools fails launching or when using gui I suggest trying the command-line version.

    Donation: free software is great from users prospective, but developers who spend hours of their time and don't get money for it are more unhappy to develop further free tools, so if you liked the tools and it saved you from the need to do 5000 kilometers to get a windows pc, or from the need to download a virtual machine image with your 32kB internet connection, you can show your gratitude by offering me a tasty, cold beer by clicking the link below ;)
    DONATION LINK

    Download: you missed the download link at the top? Here it is again:
    DOWNLOAD LINK
    8
    Fully obfuscated tool. Maybe bloatware or password hijacker
    4
    I'm using the latest Linux Mint but the MiUnlockTool don't work, do you know if there is another tool to unlock the bootloader using GNU/Linux?
    Unfortunately no. The only way that I found to unlock the bootloader was to install Windows and then use Xiaomi's unlock tool.
    I wrote a whole blog post about my experience doing it, but this forum won't let me post a link.
    To read it, search in Google for: "amosbbatto Why we don't own our mobile phones"

    Couldn't get Mi Unlock working on my Windows 10 for the life of me (Unlock button would stay grey even if I had plugged in my phone), but this seemed to work fine until it requested the unlock key.
    You either have to install the USB drivers from xiaomigeek.com or you have to register your phone at the Xiaomi web site. See my blog post about it.
    3
    So, uhh, is the author aware of the bug with %d displaying instead of something meaningful like hours until unlock?
    3

    Lol...using linux and dont know about sudo. We start with sudo for some actions if we want to run comand with admin rights.

    R u using terminal right?

    Then u need sudo command sometime.

    If u want to install app then u say
    sudo apt-get install nameofapp
    Or just go to ubuntu store and search android tools fasboot


    Then open terminal and run fastboot commands
    Connect phone to pc.

    fastboot devices

    fastboot oem device-info

    If its hangs use

    sudo fastboot oem device-info
    Enter password