[Guide] About repairing/fixing the persist partition

Search This thread

Allx0021

New member
May 18, 2019
2
0
method 1- adb commands: working on redmi note 7 lavender, everything returned to normal, even wifi, although the proximity sensor and varometer do not work or maybe this device does not have them, and as expected the DRM is in L3. THANK YOU SO MUCH Yuki1001
 

pndwal

Senior Member
Is your persist partition broken? If so just flash it. Don't think too much. The phone works normally is the first thing. And sorry, I don't know if it will effect the widevine DRM security level. Don't use it like a toy. Persist means "persist", its data should not be changed after shipping. Only flash it when your persist partition is broken or cannot works properly.
Hi Yuki1001

Great guide / fix!

Could you please do us (all those concerned with restoring Widevine DRM L1 security / TEE for HD video streaming after persist corruption) a favour if you still have this device? (I have RN8T.)

Please can you install and open DRMInfo app, and just say if Security level is L1 under Widevine CDM?

Many thanks, PW 👍
 

Yuki1001

Senior Member
Hi Yuki1001

Great guide / fix!

Could you please do us (all those concerned with restoring Widevine DRM L1 security / TEE for HD video streaming after persist corruption) a favour if you still have this device? (I have RN8T.)

Please can you install and open DRMInfo app, and just say if Security level is L1 under Widevine CDM?

Many thanks, PW 👍
Hello pndwal:

I still have RN8 (as one of my backup phones) because it has the ability to try out anything without interrupting my work. Flashing persist is necessary when your persist partition corrupts which may cause sensors fail. Your DRM level changes to L3 at the time you unlock the bootloader.

BR.
 
Last edited:
  • Like
Reactions: pndwal

pndwal

Senior Member
Hello pndwal:

I still have RN8 (as one of my backup phones) because it has the ability to try out anything without interrupting my work. Flashing persist is necessary when your persist partition corrupts which may cause sensors fail. Your DRM level changes to L3 at the time you unlock the bootloader.

BR.
But it seems most MIUI devices don't actually lose Widevine L1 security (for decoding HD in TEE) with bootloader unlock; only if persist is corrupted... That's why I wondered if your fix, particularly 1) Restore from persist.bak, restores L1...

I have Redmi Note 8T, stock, rooted... Always had L1:
IMG_20220428_212126.jpg

🙂 PW
 
  • Like
Reactions: pnin

Yuki1001

Senior Member
But it seems most MIUI devices don't actually lose Widevine L1 security (for decoding HD in TEE) with bootloader unlock; only if persist is corrupted... That's why I wondered if your fix, particularly 1) Restore from persist.bak, restores L1...

I have Redmi Note 8T, stock, rooted... Always had L1:
View attachment 5600539
🙂 PW
My RN8 is obviously L3.

At that time I had only thought my phone was damaged, with strong nervous I found the persistbak and did a dd command to restore the persist. Then I'd like to help everyone who did something same with me to get out of such situation with an easy solution. Then I made these flashable zip files and uploaded to the thread.

I've lost my original persist/persistbak backup and have overwritten the 2 partitions for many times so my phone will last L3 forever. But if you didn't touched persistbak, do a backup of its raw data to a safe place in order to restore your own unique image, instead of a generic persist.img.


The generic persist.img is only for emergency situation, but it's surely a way to fix, isn't it?


Actually I seldom touch DRM content. I buy DVDs and CDs for watching films and listening to music.
 
Last edited:
  • Like
Reactions: pndwal

pndwal

Senior Member
My RN8 is obviously L3.

At that time I had only thought my phone was damaged, with a strong nervous I found the persistbak and did a dd command to restore the persist. Then I'd like to help everyone who did something same with me to get out of such situation with an easy solution. Then I made these flashable zip files and uploaded to the thread.
Yup... Thanks
I've lost my original persist/persistbak backup so my phone will last L3 forever. But if you didn't touched persistbak, do a backup of its raw data to a safe place in order to restore your own unique image, instead of a generic persist.img.

The generic persist.img is only for emergency situation, but it's surely a way to fix, isn't it?
I lack experience with this, but as I understand it, generic image won't change existing device-specific (unique) data / numbers, whereas device-specific backup will... So I guess either should fix basic corruption, but you wouldn't want to flash device-specific persist on a different device...

I may also be wrong about this! 😝

I've learnt a bit about Widevine security from posts in Magisk General Discussion and other threads, and note it's implementation seems to vary a lot across OEMs.

Eg, on OnePlus and other, widevine itself seems to poll SafetyNet, and L1 is lost on unlocking bootloader, but can be restored w/ SafetyNet passing by means of Universal SafetyNet Fix module etc... On MIUI, other users report that like RN8T, their devices retain L1... It may be that only corrupted persist breaks this...

- https://forum.xda-developers.com/t/magisk-general-support-discussion.3432382/post-86770675
- https://forum.xda-developers.com/t/magisk-general-support-discussion.3432382/post-86771223
- https://forum.xda-developers.com/t/magisk-general-support-discussion.3432382/post-86771507
Actually I seldom touch DRM content. I buy DVD and CDs for films and music.
Good... Is L3 Widevine the only persist related issue you are aware is remaining? PW
 

Yuki1001

Senior Member
Is L3 Widevine the only persist related issue you are aware is remaining? PW

In fact it is related to sensors and carrier network (and more). Widevine Security Level is not the point to talk. Obviously, there is no way we can accept the carrier network and sensors stop working.


generic image won't change existing device-specific (unique) data / numbers, whereas device-specific backup will... So I guess either should fix basic corruption, but you wouldn't want to flash device-specific persist on a different device..

Yes. The generic image only contains some basic sensors' startup data. But it's a complete filesystem image so it will overwrite your all previous data in persist partition. Flashing the image is not an incremental operation to the partition.

Exactly, the DRM security key is stored in persist partition. Only untouched persist and persistbak after shipping include the DRM Decryption Key.

It's consistent with the posts what you mentioned. So if you lose your device-specific persist.img backup and persistbak (the security key), you will lose L1 forever.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Hi Yuki1001

    Great guide / fix!

    Could you please do us (all those concerned with restoring Widevine DRM L1 security / TEE for HD video streaming after persist corruption) a favour if you still have this device? (I have RN8T.)

    Please can you install and open DRMInfo app, and just say if Security level is L1 under Widevine CDM?

    Many thanks, PW 👍
    Hello pndwal:

    I still have RN8 (as one of my backup phones) because it has the ability to try out anything without interrupting my work. Flashing persist is necessary when your persist partition corrupts which may cause sensors fail. Your DRM level changes to L3 at the time you unlock the bootloader.

    BR.
    1
    Hello pndwal:

    I still have RN8 (as one of my backup phones) because it has the ability to try out anything without interrupting my work. Flashing persist is necessary when your persist partition corrupts which may cause sensors fail. Your DRM level changes to L3 at the time you unlock the bootloader.

    BR.
    But it seems most MIUI devices don't actually lose Widevine L1 security (for decoding HD in TEE) with bootloader unlock; only if persist is corrupted... That's why I wondered if your fix, particularly 1) Restore from persist.bak, restores L1...

    I have Redmi Note 8T, stock, rooted... Always had L1:
    IMG_20220428_212126.jpg

    🙂 PW
    1
    What method you mean ? persistbak or the zip ?
    The persistbak.... I have messed up the persist.img backup file. Didn't knew there was a backup partition.
    1
    But it seems most MIUI devices don't actually lose Widevine L1 security (for decoding HD in TEE) with bootloader unlock; only if persist is corrupted... That's why I wondered if your fix, particularly 1) Restore from persist.bak, restores L1...

    I have Redmi Note 8T, stock, rooted... Always had L1:
    View attachment 5600539
    🙂 PW
    My RN8 is obviously L3.

    At that time I had only thought my phone was damaged, with strong nervous I found the persistbak and did a dd command to restore the persist. Then I'd like to help everyone who did something same with me to get out of such situation with an easy solution. Then I made these flashable zip files and uploaded to the thread.

    I've lost my original persist/persistbak backup and have overwritten the 2 partitions for many times so my phone will last L3 forever. But if you didn't touched persistbak, do a backup of its raw data to a safe place in order to restore your own unique image, instead of a generic persist.img.


    The generic persist.img is only for emergency situation, but it's surely a way to fix, isn't it?


    Actually I seldom touch DRM content. I buy DVDs and CDs for watching films and listening to music.
  • 24
    Disclaimer: I am not responsible for the results of any of these operations.


    Everyone knows that the persist partition is responsible for sonsors and carrier network etc. Once this partition is failed or lost, your phone will go wrong. I just faced, then solved the problem and I want to share the solution that could maybe help other persons.

    This was how it happeded:
    While I was flashing the phone, I erased the partition called "persist" accidently. When I was trying to flash the persist partition, the phone returned a message said that you can't flash the controlled partition. I suddenly relized something bad happened. Then I reboot the phone and find that many sensors stopped working. But the worst thing is the carrier network signals lost. I want to contact the service center at first. But I think as long as the phone is unlocked, there are tons of possibilities to fix it, unless it's hard-bricked. So I wanted to try to fix the partition.

    As we know, Xiaomi phones have backup partitions for most of the important partitions. For example, vbmeta and vbmetabak partitions. The vbmetabak usually is the backup of vbmeta. This persist partition also has a backup partition called "persistbak". This backup partition can be used to repair the persist partition. There are 2 ways to fix the persist partition. Choose the method you preferred.


    1. This way is for users have erased the persist partition, but haven't modified/erased the persistbak partition. If you don't want to type commands just use method 2.
    Go to fastboot, flash the twrp recovery first. Then hold the POWER and VOLUME UP to force the phone boot to twrp recovery. Connect the phone to your PC and open adb command window. Type the following commands in order:

    adb shell

    cd /dev/block/by-name

    ls -all

    Check the output, find the partitions called "persist" and "persistbak". Remember the blocks corresponding to these two partitions. They should be similar to "mmcblk0p**". Once you know these correspondences, you can restore the persist partition immediately. For example, the persist partition and persistbak partition correspond to mmcblk0p$$ and mmcblk0p%% respectively (persist---->mmcblk0p$$ and persistbak---->mmcblk0p%%). Run this following command to restore your persist partition:

    dd if=/dev/block/mmcblk0p%% of=/dev/block/mmcblk0p$$

    Note: You need to replace "mmcblk0p$$" and "mmcblk0p%%" with the real partition block name.

    Now the persist partition has been fixed/restored. Reboot your phone to system and check whether sensors and carrier network etc. all work fine.


    2. This way is for users that have erased persist partition and persistbak partition or can't restore the partition using method 1. Also, this method is a universal and easy way to fix both persist partition and persistbak partition. It doesn't need to type any command but only a swipe.
    I have made the persist partition repair tool for both global version and Chinese version. Both of them are in attachments. These tools make the repair process very easy. Both flashable zip files are tested on my Redmi Note 8 and they work fine.
    I have also posted them to Mi Community.
    Flash the repair tool in attachment. Choose the right file and flash it.
    Now the persist partition and persistbak partition have been fixed/restored. Reboot your phone to system and check whether sensors and carrier network etc. all work fine.


    If you think it's useful, please click the "Like" button.
    2
    Does this fix "device storage corrupted" error?
    Actually I have this error but my sensors, carrier, wifi ... Etc all working great this error still appears. Anyway I think magisk hide config props module damaged my device's persist when I changed the fingerprint then I came back to stock rom and this error happened so my question is: is this process risky Or could cause losing mac or imei? And am I going to lose widevine l1?
    I'm thinking about backing up my current persist before proceeding do you think it's a good idea?

    Yes. It can fix "find device storage corrupted" . You won't lose your imei or mac. At that time I erased the persist partition by a command "fastboot erase persist" accidently. I have tried both method 1 and 2, and the error is no longer appeared.
    About backing up, the persistbak partition is a backup partition for your current persist partition. So if you failed, just restore the persistbak to the main persist partition. And you can also export the raw image of your current persist partition. Of course, the error will appear if you restore the corrupted persistbak.
    1
    Disclaimer: I am not responsible for the results of any of these operations.


    Everyone knows that the persist partition is responsible for sonsors and carrier network etc. Once this partition is failed or lost, your phone will go wrong. I just faced, then solved the problem and I want to share the solution that could maybe help other persons.

    This was how it happeded:
    While I was flashing the phone, I erased the partition called "persist" accidently. When I was trying to flash the persist partition, the phone returned a message said that you can't flash the controlled partition. I suddenly relized something bad happened. Then I reboot the phone and find that many sensors stopped working. But the worst thing is the carrier network signals lost. I want to contact the service center at first. But I think as long as the phone is unlocked, there are tons of possibilities to fix it, unless it's hard-bricked. So I wanted to try to fix the partition.

    As we know, Xiaomi phones have backup partitions for most of the important partitions. For example, vbmeta and vbmetabak partitions. The vbmetabak usually is the backup of vbmeta. This persist partition also has a backup partition called "persistbak". This backup partition can be used to repair the persist partition. There are 2 ways to fix the persist partition. Choose the method you preferred.


    1. This way is for users have erased the persist partition, but haven't modified/erased the persistbak partition. If you don't want to type commands just use method 2.
    Go to fastboot, flash the twrp recovery first. Then hold the POWER and VOLUME UP to force the phone boot to twrp recovery. Connect the phone to your PC and open adb command window. Type the following commands in order:

    adb shell

    cd /dev/block/by-name

    ls -all

    Check the output, find the partitions called "persist" and "persistbak". Remember the blocks corresponding to these two partitions. They should be similar to "mmcblk0p**". Once you know these correspondences, you can restore the persist partition immediately. For example, the persist partition and persistbak partition correspond to mmcblk0p$$ and mmcblk0p%% respectively (persist---->mmcblk0p$$ and persistbak---->mmcblk0p%%). Run this following command to restore your persist partition:

    dd if=/dev/block/mmcblk0p%% of=/dev/block/mmcblk0p$$

    Note: You need to replace "mmcblk0p$$" and "mmcblk0p%%" with the real partition block name.

    Now the persist partition has been fixed/restored. Reboot your phone to system and check whether sensors and carrier network etc. all work fine.


    2. This way is for users that have erased persist partition and persistbak partition or can't restore the partition using method 1. Also, this method is a universal and easy way to fix both persist partition and persistbak partition. It doesn't need to type any command but only a swipe.
    I have made the persist partition repair tool for both global version and Chinese version. Both of them are in attachments. These tools make the repair process very easy. Both flashable zip files are tested on my Redmi Note 8 and they work fine.
    I have also posted them to Mi Community.
    Flash the repair tool in attachment. Choose the right file and flash it.
    Now the persist partition and persistbak partition have been fixed/restored. Reboot your phone to system and check whether sensors and carrier network etc. all work fine.


    If you think it's useful, please click thanks button.
    not to hate or dislike or be rude or anything... but people will lose Widevine L1 support by this method... so if anyone doesn't want HD videos on netflix etc, go ahead with this method.. otherwise don't even touch persist partition.
    1
    Hi Yuki,

    Greetings from India, hope you and your family are doing well.

    I own a Redmi K20 (davinci). I had installed Pixel Experience rom, which I didn't like and wanted to roll back to stock rom. But without reading the guide to flash fastboot rom, I flashed the back up I had taken via TWRP. Apparently, my phone was bricked and I had to enter edl mode via cmd and flash the stock rom which showed some error, but the phone booted to stock rom. Everything is working fine, even the touch-fingerprint sensor is working. All the other sensors aren't. I tried a lot of things, but to no avail. I took my device to the official service centre, they couldn't fix the sensors' issue.

    A couple of days ago, I stumbled upon your post on Redmi 8-sensors-not-issue solution. Can I use the same tool to fix the persist partition on my phone? I had read one of your replies saying: specific phone's persist.img should be extracted from the fastboot rom and replaced with one in your tool.

    It would be a great help if you could guide me.

    Many thanks
    my experience for you:i succedd in flashing the persist.img into my note8,but sensor still worked abnormally,at last i flash persist.img from the oldest ver fastboot rom when i bought ,it worked
    1
    I've been having camera issues with my Poco citrus device for the past year I even reflashed the device twice and was thinking of buying a new camera when I stumbled across this thread, my question is isn't IMEI and MAC stored in persist how can the same image be used across devices (same model obviously) should I try with overwriting persist persistback or use a persist image from mi, there are quite a few images out now do I flash the oldest or current Miui 12.5 ROM image?
    1. IMEI and MAC addr are not stored in persist/persistbak. They are stored in safer places where you never need to touch.
    2. Persist and persistbak images could be flashed at any time when needed.
    3. You must use your own persist.img which made for your device to write to 2 partitions.