yashsingh1/xdaforums huggingface dataset:
[Xiaomi Mi 8 Questions & Answers] tsongming:
Okay , if your formatted and typed yes ( this is the most important step)

Then you double clicked flash all.bat, you should have seen ADB restore every partition and then from there, install TWRP Recovery, and boot to TWRP. After booting into twrp you can use dd command from adb shell to access persist partition.

[MENTION=10445939]Leoleo96[/MENTION]

Edit

Your case is more difficult, I just added Option 5 , try it. This should work.
[Xiaomi Mi 8 Questions & Answers] tsongming:
The persist image is inside the folder, you take it out, and try the DD command. I just added Option 5 , try it.

next regarding your error log, You clicked flashall. bat? Remember that the phone must be in fastboot mode and connected to the PC. if you have usb3 ports you will need to use a hub, that converts down to usb 2. You can buy an extender hub practically anywhere for $5
[Xiaomi Mi 8 Questions & Answers] Leoleo96:
When type the first code line (option 5) it says

'Invalid sparse file format at header magic

Failed to read sparse file'
[Xiaomi Mi 8 Questions & Answers] tsongming:
Read the instruction on option 5

You place the image in the user storage /sd card, and use TWRP terminal, it works for countless people on all Xiaomi phones.

[MENTION=10445939]Leoleo96[/MENTION]

Try editing the file as indicated here: http://4pda.ru/forum/index.php?s=&showtopic=906971&view=findpost&p=77405784
[Xiaomi Mi 8 Questions & Answers] Theevanz:
Option 5 does not work with the error of 'Invalid sparse file format at header magic Failed to read sparse file' (Its in the correct file , /sdcard)

should i try the persist on older version of global miui roms??

i also Tried editing the file as indicated here: http://4pda.ru/forum/index.php?s=&sh...ost&p=77405784 , I ran the file with the added info stated in the forum . when i ran the file through a USB 2.0 , the command prompt stops at the persist command. (I have attached the files that i edited. the batch file has been converted to a txt file cause XDA dont support)

Do you need any other info? Thanks so much !!
[Xiaomi Mi 8 Questions & Answers] alone_in_dark:
If backup is taken before the persist problem with this TWRP, only restoring the backup will solve the problem when problem occurs? Or have to wipe/format phone again? And you are using this TWRP for quite a long time. Have you faced persist/any problem till now?

Thanks
[Xiaomi Mi 8 Questions & Answers] tsongming:
If you have the backup, its restorable 100% of the time. The very first time that I encountered this issue, I had a TWRP backup but not a full backup with persist. I think that we ( You and I) have discussed a few months ago? When I had the issue, I used the DD command and it worked for me just as it has for many others..

Sometimes when the options fail, people have simply flashed the rom with mi Flash and then finally have success.

Because of all the variables of people flashing various things, there is no clear solution. The point of this thread is to edit the OP as people resolve issues and finally define steps that work for everyone. This is exactly,how I figured out how to unbrick my last phone when no solutions existed. at the end, of the day, what I have posted so far, works for most people, including myself.

Finally, to answer your question, I have had zero issues since using this TWRP and even if I had an issue, it would be instantly repairable with the persist backup created by this TWRP.

Case in point, we have 3 Mi8's in my house: I installed the official TWRP on one phone, and after using the Pixel 3 rom for a couple weeks that phone suddenly shut down and had a persist error message, Fortunately I stored away backups for each phone. In that example, I restored persist alone and nothing else, the phone was able to boot again to system with no issues.

So if you have the backup there is no issue, the point of this thread is to help people that do not have a complete backup.

Plus restoring persist alone is usually enough without additional steps.
[Xiaomi Mi 8 Questions & Answers] tsongming:
Absolutely, once your phone is fixed, I will edit the OP with the steps of your repair

Unfortunately this issue requires different solutions for different people. If you Google this issue, you will find that works for some doesn't work for another, and it's a problem that has plagued phones. But we will get it solved, as long as you haven't restored someone else's persist backup.

Yes, absolutely try other persist image files, this requires trial and error. It took me days to resolve my first persist issue, and even though you have seen the write error messages. Try installing MiFlash, make sure bootloader in unchecked and try flashing a fastboot rom. if you haven't done so already, that worked for a couple of people on the other persist posts. When I had the issue, I used the Global beta rom. but again it should not matter.

Here is a link that includes the Global beta fastboot rom and the fastboot rom for people with China phone

BTW, I made a Flashable zip file if you want to test it.

However, it will be at your risk. I have not tested it Because I do not have any phones here that has the persist issue. my zip file includes the persist image from the Global beta rom dipper_global_images_9.6.27_20190627.0000.00_9.0_global

Let try a few other things first before you try it. But worst case scenario that is an option and should worked as long as You have TWRP and you are rooted with magisk or SU

Also, if we do test it, I will have to send it to you privately, because, I don't want to share something with unknown consequences. However, I am pretty sure that it is safe, it's just the stock persist that has a script telling it to flash persist to persist partition.

Try this

Install root, Su if necessary

Try placing the persist image from the fastboot rom in SDCard/Twrp /backups/make a folder/persist file ( See path in attached image)

Now use Twrp restore and choose flash image to persist

Thanks for attaching the files, I forgot to do that part, but you can use the identically persist and raw file from the images fastboot rom. To be clear the ".txt" file needs to be changed back to .bat for those that don't know.
[Xiaomi Mi 8 Questions & Answers] Theevanz:
Hey, Thanks for the thanks . i feel honored XD

Anyways . i have school so i cant do much today.

A few update/question..

-I dont have time to try other persist.img from other versions , Ill try it tmr? ill see how

-As for using twrp mount to restore persist, As seen from the attached picture(First one), the partition cannot be selected ..

- I Tried using MiFlash20160830 , it says that my partition is write protected (Second picture).

Is there anyway to remove the write protected thing so i can either fastboot flash persist.img or i can use the dd if=/...... of=/.... ??

- Should i do all the steps u suggested with a rom installed or no rom installed . Cause i always formatt -> reboot recovery -> advance wipe everything -> Proceeds to start trying out to recover persist

- By saying i need root, what does root do in this case, do i flash it with a rom or nah .

Does flashing Magisk canary or normal magisk matter? (I have never used Magisk canary)

What does the "Install root" in twrp advance section mean ? is it SU? If so , Magisk or SU is advisable to try out

-What is option 3 talking about ? isit simply just to flash the persist img with the TWRP u provided?

- Lastly , How does EDL look like? is it not possible to get EDL now as i heard u need authorised accounts only which they have stopped authorising accounts. Is there any difference in EDL VS Fastboot (For example: Does EDL have more privileges so flashing persist is possible??)

Thanks again! As many times as you heard "Thanks" , You wont know how much i appreciate the help here !!
[Xiaomi Mi 8 Questions & Answers] tsongming:
Update

First as I mentioned worst case scenario we can try the flashable file. But unfortunately it may be risky so we will save that if nothing else works.

I have used Su in the past when magisk doesn't work, it still works extremely well , just no one uses it anymore because it's no longer being developed and its causes a lot of issues with Google. When you use it, you do whatever task needs to be dones and then remove it. Magisk uses a systemless method not affecting the System partition, and Su roots giving full write options to the system so it may help getting around the write protection issue.

The 4PDA link has the instructions for unlocking the persist partition

Quoted Below

"If you fall into such a trap that TWRP does not flash, tk. the bootloader is blocked to restore persist by the standard method

[LIST=1]
[*]We go to the images folder in the unpacked firmware from fastboot.
[*]Change the file "flash_all" using notepad (I advise you to install Notepad ++)
([B] Note from tsongming :[/B] [I]this is not the same flashall as used on fastboot rom, do not use this for fastboot "flashall.bat full restore)[/I]
[*]Add the line to the middle of the file
[*]fastboot% * flash persist% ~ dp0images \ persist.img || @echo “Flash persist error” && exit / B 1
[*]Save the changes
[*] Go to the file " rawprogram0.xml ", open it using a notepad
[*]Find the line associated with persist
[*]In the section filename = "" enter persist.img in quotation marks , save the changes.
[*]Flash firmware via EDL + authorized account
[/LIST]

EDL Mode and account - Typically you would be able to restore a phone using your own Mi-Cloud Account and EDL. I used Edl in the past and did not have any issues because for one I have had a Miui account for several years, second, I never received any messages about having a special EDL account.

I found a version of MiFlash that does not ask for the Mi Cloud account ( located onon 4PDA) However, you must have an account to download it. Fortunately I do, and since you may not, I downed the file and reuploaded it to my Mega.NZ account ( see below)

Use this Mi Flash since it does not require an account you may be able to flash with the phone in EDL mode

MiFlash : https://mega.nz/#F!pRAymQLa!-aPsmtjc0oC9bPIUYkmCNA

Enter EDL by ADB command or using the LR team Team Twrp

@ Theevanz

Even if all of the options that I list fail, there are still more drastic things that we can try such as QPST, manually editing the IMEI etc.

I would like to not try IMEI edits because its not guaranteed to work and it could damaged the phone for good. However, if nothing else works , people have tried it and repaired there phones successfully.

Also, I am wondering if we will have better luck using older roms. Once this issue is resolved you can install whatever you want.

Finally, it's good that you are persistent, Trial and error is the only way to go when we face these difficult issues, and attempting to resolve it sporadically is a bad idea because we would lose track of what we have done so far.
[Xiaomi Mi 8 Questions & Answers] Theevanz:
Quick question :

From the 4PDA method, How do i enter edl? when i press edl from the LR Team TWRP, it just started to show the mi logo ?? and reboots (I dint have any rom that time) is that edl?
[Xiaomi Mi 8 Questions & Answers] tsongming:
[MENTION=8231530]Theevanz[/MENTION] Edit with the path: for seeing Port 9008

EDL mode is just a black screen, and to know that the computer see the phone you go to control Panel/System/Device manager/Usb or Com/ Port 9008 < Here you see a reference to the open port.

You can also use ADB : adb reboot edl

[MENTION=8231530]Theevanz[/MENTION]

You may need to temporarily turn off antivirus and Firewall . Especially if using Windows 10

One more thing, when you attempted flashing just the persist image extracted from the fast boot.

[MENTION=8231530]Theevanz[/MENTION]

Did you select persist under Mount?
[Xiaomi Mi 8 Questions & Answers] Theevanz:
OK , thanks! Later when i reach home, i try to turn off firewall n antivirus , then i try the TWRP method again. if fails i try the adb method... Also do u think it will be a good idea to install SU and retry all your option 1-5 again?
[Xiaomi Mi 8 Questions & Answers] tsongming:
Yes absolute on Su

Also, for the note pad method , I found this video : https://www.youtube.com/watch?v=Qf0XhhnpQEo

I am going to bed soon so we will need to continue tomorrow night.

Stay positive about it, I am certain that we will get it fixed.
[Xiaomi Mi 8 Questions & Answers] Theevanz:
Yep goodnight , sweet dreams and rest well !!

i did not mount persist, i will mount persist and then install su and try again! Thanks!
[Xiaomi Mi 8 Questions & Answers] Theevanz:
Hey , The option "Install root" is magisk and not su right? Do you have the file for SU?

I have successfully entered EDL and installed the MIFLASH that u provided too . but i keep getting this error (In the picture below)

Is there a way to remove persist write protect?
[Xiaomi Mi 8 Questions & Answers] Leoleo96:
Same try same error... this issue is making me crazy, however thanks to tsongming for his time, patience and help!
[Xiaomi Mi 8 Questions & Answers] sk3lt:
Tried the four options none worked.

I still have no signal without wifi and the device is restarting constantly.

I think he really died.
[Xiaomi Mi 8 Questions & Answers] Theevanz:
Did u mount persist?

If yes then no choice but to Wait for a sol. I hav the same prob also. Just sub to this thread?

Anyways what did u do to get it to this stage? Im not an expert but im curious oni. :confused:
[Xiaomi Mi 8 Questions & Answers] tsongming:
Update : I have no idea how to use this tool yet.

I just read about a tool called : QC Multifire

According to this forum

If firmware has persist.img, but not enabled in XML, QcFire will auto enable it on firmware load.

- Many user face issue to Fix Wifi etc, while flashing firmware, so it must help them now

Be Careful and be sure to research this tool works before using it. ( I have never used it, I am simply attempting to provide another potential resource)

I read on a Mi Community post that repair shops use the QC Fire tool to resolve difficult persist and brick issues.
[Xiaomi Mi 8 Questions & Answers] sk3lt:
Hi,

I think that this problem that is arising is not created by Magisk, as I never had Magisk on my phone and my phone is broken.

I have already flashed persist.img or modem.img I have tried all these options in this post plus some other posts and nothing works.

I also tried this

https://xiaomifirmwareupdater.com/ which in my opinion should have solved it.

The only thing that worked was after many attempts to flash persist I decided to install the xiaomi.eu rom. It was working for four days without a single failure, only then it returned to it.

I do not know what else to do.

I just have to try to flash for edl, but I don’t have an authorized account so I don’t think I can do it and in my country I don’t find any assistance center with an authorized account to do so.

A big thanks to tsongming for all its availability.
[Xiaomi Mi 8 Questions & Answers] tsongming:
The firmware updating is simply the modem and radio drivers and nothing more, it does not restore each partition, for that you would need to use the images rom that I posted. ( See the screenshots attached ) One image is the Image Partitions and the other is Firmware.

I posted it on this thread but just in case here is the link again : http://bigota.d.miui.com/V11.0.6.0.P...fe09c43d5a.tgz

Brother your issue is not a firmware issue, its a security issue : The Persist is partition mounted at /persist. It has ext4 file system. DRM related files, sensor reg file (sns.reg), WiFi and Bluetooth and mac addresses are stored there.

Yeah, you definitely have one of the difficult cases,

I experienced a very similar issue in August and it took days to repair. but I finally fixed it. By the way, I responded to your PM
[Xiaomi Mi 8 Questions & Answers] Theevanz:
Anyone tried this , does it work?
[Xiaomi Mi 8 Questions & Answers] CMBoii:
[MENTION=7672955]tsongming[/MENTION] I've just flashed Orangefox and I can tell you that it's able to backup the persist partition, so you may want to add it in the first post. I've saved my persist partition backup in my pc and google drive.

Thank you!
[Xiaomi Mi 8 Questions & Answers] tsongming:
Thanks

I am not a fan of Orange Fox. because it wiped my data for no reason once, and it has happened to a couple people, including developers as well. ( according to their Telegram posts) However, it will backup persist, so will older versions of official Twrp. It's been since August since I have used it so maybe that bug is resolved now?

Edit: Feb 18, 2020

I annoyed about something when I originally commented and now I strongly regret making the comment about Orange Fox causing Data loss. Yes, I had an issue, but in retrospect, it probably wasn't caused by Orange Fox. I spoke with the developer Darth Jabba today and witnessing how passionate and open he is about wanting to help resolve this problem, I feel terrible, and I should have contacted him rather than making that comment here. I had serious issue, but it was probably caused by something else.

So in hindsight, I disavow that comment and I apologise to Darth Jabba for making the comment and for not contacting him about the issue. If I see anyone else blame Orange Fox, I will suggest that they get in touch with Darth Jabba.
[Xiaomi Mi 8 Questions & Answers] tsongming:
I have been really busy this week and will be busy through the weekend. There may be a couple of other ways to solve this, if so I will add it by Monday or Tuesday.
[Xiaomi Mi 8 Questions & Answers] Leoleo96:
I am think that the only solution Is install the fastboot rom with edl mode, if i miflash in fastboot mode It doesnt overwrite persist partition ... Unfortunatly the mi flash with edl autorisation you post doesnt work right... And i think that After all this try warranty Is no more valid (Aldo it Will be difficult for me beacuse i bought It on gearbest )
[Xiaomi Mi 8 Questions & Answers] tsongming:
You can try this older solution which worked on many phones. I have no idea if it will work on the Mi8. At the end of the day, you persist is still there, it's just encrypted. As long as you have never flashed restored someone else's persist backup it should be restorable. Some people. (you guys) have trouble repairing persist. On the other hand, those instruction have worked for people in the past, including myself, I have had a Miui account for 4 years, I am not sure if that has anything to do with being able to flash from EDL last August.

Any phone method - ( try at your own risK) Empty IMEI, is essentially the same issue.

https://www.theandroidsoul.com/fix-...d-wifibluetooth-issues-restoring-twrp-backup/

If you are out of warranty, it's worth giving it a shot.

Also, I have an extra QCN, if you want to try making a new IMEI. However, I have never tried that myself, instructions can be found easily with Google.
[Xiaomi Mi 8 Questions & Answers] sk3lt:
Someone already tried??
[Xiaomi Mi 8 Questions & Answers] Leoleo96:
Failed It says 'Eraseing Is not allowed for critical partitions'
[Xiaomi Mi 8 Questions & Answers] tsongming:
Here is something else to try : If this fails, let us know.

I read on an old post that resolving partition issue works better when using a Oreo fastboot rom using the methods I posted on the thread? if you google search this issue, you will find that most people were able to resolve it early last year using those same steps.

Oreo Fastboot rom for Dipper

https://bigota.d.miui.com/8.9.20/dip...4af4d59a34.tgz

Although these instructions are very similar to what I have already posted., maybe there is something different?

Please follow exactly step by step : https://xdaforums.com/mi-...ition-t3765643

Use ADB as described in the post and you may not encounter the error message.

To reiterate for anyone new: only use files for Dipper ( Global if you have a global device and Chinese if you have a Chinese Market device)

If this fails, I am out of ideas, for now. I have even searched all of the Chinese tech pages using Google translate and a VPN. But I will keep looking.
[Xiaomi Mi 8 Questions & Answers] Leoleo96:
I'll try as soon as i can and i let you know, thanks

EDIT: the 2 links you provide don't work
[Xiaomi Mi 8 Questions & Answers] tsongming:
[MENTION=8231530]Theevanz[/MENTION] - Use the file below to fix your phone.

Good news, I made a flashable persist solution that I tested with [MENTION=5408699]sk3lt[/MENTION] and it works!

Solution: Flash with TWRP

File: https://mega.nz/#!tZZ1UIiK

Key: ihehHufSds5sKRhOjGf7hwX4BAz7ZeVoi7gK2T4q-kE

To anyone new reading: If My solution helped you, please click Thank you. I just saved you a few hundred dollars so a thanks or buying me a beer via paypal is appreciated and is the motivation for helping people resolve these kinds of issues.
[Xiaomi Mi 8 Questions & Answers] sk3lt:
tsongming a big thanks for your help, the machine continues to run 5 * until momemto,

I hope that everyone can resolve this stupid malfunction, and that everyone makes a donation for you. Thanks
[Xiaomi Mi 8 Questions & Answers] Theevanz:
Ok Thanks!!! ill try when i reach home
[Xiaomi Mi 8 Questions & Answers] Leoleo96:
[MENTION=7672955]tsongming[/MENTION] unfortunatly still have the problem, i hope one day i can donate you for your help but right not solution doesn't work for me.

I detail tell you what i do maybe i make some mistake

Now i'm with a old miui 9 ROM Oreo version

USB Debug Enabled

Unlocked bootloader

TWRP you provide in first page (non Q version means for android version older than Q?)

1. put phone in fastboot mode and connect to PC

2. on Windows PowerShell type --> PS C:\adb> fastboot flash recovery twrp.img

3. PS C:\adb> fastboot boot twrp.img

4. Copy and paste your zip file

5. Intall the packet

6. automaticaly reboot
[Xiaomi Mi 8 Questions & Answers] sk3lt:
Mine failed again, after four days of working properly today it fails again.
[Xiaomi Mi 8 Questions & Answers] Theevanz:
i tried flashing it , flashing it with su installed 1st , changing the twrp (Official and the custom one tat u linked)

Yes . its not working, i think my device is a goner now :crying: ... ill bring it to the service center to see what they say .. if its under 50 SGD ill just pay them but i doubt so .

Even after all. IM STILL SO GRATEFUL for not giving up and mading my day soo many times !! willing to give u a hug for all u done! ;-; feel like crying now oh noooo ...
[Xiaomi Mi 8 Questions & Answers] tsongming:
I hope you made a Twrp backup as we discussed by pm. If you have the backup the repair it takes a minute to restore.

It will fail a few times. But eventually it should last for months at a time.
[Xiaomi Mi 8 Questions & Answers] tsongming:
The flashable patch file is for Android 10. I will make a Pie solution.

Make sure to format storage first then reboot to recovery..

You tried the flashall.bat method?

Use the Twrp that I linked, flash magisk then flash the patch file., Which I s now option 1

I will upload a new pie version tonight when I return home.

If anyone ever flashed restored someone else's Twrp backup persist, none of these solutions will work.

Unless you have some other hardware based issue, one of these options should eventually work.

If anyone lives in the US. You could mail the phone to me and I will try to fix it for you
[Xiaomi Mi 8 Questions & Answers] Leoleo96:
I can also try with android 10, but i dont find a ROM for the global version with android 10