[Guide] How to "fix" WiFI after come back from custom roms to Stock rom.

Search This thread


New member
Dec 27, 2010
Actualizando informacion que es valido a la fecha del 09-04-2021 y que debe servir a mas dispositivos xiaomi y no tantas cosas insevibles publicadas sigan el tutorial de este video me funciono 100%

Updating information that is valid as of 04-09-2021 and that should serve more xiaomi devices and not so many insevible things published, follow the tutorial in this video, it worked for me 100%



New member
Jan 11, 2022
Hi. Please help me fix wifi problem. My phone is Redmi Note 6 PRO. The problem is (Wifi is not turning on. On stock rom). This problem apeared after flash custom rom. I flashed custom rom and after that i flashed stock rom miui 12. And wifi is not turning on.


Jul 6, 2021
Hi all
Anyone can help me with my tvbox internal wifi is damaged (maybe),,,and can t add new usb driver to the stockk rom 7.1.2


New member
Jun 27, 2022
OnePlus Nord CE 5G
I have changed my rom to ppui after changing to ppui I am unable to connect to a particulat network it is showing in the screen and after entering the correct password also I am unable to connect to it can anyone help me plz


May 20, 2023
did not work for me (redmi 5a riva).

I followed this post (xda-post-link), but it failed at the last step with error msg like:
Write file C:\file-path\images\NON-HLOS.bin to partition[modem] sector 131072 write failed:A device attached to the system is not functioning. write failed:The port is closed

However, this comment (comment-link) from the same post solved my wifi and bluetooth issues.

Top Liked Posts

  • There are no posts matching your filters.
  • 26
    Ok guys after lots of tests, I've managed that the fastest and easiest way to have wifi fixed on Stock android rom is to delete some lines (they are 2-3) in a file located on "/persist" folder.

    1) You need magisk (or any other form of root) and a file manager that can edit (with root permissions) systems files.
    Once you have done it, go on root "/persist" and find the file "wlan_mac.bin", open it with a text editor and delete all lines in it(let it empty but don't delete it, just delete lines in it), after save and reboot phone, done.

    2) This is faster, it is going to do same thing but without magisk. Just flash the WiFi_fix.zip (see file below in attachment) from Twrp and it will replace the corrupted wifi_mac.bin with an empty one.
    Optional: if you know how to generate a xiaomi vendor mac address, just replace the empty wlan_mac.bin from my WiFi_fix.zip file with yours.

    *This is the fast and easy but not the best one. I'm finding a workaround.
    Anyway this method isnt a problem you are going to use base Mac Address and not the vendor one. In therms of warranty I don't think it will change something.

    PS: Actually this will be fixed on custom rom that used to edit that file.
    Your method is not the fastest nor the best to reset the WiFi connection, You do not need to be root.

    You must do the following:

    The persist.img file must be downloaded from the following link

    “persist.img” file and move it to phone memory “/sdcard”.

    1.- Enter fastboot mode, , you must have unlocked the bootloader
    2.- Execute TWRP with the command fastboot boot twrp.img
    3.- Open Terminal in TWRP Custom Recovery (go to "Advanced"> "Terminal").
    4.- Type the following command:
    dd if=/sdcard/persist.img of=/dev/block/mmcblk0p27
    5.- Restart and with it the wifi will work.

    Procedure taken from https://xiaomifirmware.com/guides-and-tips/restore-persist-partition-xiaomi-mi-a1/
    How you make a healthy image backup of persist? Do you make the backup before flashing custom rom or after? If I make a backup now (currently im on RR) is it classified as healthy or no? XD I'm afraid after seeing this thread and now im in RR, I'm so afraid to coming back to stock xD
    First of all don't be afraid, no permanent damage has been done. It is fixable and I am working on a tool to fix it. (No ETAs please, I have too much busy life. But I hope it will be in 2-3 days)


    By healthy backup I meant that I took a backup of all partitions when phone was new and no changes were done.

    Sent from my epic G900F (klte) Gadget of Mass Destruction using Tapatalk.
    There's a persist.img in our fastboot ROM. Can we use that instead of what you linked?

    Edit - Flashed the persist.img from the Fastboot ROM in EDL mode. I ended up with no sensors. Trying to reflash the entire ROM now. :'(

    I've already done it and have same your issue in past. Problem is that, that persist.img found on fastboot firmware stock, seems to non be complete and has "corrupted" (incomplete) WCNSS_qcom_wlan_nv.bin and WCNSS_wlan_dictionary.dat. And also it doesnt make the folder /persist/wifi_bin where are located other 2 folders "minus" and "plus".
    In your case you have finished with no wifi, that isnt correct. You have wifi but you need to put phone next to router cause with those "corrupted" files it has really low range. To fix that you just need files that I've wrote above from someone that has correct files. In this case you ave done a backup, you just needed to copy wifi_bin folder, WCNSS_qcom_wlan_nv.bin and WCNSS_wlan_dictionary.dat from your backup.
    Anyway actually I think you are using the hardware mac address that in most of phones starts with: 00:0a:f5 (it is the prefix of vendor Airgo networks that produce those chipsets and works under Qualcomm). I've seen also mac starting with: 00:00:00 that is the prefix of Xerox Corporation.
    To turn back to your back vendor (XIaomi) mac address your last hope, as I know, is to use bluetooth mac. Considerading that you have a backup of it (it is located in /persist/bluetooth) and you have never touched it.
    I have same problem. When i flash stock rom via mi flshtool i can't connect to wifi. It shows wifi but after entering pwd it shows only saved. Can't connect at all.can u explain procedure when flashed stock rom. Flashing persist.img via fastboot will fix? Without rooting. Sorry for my bad English.

    ---------- Post added at 03:30 PM ---------- Previous post was at 03:23 PM ----------

    So you are saying after flashing stock rom i have to unlock bl and root. And then edit system????? Sorry im a noob to Mi A1:rolleyes:

    Just connect phone in fastboot on pc. open cmd (you need fastboot and adb drivers installed on PC) and write this:
    fastboot oem unlock (to unlock bootloader)
    fastboot boot twrp-oreo-3.2.1-2.img (you need last official twrp from XDA for that. Name can be different, you have to write extaclty of your file)

    Phone will boot on twrp. From install/flash magisk and reboot phone. Now you have magisk and root.
    Download and installa a file manager like MixPlorer, Root explorer, MtManager and many others.
    Go on "root" and find the folder "persist". In it you will find the file "wclan_mac.bin" just edit. If you still have issue I will made something that is going to do it automatically.