yashsingh1/xdaforums huggingface dataset:
[Xiaomi Mi A1 Guides, News, & Discussion] GVN.Gallus:
No, i didn't do anything with persist, just unlock bootloader, install TWRP and custom rom. My BT still working, i just like the original state of my phone.

Should i comeback to stock now and see if my BT and WIFI is fine?
[Xiaomi Mi A1 Guides, News, & Discussion] hnkotnis:
Sure. Just make sure you have a backup of persist (actually everything, not just persist) before you attempt anything.
[Xiaomi Mi A1 Guides, News, & Discussion] GVN.Gallus:
Will do it now!, and i found this tutorial to backup persist, should i follow it?

https://www.youtube.com/watch?v=V5jC0RCTqlw
[Xiaomi Mi A1 Guides, News, & Discussion] cr1ogen:
The backup of persist folder would be made from the stock rom? Or can be made from custom rom too? Thank you!!

Enviado desde mi Mi A1 mediante Tapatalk
[Xiaomi Mi A1 Guides, News, & Discussion] sdeft:
please ignore above i changed my post...the above was because i did not extract all your files...thought i only needed the adb which i already had installed from sdk.
[Xiaomi Mi A1 Guides, News, & Discussion] cr1ogen:
Me BT address is 00-00-00-00-5a-ad

Enviado desde mi Mi A1 mediante Tapatalk
[Xiaomi Mi A1 Guides, News, & Discussion] hnkotnis:
It comes from Wanam, a well known developer. It should work as intended but I haven't used it so I don't know if it will work.

I backup partitions using terminal with ls of by-name to identify partitions and then dd ing them to sdcard followed by copying images to PC.
[Xiaomi Mi A1 Guides, News, & Discussion] sdeft:
Yes i know that it refers to Linux file system permissions. Just want to know what is actually changing.

Is it only for wlan_mac.bin to 0644 & root ?
[Xiaomi Mi A1 Guides, News, & Discussion] hnkotnis:
This whole tool at v1 only changes wlan_mac.bin

No other file is touched.
[Xiaomi Mi A1 Guides, News, & Discussion] sdeft:
ok but when your tool asked me I clicked on no. I checked wlan_mac.bin in /persist and is of 0644 & root ownership.

So I am wondering your tool is changing to what ?
[Xiaomi Mi A1 Guides, News, & Discussion] hnkotnis:
I am currently away from my PC so i can't tell what permission is set exactly. But it sets permissions and ownership to same found on a virgin phone.
[Xiaomi Mi A1 Guides, News, & Discussion] GVN.Gallus:
Ok i just comeback to stock, wifi saved but not connect, i use your tool and wf working, i check the MAC and notice that wifi and bt address almost the same, only different in last part of them, for example my bt is AA-BB-CC-DD-EE and my wifi is AA-BB-CC-DD-EF, is this normal?

I backed up imei, persist...etc and install RR6.0 again, strange that is my BT change to 00-00-00... again, i guess that isn't a problem since on stock it normal.

Thanks for your tool!
[Xiaomi Mi A1 Guides, News, & Discussion] hnkotnis:
It means your Wi-Fi MAC was indeed corrupted and and the tool fixed it.

And the Wi-Fi MAC address you have got after using tool is perfect and it is original MAC.

BTW which release of RR are you trying to use? Because 20180425 release changelog says it does not touch persist anymore.
[Xiaomi Mi A1 Guides, News, & Discussion] hnkotnis:
Perfectly normal. This is what it is supposed to be.
[Xiaomi Mi A1 Guides, News, & Discussion] GVN.Gallus:
Yes, i'm on 0426 build.

Maybe in the later version of your tool, we can change bt and wifi mac on custom rom to the address on stock rom?
[Xiaomi Mi A1 Guides, News, & Discussion] Meme :D:
Hello there!

Iv been reading alot of comments here about this wifi issue.

I have one, so this is my story:

I bought Mi A1 (32gb) like 2-3 months ago. It comed in Nougat version of android. I got oreo update and updated it to oreo. It was so good update, in fact i liked it. Then, i used oreo until April security patch. I decided to flash Resurection Remix because it has so many features. Flashed RR rom, and i enjoy it. Ive decided to flash stock rom in case just to see how it looks to flash stock rom when coming back from custom rom. I downloaded stock rom from official miui site and flashed it (clean all and lock in mi flash tool). After device booted up, i saw wifi is not working, i started to be feared that rom i flashed was wrong. I back to RR and currently i am using latest build (26/04).

So is there a chance that this program in OP you posted work for me? Or i did broked persist partition, is this program going to recover my ORIGINAL MAC? I dont really remember my MAC, now on RR my MAC starts with 00:0a:f5:xx:xx:xx (X is replace for numbders and letters, dont want to post here entire mac for security reassons.

Long reply i know, sorry but i am fearing litle bit for my phone, because it is new :/

Thanks for future reply, hope you all have good day!
[Xiaomi Mi A1 Guides, News, & Discussion] caveiramix:
I have backed up my current Persist partition but I am waiting for your v2 version which will also fix BT Mac.

How can I backup my BT Mac? These are all the partitions that the app can see, there is no BT Mac partition.

I have only backed up the modems and persist images.

Thanks.
[Xiaomi Mi A1 Guides, News, & Discussion] hnkotnis:
BT MAC is stored in the persist partition. So when you backed up the persist partition BT MAC was backed up.
[Xiaomi Mi A1 Guides, News, & Discussion] hnkotnis:
This is the problem this program was made to fix. I will recommend flashing stock ROM, then root it and use this tool.

When you use this tool and click "start repair button, the BT MAC textbox shows your Bluetooth MAC. If it is XX:XX:XX:YY:YY:YY (I recommend writing this down somewhere safe), confirm the XX part is different than the one you posted. Then proceed to send files to device. Original MACs will be restored.
[Xiaomi Mi A1 Guides, News, & Discussion] Meme :D:
So basicly you are saying that i can use this tool to fix my wifi issue? I didnt touched persist partition (flashed it, or edited etc)

My current bluetoth mac on RR is 00:00:00:00:5a:xx(Again XX is replace for number and letter) Is this mac ok?

I can flash stock rom, unlock bootloader, boot in twrp, flash magisk, reboot and use your tool? Awesome! After i used your tool can i flash stock rom again? (clean all and lock option to lock bootloader)

Thanks again man! :)

Btw using CM11 in 2018? Holy Moly, you are boss! :)
[Xiaomi Mi A1 Guides, News, & Discussion] upilguebu:
I think you can safely flash stock rom again (clean all and lock BL) after using this tool. Since the persist fixed after you using the tool. CMIIW :D
[Xiaomi Mi A1 Guides, News, & Discussion] pooniaprashant:
and how to know if my persist partition is tampered without flashing stock? I have recently flashed cardinal aosp and its the only rom i have flashed. I would like to know if my persist partition is allright so i can backup necessary stuff required for its recovery.
[Xiaomi Mi A1 Guides, News, & Discussion] Meme :D:
Well thats relief to me, awesome!

Thank you for taking time making this tool and helping everyone here having issue!

I am glad i didnt flashed persist.img from someone else phone, that could be disaster. I literally almost flashed it :D

---------- Post added at 05:57 PM ---------- Previous post was at 05:54 PM ----------

Hello there! Just dont flash anyones persist.img file floating here on XDA, you could destroy your mac forever!

However, i dont know if cardinal aosp rom touch persist partition, but if you have issue with wifi when you come in stock rom, follow this guide and you will be ok :)

Btw yes, you can backup your persist.img file before using this tool (in case something goes wrong) and after using this tool (your original persist.img file)

Thats it, hope i helped you :)
[Xiaomi Mi A1 Guides, News, & Discussion] pooniaprashant:
I just checked the hardware id of mi a1's bluetooth that was connected to my laptop when i was on stock rom, it matched the bluetooth address shown in the cardinal rom. I didn't got to check the wifi address as used my phone as wifi hotspot and connected to my laptop before checking the wifi mac address, but the thing to note here is that i just changed my wifi hotspot name to the name by which it was earlier used by me and added the same password, i enabled the wifi on my laptop and it didn't asked for any password probably remeberred it as the previous device and autoconnected. Does this mean my wifi and buetooth mac addresses are untouched?

---------- Post added at 06:58 PM ---------- Previous post was at 06:48 PM ----------

note: also i backed up up my stock efs partition with twrp before flashing cardinal, does it restores persist?
[Xiaomi Mi A1 Guides, News, & Discussion] rishiandri:
Is there any way to recalibrate sensors? Like gyroscope?
[Xiaomi Mi A1 Guides, News, & Discussion] Meme :D:
Well you cant know if your wifi and bt mac are changed until you flash stock rom. If wifi is working in stock rom, you should be fine, nothing is touched.

But if you have wifi problem after flashing stock rom, you may use this tool that will recover your original mac that custom rom changed it. Custom roms dont use vendor MAC (Xiaomis one) so problems with wifi are not presented in custom rom

Hope i maked it clear

And yes, you are fine with everything, you dont need to worry because you didnt flashed or edited anyones Persist.img file. :)

But again, if you notice that your wifi is not working in stock rom, you should maybe follow this OP.

Never flash anyones Persist.img!
[Xiaomi Mi A1 Guides, News, & Discussion] pooniaprashant:
what i see is that this tool gives us a random mac address, it doesn't restores the stock one
[Xiaomi Mi A1 Guides, News, & Discussion] Meme :D:
It will give you original MAC only if you didnt flashed anyones Persist.img file, but if you flashed it, i think it will give you random MAC

So you are still safe if you didnt flashed persist.img, you still have healthy phone
[Xiaomi Mi A1 Guides, News, & Discussion] EzioTheDeadPoet:
Hey is it possible, that you would make a linux port of this ?
[Xiaomi Mi A1 Guides, News, & Discussion] pooniaprashant:
so i came back to stock and my bluetooth/wifi/wifi hotspot were working fine, does this means that my persist.img is untouched?

also does backing up the efs partition also helpful in fixing these issues?
[Xiaomi Mi A1 Guides, News, & Discussion] Meme :D:
Well it seems your partition is not touched, thats great! :)

Well i dont think backing up your EFS partition backup ur persist.img.

Search on google or xda how to backup persist.img

I think some command in twrp is needed for backing up persist.img

But yeah, no need to use this tool since your wifi is working :)
[Xiaomi Mi A1 Guides, News, & Discussion] Saswata Chakraborty:
It worked for me. My Wifi issue is fixed now. But I wonder if it actually brings back my original mac address or if it's the same as fashing someone else's persist.img? Because when I was using the tool to fix my mac address, it said something about changing ownership (I don't remember exactly) which I clicked on "Ok". So, I am a bit worried if someone else has now got access to my device.
[Xiaomi Mi A1 Guides, News, & Discussion] Meme :D:
You dont have to worry, your ORIGINAL mac is restored, no one have or use your MAC :)
[Xiaomi Mi A1 Guides, News, & Discussion] xemisxu:
i used this tool to restore my persist to stock stauts but in about/phone have same mac before using this,i can root in /persist and i see 2 archives was overwite.

Is normal that u can see ur real mac in about phone/status?

Pd: i dont flashed any another persist form xda.
[Xiaomi Mi A1 Guides, News, & Discussion] TechNova:
as of stock oreo april update, is the persist partition present at mmcblk0p26 ?

i have been lately seeing many people losing their wifi mac addresses so before flashing anything wanna make sure to backup my persist partition...

i did a backup of mmcblk0p26 while on twrp using dd if of command, but it gave a file of 3.0GB as an output after 5-7 mins of waiting..
[Xiaomi Mi A1 Guides, News, & Discussion] Niksior:
There is a tool made by wanam to backup it (backup partition or something like that)

But if you want to do it manually just type in terminal

df -h

And it will show partitions
[Xiaomi Mi A1 Guides, News, & Discussion] cr1ogen:
I use the tool in Linux in a virtual Machine via VirtualBox, And works!! thank you so much!!!
[Xiaomi Mi A1 Guides, News, & Discussion] CosmicDan:
Does it not appear under the "by-name" node?

Related, the AOSP device tree guys are not completely to blame for this - the TWRP recovery should of had persist in fstab so it could be backed up. Would of saved most of us.
[Xiaomi Mi A1 Guides, News, & Discussion] TechNova:
I used the wanam's partition backup app to backup persist, and it showed mmcblk0p27 instead of 26, but anyways i got my persist backed up.. ?
[Xiaomi Mi A1 Guides, News, & Discussion] iqbal_mahmuda:
Can somebody tell me which partition should be backed up besides modem and persist?
[Xiaomi Mi A1 Guides, News, & Discussion] hacktek:
So I flashed the recovery flasheable version of oreo that's around here and after flashing magisk I realized that it wouldn't detect my sim so I flashed the stock package from xiaomi using fastboot. I seem to recall being able to connect to my 5 ghz network before doing that but after going back to stock it wouldn't connect. So I set my router on auto everything and the phone connected. If I force AC mode only it doesn't for some reason. I don't know if that's related to the rom I flashed messing with persist or if for some reason the hw isn't compatible with my Asus router for AC wifi. Attached is a screen shot showing I'm connected to 5 Ghz but with a crap rate of 72 Mbps so definitely not AC.

Thoughts? Will the tool help? I've backed up my persist partition using twrp's terminal but I'd rather not run the tool if it's not gonna help.

Thanks!
[Xiaomi Mi A1 Guides, News, & Discussion] Dornyx:
To use it do I need to go back to stock ROM? I've installed CosmicOS: is there a possibility I've permanently lost my persist partition?
[Xiaomi Mi A1 Guides, News, & Discussion] nilkanth.marshiwane:
This tool saved my device. Everything is working fine now. But Bluetooth mac and wifi mac addresses are different. Is it ok.
[Xiaomi Mi A1 Guides, News, & Discussion] AG14795:
[MENTION=5343187]hnkotnis[/MENTION] [MENTION=1844875]CosmicDan[/MENTION] Flashed stock rom v9.5.10 via fastboot after using custom roms for a while.... Now facing issue showed here (https://xdaforums.com/mi-a1/how-to/guide-fix-device-automatically-t3724240)... Exact same issue to be precise... Haven't flashed any persist img file as stated in the OP over there.

Will the tool provided here help? And if so how should I go about? Asking this as cannot go past the setup screen in stock rom. And flashing of custom rom isn't any helpful as the ROM won't beet up, stuck in bootscreen after clean flashing it.
[Xiaomi Mi A1 Guides, News, & Discussion] Bot96:
After installing latest build of cosmic os ( 1/05/2018) my WiFi Mac address is different from what I had on stock. Does that mean my persist.img has been modified/damaged rest everything like BT Mac address and imeis are same? Will I have WiFi issues when reverting back to stock?
[Xiaomi Mi A1 Guides, News, & Discussion] Devagya:
Some Information for newcomers here

1- Backup

I request op to make a basic guide on how to Backup all partitions with dd in first post.

- maybe add this option in the tool as well.

2- NEVER FLASH SOMEONE else's persist.img

-I did this mistake and I don't recommend anyone else to do the same

3- GO TO SERVICE CENTER-

if phone is still under warranty, just go to service center.

-My most sensors(accelerometer, gyroscope) were not working also wifi was not connecting so I took to service center, don't tell them what u did just say something like 'u updated to oreo' , in my case they didn't know what was wrong and they replaced whole motherboard.so I now have new imei,wifi address,etc

U might not be this lucky but I'd still recommend u to try this first.
[Xiaomi Mi A1 Guides, News, & Discussion] Bot96:
Yeah same here service center didn't had a clue what was wrong and got my motherboard replaced twice .?
[Xiaomi Mi A1 Guides, News, & Discussion] BusterCZ:
Hey guys,

I just came from AIM rom (the version which should modify mac). I flashed stock april rom and my BT and WIFI mac starts with: 18:f0:e4:xx:xx:xx

Is this xiaomis prefix? My wifi is working fine, but i dont have any 5GHz wifi nearby to test it..
[Xiaomi Mi A1 Guides, News, & Discussion] cr1ogen:
https://macvendors.com/

Enviado desde mi Mi A1 mediante Tapatalk
[Xiaomi Mi A1 Guides, News, & Discussion] BusterCZ:
Ok, thank you :)

But after all its weird as it was the version which was realesed before persist damaging was fixed in custom roms :D
[Xiaomi Mi A1 Guides, News, & Discussion] yasars:
Mine too 5ghz with non problems... I mean its original...
[Xiaomi Mi A1 Guides, News, & Discussion] Dornyx:
I'm on custom ROM NitrogenOS. How could I find out if the ROM damaged my Persist partition or not?
[Xiaomi Mi A1 Guides, News, & Discussion] Dornyx:
Is there a way to create a tool that works also in custom ROMs to find out IF the /persist partition has been corrupted or if the vendor MAC address has been lost forever?
[Xiaomi Mi A1 Guides, News, & Discussion] Niksior:
Just check (or look above) what is Xiaomi MAC address prefix

And look on your own

You will know now

If you are not sure, go tu /presist, open .bin with wifi mac addresses and look on prefix
[Xiaomi Mi A1 Guides, News, & Discussion] Niksior:
I don't know what happened

I flashed some roms and my WiFi mac crashed (wlan_mac.bin was overwritten)

Today I've opened wlan_mac.bin and I have my original mac in there (Intf0MacAddress=3480B3******)

Only thing I've done was backup presist with wanam's tool while I was on RR 15.04

It's strange

And my WiFi mac is still 00:0a:f5 (I'm still on RR)
[Xiaomi Mi A1 Guides, News, & Discussion] DavideLosito:
I installed Francisco Franco's Kernel and after removing it with flash_all_except_storage on MIUI tools, wifi is broken.

I actually don't remember whether I may have used custom ROMs in my process of testing rooting and stuff... for various reason I prefer to have stock ROM back on... will your tool fix it? Sensors and BT are working pretty fine, just WiFi can't start.

I tried fixing Persist.img with a Fastboot flash but it says sending 'persist' (4744 KB)...

OKAY [ 0.140s]

writing 'persist'...

FAILED (remote: Error: This image isn't allow download)

EDIT: if I UNLOCK the phone and leave it unlocked, WiFi works.
[Xiaomi Mi A1 Guides, News, & Discussion] Rinku221:
Thanks for the tool, but i have one problem that I am not able to use the tool it's getting hanged while on 2 step checking device,

I don't know what wrong I am doing.

Edit: fixed thanks
[Xiaomi Mi A1 Guides, News, & Discussion] cherryb8844:
Maybe adb driver not installed properly.

Did you checked your device recognized in cmd via this cammond 'fastboot devices ' without quote. If cmd say checking device so you must install adb drivers manually.
[Xiaomi Mi A1 Guides, News, & Discussion] JOSE_1889:
I use this tool and work properly now my phone works with wifi... Thanks to dev but i have a question. I do this process after try flashing stock images with miflashtool so if i install stock images from miflashtool it change my persist partition? I mean i don´t use any persist.img or something like this. I use only miflashtool to restore phone operation sistem and i get the error with wifi with all versions. So i have the question if i could destroy the persist partition installing custom roms or going back to stock.
[Xiaomi Mi A1 Guides, News, & Discussion] mardrest:
You destroy persist partition only by custom roms, but not all, there are some that don't touch persist partition, you must read the op from rom first
[Xiaomi Mi A1 Guides, News, & Discussion] JOSE_1889:
I am trying to ask if this tool help me if i only install custom roms and go back to stock. Because i never flash persist image or something like this
[Xiaomi Mi A1 Guides, News, & Discussion] mardrest:
Yes, if you go from custom rom to custom rom, you wont notice, only if you go stock you notice if you persist image is brocken as custom rom dont use that partition for wifi and bluetooth mac adress
[Xiaomi Mi A1 Guides, News, & Discussion] JOSE_1889:
So to make it clear.... If i use custom roms and when i back to stock face the wifi problem i can use this tool to restore it?
[Xiaomi Mi A1 Guides, News, & Discussion] Niksior:
Yes
[Xiaomi Mi A1 Guides, News, & Discussion] ProchyGaming:
Do I have to go back to stock to restore persist?

EDIT: Used it on latest RR and worked flawlessly. Thanks!
[Xiaomi Mi A1 Guides, News, & Discussion] fburgos:
I come from stock ROM and franco kernel,

Flashed du 180430 which supposedly don't touch persist partition but my wifi and BT Mac are wrong.

Never flashed any persist.

Do I just follow op to get back my WiFi and BT Mac
[Xiaomi Mi A1 Guides, News, & Discussion] Giovix92:
Hey, hello guys. After flashing voidKernel got mac changed, then I flashed a twrp version of the stock rom and got a mac that's like 04:b1:67 etc, tried to use persist resurrector and it seems that bt addresses matches. Is wifi&bt mac addresses already restored?

Thanks in advance :)

Edit: seems that I got the answer myself. 5GHz works flawlessly, bluetooth too.

04B167 is from Xiaomi corp, so I think it's the stock mac :D

Just in case, there are almost all Xiaomi's MAC prefixes:

FC64BA F8A45F F4F5DB F48B32 F0B429 ECD09F E446DA D86375 D4970B C46AB7 C40BCB B0E235 ACF7F3 ACC1EE A086C6 9C99A0 98FAE3 8CBEBE 7C1DD9 7811DC 7802F8 7451BA 742344 68DFDD 64CC2E 64B473 640980 584498 508F4C 50642B 4C49E3 3CBD3E 38E60A 38A4ED 34CE00 3480B3 28E31F 286C07 2082C0 18F0E4 185936 14F65A 102AB3 0C9838 0C1DAF 04D13A 04B167 00EC0A 009EC8

Hope that it helps :)
[Xiaomi Mi A1 Guides, News, & Discussion] leo_pard2331:
just wanted to ask out of curiosity....

i had unfortunately flashed a persist.img file downloaded from xiaomi firmwares website coz my phone kept rebooting every 10 sec :crying: what will happen if i still use this tool?

and BTW i had connected to my laptops hotspot when i had my original MAC address..... anyway i can know my original MAC address using that? :confused:

thank you in advance :D
[Xiaomi Mi A1 Guides, News, & Discussion] moonsmart00712345:
Are other phone's hotspot 5GHz wifi?
[Xiaomi Mi A1 Guides, News, & Discussion] jucaftp:
Just for the record, I've tried your tool on LineageOS (05-14-2018 build) and it didn't work quite as expected.

All goes well, but the Wifi MAC isn't changed after the reboot. Curiously, the Bluetooth MAC is correct now, but I didn't check this before the procedure, so I can't be sure it was the tool

In any case, I've seen it helping others, and I know this may not be apropriate for custom ROMs so, it's really just for the record :D

*** EDIT ***

PRETTY SURE it "didn't work quite as expected" because I was on a Custom ROM. As soon as I flashed a Stock ROM back, the MACs were both properly set. Thanks bro!