Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find a solution !? Two issues issue 1 : Code 20038 ?! issue 2 : In settings > dev > "mi unlock status" it says bootloader unlocked, but in bootloader mode it says locked ?! #15

Open
gmvlasta opened this issue Apr 1, 2024 · 17 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@gmvlasta
Copy link

gmvlasta commented Apr 1, 2024

I am trying to unlock the Redmi 5 Plus (vince). I finished with this:

=========================================================
product saved successfully
token saved successfully

DeviceInfo:
product: vince
token: ******

AccountInfo:
id: ******
region: *******


code: 20038

description: 该手机已被账号 145****753 通过查找手机锁定,无法解锁

What I found strange is that in settings there is information that the device is unlocked. But the output of command "fastboot oem device-info" is different:

(bootloader) Device unlocked: false
(bootloader) Device critical unlocked: false

I would appreciate any idea how to solve it. Thank you.

@offici5l
Copy link
Owner

offici5l commented Apr 2, 2024

It seems that the device is linked to another account, but I do not know the exact cause of the problem

So there is no "add account and device" button in developer options !!! It appears that the bootloader is unlocked !!

Try the following steps :

to ensure that the bootloader is completely locked, reboot device in bootloader mode:

Try using the command :

fastboot getvar unlocked

If the bootloader is locked, the result will be : no
(If the result is not "no", please do not continue with the following steps and let me know)

Then try using the command :

fastboot oem lock

the result will be : Device is already locked
(If the result is not "Device is already locked" please do not continue with the following steps and let me know)

If you get a result "no" on the first command, and a result "Device is already locked" on the second command :

  • factory reset the device
  • Then go to developer options » Mi unlock status » add account and device
  • "Once the account is successfully bound" try again with MiUnlockTool

( If no button "add account and device" appears tell me that )

@gmvlasta
Copy link
Author

gmvlasta commented Apr 3, 2024

Thank you for help. I also think that the device is probably linked to
another account.

Settings in device was:
Developer options » Mi unlock status » This device is unlocked

I tried your steps:

fastboot getvar unlocked
RESULT
unlocked: no

fastboot oem lock
RESULT
(bootloader) Device already : locked!

Then I did factory reset but the state in settings is the same:

Developer options » Mi unlock status » This device is unlocked

Maybe it could help to flash the MIUI firmware via fastboot if possible?

@offici5l
Copy link
Owner

offici5l commented Apr 4, 2024

I believe, according to my analysis, that the cause of the problem is a files build.prop, default.prop ..
I think the device had its bootloader unlocked before, and it was rooted as well, Then the bootloader was locked incorrectly, meaning without cleaning system, boot ...

Why does the text “This device is unlocked” appear, even though the device’s bootloader is locked, the reason is:

In the settings application path package: com.android.settings.bootloader.BootloaderStatusActivity

Exactly in line 37 the status of the bootloader is checked whether it is unlocked or locked via "ro.secureboot.lockstate"
If the result is locked, the usual button "add account and device" will appear
If the result is unlocked, only the text "This device is unlocked" will appear

In your case, the result is returned: unlocked, (if my analysis is correct)
This can be verified by command :
adb shell getprop ro.secureboot.lockstate

The answer to your question about flashing a Fastboot ROM
It is not possible while the bootloader is locked (with the usual ways)
But this can be done by edl mode ( You can find out the method by searching on YouTube ).

Suggest a solution:

You can try flash Stock ROM recovery with mi assistant ( Even if the bootloader is locked ) with MiAssistantTool .
tell me If the method works for you and "add account and device" button appears

If the method did not work, try with edl mode The only solution : Contact Xiaomi support team or use a paid tool .

@offici5l offici5l changed the title Code 20038 Code 20038 ?! May 1, 2024
@gmvlasta
Copy link
Author

As the device was new, I claimed a warranty and a seller returned me
my money. So I couldn't try your last advices. I believe that it would
solve the issue. Thank you very much for help!

@bodV6
Copy link

bodV6 commented Sep 24, 2024

On line 37,
How can I change the unlocked state back to locked:
ro.secureboot.lockstate: locked

So that mi status unlock can open to add my account again.
Or any other advice to unlock bootloader.

Mi assistant tool only flashed OTA on recovery mode, but did not change the lock state.

@offici5l offici5l reopened this Sep 26, 2024
@offici5l offici5l pinned this issue Sep 26, 2024
@offici5l offici5l changed the title Code 20038 ?! Find a solution !? Two issues issue 1 : Code 20038 ?! issue 2 : In settings > dev > "mi unlock status" it says bootloader unlocked, but in bootloader mode it says locked ?! Sep 26, 2024
@offici5l offici5l added help wanted Extra attention is needed question Further information is requested labels Sep 26, 2024
@offici5l
Copy link
Owner

offici5l commented Sep 26, 2024

If you tried flashing recovery ROM with mi assistant and still have the same issue ..
So you should try other solutions...
Unfortunately, I have no idea at the moment...

@offici5l offici5l unpinned this issue Sep 30, 2024
@slg407
Copy link

slg407 commented Nov 20, 2024

to add onto this, this error, specifically on brand new devices, back in the day was usually related to the reseller putting a malicious custom ROM on the device, if this happens to you check the product authentication page on the xiaomi website, and it will almost 100% show you that the device is not the official global version, this used to be a much larger problem with older xiaomi devices, where resellers would reflash the CN version of the device with a global version of MIUI packed with malware, and then relock the bootloader in a way that would make unlocking it impossible after (the dev options would show the device is unlocked, when it was actually locked) and then resell the device for cheap, profiting off of stolen data afterwards

@bodV6
Copy link

bodV6 commented Nov 20, 2024

Thanks for this info.
Fortunately for me, where while desperately looking for unlock solutions. I have opened the back cover and expose the EDL panel of my phone because Redmi k40 pro only works through EDL test point and not USB EDL.

I flashed the Official China ROM, and the bootloader is now evidently LOCKED.
I was thinking from there I can add my mi account and unlock.
Unfortunately, new Error now from mi unlock is:
"THE PLACE WHERE THE ACCOUNT IS REGISTERED DOESN'T MATCH THE PLACE WHERE THE PHONE IS SOLD".

It seems xiaomi does not want to unlock bootloader again. Futile efforts ever since.

Specifically bought EOL Device for custom roms.

@bodV6
Copy link

bodV6 commented Nov 20, 2024

Additionally, if I flash official Global or EU or any MIUI ROM.
It results to "System Destroyed" I had to occasionally revert to flash back the Official China HyperOS RoM.

@slg407
Copy link

slg407 commented Nov 20, 2024

please send the results of: https://www.mi.com/global/verify/

also, if you managed to install the chinese ROM i imagine you have the patched firehose loader file?

also also, "the system is destroyed" could be related to anti-rollback, and not with the rom itself, one thing you could try is using https://github.com/bkerler/edl with the "edl modules oemunlock enable" command, by loading the patched firehose file you have (or use the tool's automatic detection to search if one of the pre-packaged loaders works with your device), i am not responsible for damages that could happen with this tool, but it could be useful for your quest if you are skilled enough to learn to use it, good luck

@bodV6
Copy link

bodV6 commented Nov 21, 2024

Thank you slg407, the Device Xiaomi Redmi 40 pro is verified original.
But you understand the Device was specifically made for China region, while it's global equivalent is called Xiaomi Mi 11i.(With global ROM)

Actually if I try to downgrade on EDL to lower Chinese ROM, I will get Anti Rollback Error. Unable flash error on mi Flash tool.

Only flashing Global ROM causes system Destroyed.(Successful flashed, but display system destroyed on boot, nothing else works)

I will try the tool you suggested and give a feedback here.
Thanks Again.

@slg407
Copy link

slg407 commented Nov 21, 2024

for using the tool you first run that command i sent, then you try to unlock via fastboot after, the command i sent only actually enables unlocking

@bodV6
Copy link

bodV6 commented Nov 22, 2024

@slg407 I have been able to setup and py build the tool on windows, but errors with lib and USB does not make edl loader detect the phone. hope you can help out. but here is what I have tried,
I ran Zadig tool, but no devices appears,
at a point I replaced libusb_win32 driver with the Q9008 com for edl. but reverted back since it did not work.
edl detects the phone at COM6, I only don't understand the need to detect USB details.

EDL for redmi k40 pro uses onboard edl point to short circuit. only Q9008 port works

here is the error:
PS C:\Users\abode\Sahara Qualcomm Diag Tool\edl> edl --serial
main
main - [LIB]: Please first install libusb_win32 driver from Zadig
main - Trying with no loader given ...
main - Waiting for the device
Detected 0x5c6:0x9008 device at: COM6
main - Device detected :)
DeviceClass - Warning !
main - Mode detected: sahara
Traceback (most recent call last):
File "C:\Users\abode\Sahara Qualcomm Diag Tool\edl\edl", line 393, in
base.run()
File "C:\Users\abode\Sahara Qualcomm Diag Tool\edl\edl", line 293, in run
version = conninfo.get("data").version
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

@slg407
Copy link

slg407 commented Nov 27, 2024

inside the edl tool there's the drivers folder:
img-2024-11-27-06-52-15
inside of it a folder named "Windows"
img-2024-11-27-06-52-59
inside of it is all you need
img-2024-11-27-06-53-31
extract the 7-zip, then plug in your phone while on EDL mode and run the zadig tool included
img-2024-11-27-06-55-42
select the android device from the dropdown (you may need to open device manager to see it, and it may have a weird name)
then select the libusb-win32 driver on the options and click the big button
image

@slg407
Copy link

slg407 commented Nov 27, 2024

if this does not work try with the winUSB option instead

@bodV6
Copy link

bodV6 commented Nov 27, 2024

WinUSB works, to replace the Q9008.
I was able to do that yesterday.
But the new error is that none of the
Firehose loader works for my devices.
The tool tried all firehose loader that matched my device hash.
But none worked.
It disconnected after trying the last.

@bodV6
Copy link

bodV6 commented Nov 27, 2024

Please can you help get the right Firehose loader for Redmi K40 pro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants