No sensors working. Persist.img not restoring them properly?

RikoF1

Member
Feb 26, 2010
17
4
0
Hi,
I updated to xiaomi.eu 8.10.25 via dirty flash and it was working properly.. After that I thought that I should update it with a clean format as I have been dirty flashing since miui 10 first dev updates...
The problem is after updating it via clean install my persist.img is not working properly. My sensors aren't getting pickup by the system. I've tried flashing the persist.img that comes on global V9.6.2.0 but it stays the same. Any help would be appreciated. Thanks

EDIT: as of now, after flashing the img 10 times, the magnetometer is working although the others sensors still aren't.
I tried installing it via adb console but I get an error saying that it cannot be written (both on erasing and installing). My device has an unlocked bootloader..
 

zaqm

Senior Member
Apr 8, 2017
406
137
43
Go to Mount in TWRP and put a tick on the Persist. Then go to Install/Install as an image and choose your persist.img
Good luck, zaqm
 

jeffersonlmartins

New member
Nov 2, 2018
3
1
0
Hi everyone,
My Mi Note 3 also there are some problems with sensors after upgrading to Miui 10 (10.0.4.0) EU. So, I saw in the TWRP that the partitions show only: Cache, Data, System, Vendor and USB-OTG. It doesn't have the partition persist.
I changed some ROMs, China Miui 10 Stable, Miui 10 EU stable, Miui 9.6.2 Stock ROM, but, none works =/
If I try to fastboot with persist.img o the CMD (from windows), i can't, because shows this message:

FAILED (remote: Partition is write protected)

(in this case, i was erasing the persist, but works the same when i was burning the persist). My bootloader already unlock and i can see this one on the system normally.

Somebody can help us, please?
@zaqm didn't work for me, thanks for helping.
 
Last edited:

zaqm

Senior Member
Apr 8, 2017
406
137
43
Double check the instructions on the video because even a dot or a space at the wrong place can lead to an error. I can't think of other methods to fix this problem. Which version of TWRP are you using?
 
  • Like
Reactions: jeffersonlmartins

jeffersonlmartins

New member
Nov 2, 2018
3
1
0
Double check the instructions on the video because even a dot or a space at the wrong place can lead to an error. I can't think of other methods to fix this problem. Which version of TWRP are you using?
My TWRP's version is 3.2.3.1.
I checked the video and there isn't space or dot. The method works, but didn't resolve the problem, sensors still not working.
I saw that i don't have the persist partition on twrp, i saw the fstab (/etc/fstab by twrp's terminal) and doensn't have any info about persist, shows only:
/dev/block/mmcblk0p67 /cache ext4 rw 0 0
/dev/block/dm-0 /data ext4 rw 0 0
/dev/block/mmcblk0p69 /system ext4 rw 0 0
/dev/block/mmcblk0p68 /vendor ext4 rw 0 0
/usb_otg vfat rw 0 0
@zaqm, do you have twrp installed on your smartphone? Could you check the content in /etc/fstab via terminal, please?
I want to confirm if my fstab partitions is alright.
Thank you so much
 

jeffersonlmartins

New member
Nov 2, 2018
3
1
0
I`m on official TWRP and for this location it shows Permission denied.
Maybe you're with locked bootloader.

So, I fixed the problem. I checked the video again and there is a difference between the ROMs. My rom does not point the value equal to the video (there are some diffences, variables and strings, thanks for the suggestion @zaqm).
I inserted the value in the filename field and added a line in the file flash_all; the line was added above the system.img line.
Line corrected in rawprogram0.xml:
<program SECTOR_SIZE_IN_BYTES="512" file_sector_offset="0" filename="persist.img" label="persist" num_partition_sectors="131072" partofsingleimage="false" physical_partition_number="0" readbackverify="false" size_in_KB="65536.0" sparse="true" start_byte_hex="0x14000000" start_sector="655360"/>

Line added in flash_all (above the system.img line):
fastboot %* flash persist %~dp0images\persist.img || @ECHO "Flash persist error" && exit /B 1

After this modifications, i followed the video again and finally... it's working now!!
Thank so much for helping us, @zaqm!!
 
  • Like
Reactions: RikoF1

zaqm

Senior Member
Apr 8, 2017
406
137
43
Maybe you're with locked bootloader.

So, I fixed the problem. I checked the video again and there is a difference between the ROMs. My rom does not point the value equal to the video (there are some diffences, variables and strings, thanks for the suggestion @zaqm).
I inserted the value in the filename field and added a line in the file flash_all; the line was added above the system.img line.
Line corrected in rawprogram0.xml:
<program SECTOR_SIZE_IN_BYTES="512" file_sector_offset="0" filename="persist.img" label="persist" num_partition_sectors="131072" partofsingleimage="false" physical_partition_number="0" readbackverify="false" size_in_KB="65536.0" sparse="true" start_byte_hex="0x14000000" start_sector="655360"/>

Line added in flash_all (above the system.img line):
fastboot %* flash persist %~dp0images\persist.img || @ECHO "Flash persist error" && exit /B 1

After this modifications, i followed the video again and finally... it's working now!!
Thank so much for helping us, @zaqm!!
My bootloader is unlocked and don't know why it says that - doesn't matter. I'm glad that you fixed your issue and don't wipe Persist next time ;)
 
  • Like
Reactions: jeffersonlmartins

keteflips

Senior Member
Sep 4, 2008
79
6
0
I restore persist.img but there nothing inside /persist/sensors :(

The correct way its in twrp.
First transform the img file in to a EXT4 raw file with simg2img

simg2img.exe -i persist.img -o persist_EXT.img

Then in TWRP ADB:

make_ext4fs /dev/block/bootdevice/by-name/persist
dd if=/sdcard/Download/persist_EXT.img of=/dev/block/bootdevice/by-name/persist

The all works, but no data inside /persist/sensors

If someone can zip the content and upload it :)
 

RikoF1

Member
Feb 26, 2010
17
4
0
I was trying some of the answers here and now my phone is stuck in EDL... Let's see if I can fix this.

EDIT: Got it out of EDL but now my phone is running MIUI without twrp, so like a factory reset. The sensors are not working still lol
 
Last edited:

RikoF1

Member
Feb 26, 2010
17
4
0
Maybe you're with locked bootloader.

So, I fixed the problem. I checked the video again and there is a difference between the ROMs. My rom does not point the value equal to the video (there are some diffences, variables and strings, thanks for the suggestion @zaqm).
I inserted the value in the filename field and added a line in the file flash_all; the line was added above the system.img line.
Line corrected in rawprogram0.xml:
<program SECTOR_SIZE_IN_BYTES="512" file_sector_offset="0" filename="persist.img" label="persist" num_partition_sectors="131072" partofsingleimage="false" physical_partition_number="0" readbackverify="false" size_in_KB="65536.0" sparse="true" start_byte_hex="0x14000000" start_sector="655360"/>

Line added in flash_all (above the system.img line):
fastboot %* flash persist %~dp0images\persist.img || @ECHO "Flash persist error" && exit /B 1

After this modifications, i followed the video again and finally... it's working now!!
Thank so much for helping us, @zaqm!!
SENSORS WORKING, unfortunately lost my rom and all my files for being dumb. Nevertheless, thank you!
 

brandon7gr

Senior Member
Apr 5, 2008
70
7
0
Athens
Maybe you're with locked bootloader.

So, I fixed the problem. I checked the video again and there is a difference between the ROMs. My rom does not point the value equal to the video (there are some diffences, variables and strings, thanks for the suggestion @zaqm).
I inserted the value in the filename field and added a line in the file flash_all; the line was added above the system.img line.
Line corrected in rawprogram0.xml:
<program SECTOR_SIZE_IN_BYTES="512" file_sector_offset="0" filename="persist.img" label="persist" num_partition_sectors="131072" partofsingleimage="false" physical_partition_number="0" readbackverify="false" size_in_KB="65536.0" sparse="true" start_byte_hex="0x14000000" start_sector="655360"/>

Line added in flash_all (above the system.img line):
fastboot %* flash persist %~dp0images\persist.img || @ECHO "Flash persist error" && exit /B 1

After this modifications, i followed the video again and finally... it's working now!!
Thank so much for helping us, @zaqm!!
YES YES YES and YES!! I had the same problem and this method works! Damn you are genius. :)

If you have the same problem, I am uploading the fixed files that I used so you don't need to make them from the beginning.

You have to follow the instructions of this video https://www.youtube.com/watch?v=Qf0XhhnpQEo … but don't forget that in the end you have to choose in Xiaomi Mi flash tool to use the file flash_all.bat (and the option clean all and NOT clean all and locked) !!! Be careful with this!!
 

Attachments

Last edited:

rattleb0x

New member
Aug 23, 2017
4
0
0
London
Can't flash persist.img

Hi,

Same problem with sensors here.
Tried to flash persist.img with TWRP but issue continues.
Tried flashing with MiFlash but I get an error message "Unauthorized for this operation"

Any ideas anyone?

I've also mounted the persist partition with TWRP and found a single file called "sensors_settings" with no data in it. Any chance someone can send me the contents of this partition from a working phone?
I would really appreciate the help.


Thanks,
 
Last edited:

alfa0ind

Member
Dec 20, 2018
8
2
0
i found this tutorial and this work perfectly

Hi,

Same problem with sensors here.
Tried to flash persist.img with TWRP but issue continues.
Tried flashing with MiFlash but I get an error message "Unauthorized for this operation"

Any ideas anyone?

I've also mounted the persist partition with TWRP and found a single file called "sensors_settings" with no data in it. Any chance someone can send me the contents of this partition from a working phone?
I would really appreciate the help.


Thanks,
This is the tutorial link :
https://alfa-roid.blogspot.com/2019/05/fix-sensor-mi-note-3-jason.html