yashsingh1/xdaforums huggingface dataset:
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] ManyPhones:
Device keeps booting into bootloader after Nandroid Restore

Hi people,

upgraded from LOS 14.1 to 15.1 today.

Did a full Nandroid backup of all partitions to USB OTG with TWRP 3.1.1-0.

Did NOT backup external SD card

Updated recovery to TWRP 3.2.1-0

Booted into new recovery.

Wiped system partition only.

Flashed LOS 15.1 build 2018-06-06, then Open Gapps 8.1 / ARM64 / pico, wiped ART cache/Dalvik

then rebooted => smooth start into system.

System 15.1 then said: external SD card failure - probably due to the previous encryption by 14.1?

So, I want to restore Nandroid backup of 14.1 to get access to encrypted data on external SD card.

(On which partition are the encryption keys stored?)

1st try: restored only System partition of 14.1 Nandroid backup => phone boots into bootloader, not system!

2nd try: restored System, Data and Cache partitions of 14.1 Nandroid backup => phone boots into bootloader, not system!

Now, what...?

Help welcome!
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] ale.giordano:
hi! I've flashed the last rom build. This rom don't have last kernel version. It's possible flash the last kernel version 3.18.112?
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] RCstZero1:
Do I need to flash Gapps between updates?
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] eliezerjk90:
If you flashed LOS 15.1 then the vendor partition of your device has been altered. Considering that you use old version of twrp and not the modified one, you can't restore that partition with your backup (afaik only the modified twrp can wipe/backup/restore vendor partition). Most likely, you have to use flash miui rom with mi flash to restore vendor partition (I'm not 100% sure whether it works, so if someone has idea feel free to correct me). After that, you can try to flash LOS 14.1
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] RohanRKO:
Can't mount /Data

Hello guys! i am new here and trying to flash a custom rom for the first time! Somehow i managed to boot into TWRP but can't format the device because the "/data" partition is not mounted (Failed to mount "/Data"). And that is why I can't take a backup of data or format the device. I am still at twrp, so how to fix that? Should i reboot into the system and try again or there is some other way.

I think after rebooting my twrp will be reset by MIUI with their recovery, or I might go into a boot loop :confused::crying:

What to do now? Thanks in advance.

[P.S : Tried repairing the partition but ended with Error : 8, also tried changing the partition format but same error occurred.]
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] k3lcior:
After flashing TWRP in fastboot did you "fastboot boot twrp_image_name.img" ?

You must do it, then Format DATA and then reboot to recovery again.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] RohanRKO:
Yes of course i did that, without that command MIUI always resets to default recovery. What to do now? Can i just boot into system now without facing problem? I haven't done anything yet except backup.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] k3lcior:
Yeah restart to recovery.

When you are trying to format Data you are confirming it with "yes" ? Just making sure u are not trying to wipe it.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] RohanRKO:
Yes i am typing yes and hitting enter. I rebooted to recovery and tried to format again and this time the format was successfull but there were some error like can't mount system, can't unmount data etc. So i rebooted back to system and now stuck at MI logo. :crying::crying::crying:
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] k3lcior:
Just wipe System/Data/Dalvik/Cache and flash the ROM you want. To enter recovery hold VOL+ & Power.

You allowed to modify system yes?
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] RohanRKO:
I read that without wiping data i will get encryption error if trying for the first time. But thankfully i rebooted to twrp and now i can wipe or format everything, seems to be working fine, now i am installing the firmware, then the rom and gapps, wish me luck! :p:D

Thanks for the help...
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] anur@g:
Default browser should not get removed as a result of aroma GApps as it has a different package name than that of any of the GApps.

I use nano GApps. That's enough.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] RohanRKO:
Success

Just Successfully installed LOS today, i am glad that i tried it. Running totally smooth, fingerprint reader is on the slower side but beside that almost everything is excellent. Till now the only problem i faced is with auto read mode (the orange tint) and auto accent color based on day or night. I think it is not detecting day or night properly, maybe counting after 12 am as day. :confused:

Also, unfortunately i installed the previous build instead of the current 06/06/18 build, so how can i dirty flash the current build? Just clear dalvik cache and nothing else right? All the apps and gapps will be present after dirty flashing right?

I am grateful to the OP and all the members who helped me install this for the first time. :good::):D You are awesome guys! :laugh:
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] anur@g:
It works bro. Turn on location and internet and then toggle the setting two to three times (from manual to automatic) and then restart your device > unlock the lock screen > lock it again and then unlock > Now everything should work fine.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] ManyPhones:
Dear eliezerjk90, thank you!

I am not sure, what exactly you mean by "old version of twrp" and "modified one".

The backup made with TWRP 3.1.1-0 of LOS 14.1 consists all possible selections, i.e. including the items System, Data (ecl. storage), Cache, Cust, Recovery, Boot, EFS, Firmware, Persist, Bootlaoder and EFS. - Isn't the vendor partiton (in the previous state that was used with 14.1 before flashing 15.1) included in these?

Btw, after updating to TWRP 3.2.1-0 and flashing 15.1 I made another backup only of the System partition, so I can go back to to LOS 15.1. at least - does that help in any way?

And I thought, that TWRP 3.2.1-0 should be backwards-compatible to TWRP 3.1.1-0, i..e. shouldn't I be able to restore any backup made with TWRP 3.211-0 also with TWRP 3.2.1-0? I mean, I can also roll back to TWRP 3..1-0 ^, cant't I?

Im a bit confused....
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] RohanRKO:
Wow! It's really working now, appreciate it very much. :laugh:
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] eliezerjk90:
The thing is, vendor partition is not normally touched by official twrp. If you want to do something with vendor partition, you need a modified twrp 3.2.1.0 (not the official one) which can be found somewhere in this thread (the link in OP is death, but a search in the thread will give you the mirror link).

In conclusion, I don't think that your backup contain the stock vendor image, which is needed if you want to revert to LOS 14.1.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] krishna.rag:
But it has an option to remove the system apps.

I tried reflashing the rom with newer version of gapps package (aroma) but still the same.

Btw can you confirm, Are you able to change the ringtone to a custom one?
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] rn4Nlos:
I ask the magical general support thread:

Is magisk with treble support for mido (Redmi Note 4 Snapdragon) available yet?

Then somebody replied:

Try it out. In theory there shouldn't be problems with Trebble, just try if latest stable/beta is working. If not make a bug report so it can be added as soon as possible.

Can anyone who faces problem file report to them? They seemed to not understand the situation.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] francogp:
If you modify the official release.. this thread can't do anything for you. I'm on official ROM version without ANY crash.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] Not Available:
Official one isn't working with Treble Rom, use modded magisk instead ! Google to get the link or maybe some Thanks Hunter will provide you the link
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] eliezerjk90:
Surely they don't understand the situation. It's pretty specific to mido. The best place to get support for mido's LOS is this thread. That being said, you have to use modified magisk otherwise it will cause bootloop.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] BLeaCHeR:
Hi

Where i can find the TWRP with treble support? the link on the first post is broken?

wich GAPPS i have to use with this build?

thanks in advance
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] Sachin:
TWRP : https://www16.zippyshare.com/v/P6z3uBng/file.html

Gapps : OpenGapss.org, choose arm64.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] kcarlo13:
What do you mean by modify? I use a different kernel, does that affect the crashing?
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] francogp:
OF COURSE that it can crash the programs. The kernel is the soul of your ROM. That's why this thread does not allow bug reports from modified version of it (like other kernels, hacks, etc).
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] kcarlo13:
Oh, cool. Thanks ? uhmm, last question, how to get back to the stock kernel? Hahaha. Newbie here. Thanks!
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] eliezerjk90:
Reflash the rom.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] nparte77:
Apps Crashing /F:C

Social Media Apps Crashing on latest build

Clean install done

-Instagram

-Facebook

(Restoration by Titanium Backup)
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] ImNotThere:
* instagram crash Visit here

* facebook, you can try delete app data and cache. if not working, reinstall from playstore

I don' think it's too horrible kkkk
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] lguti:
I could be wrong, but I think Vendor partition is useless on any AOSP based ROM prior to Oreo, so it doesn't matter if the recovery uses this as vendor or Cust on LOS14.1 or older. Only MIUI needs that It to be Cust.

I don't what is wrong with the nandroid backup of

ManyPhones, but I doubt It depends on Cust/Vendor partition state.

I would start over and flash MIUI with miflash, clean flash LOS14.1, and then I would restore the nandroid backup.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] Crazy2ashish:
There is a bug in network setting i have 2 sim Jio and BSNL in this when I switch internet from BSNL to Jio then I cannot make calls from the the BSNL network but I can receive calls from BSNL . Please solve this issue
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] sharneil:
Firmware request

Hello [MENTION=6070905]abhishek987[/MENTION]...

I am using redmi note 4 with lineage 14.1 mido installed according to your instructions for that update. There you said about flashing corresponding firmware. Which was useful because it shows "error 7" if we installed rom without flashing the firmware.

Now to install 15.1... it says to go from 14.1 to 15.1, you have to do it manually. And if we tried to install rom 15.1 without firmware, then it shows "error 7" again.

So please inform about the firmware required while installing ''official Lineage 15.1 mido for Redmi Note 4" and where to get it.

Thank You

Please Reply ;)
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] kanatoly:
Error 7 is usually because of old TWRP recovery, make sure you use latest recovery, this one for example

https://www16.zippyshare.com/v/P6z3uBng/file.html
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] majod1:
LOS 15.1 0606 I have problem managing my fingerprints, I can add as much fingerprints as I want in Settings - Security & privacy - Fingerprint, but deleting doesn't remove them from the list. I tried to delete all of my fingerprints, then restart the phone and I couldn't unlock it with a fingerprint, so I went to the settings again but there is still one fingerprint registered. Is this LOS or Gapps related problem?
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] RealAnmolSingh:
I know that I shouldn't be asking it but I can't resist myself so here it goes. Do you have any idea in terms of time period when goodix will be fixed because ai really really really want to use this rom but I can't because of goodix. Apologies for asking this again.

Thanks
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] nirwansingh:
Exams of maintainer finished today. He he will now work on Goodix fix. Please have patience.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] RealAnmolSingh:
Alright bro. Thank you
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] nayneshdev:
AFAIK, we would need a highly skilled programmer who could write/port the goodix kernel module(if that is the issue)...till then be happy with what xiaomi offers
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] aayushARM:
I get a zero as output in terminal, does that mean I'll be well off w/o fix?
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] sunil1304:
Worked fine
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] Nirav Tailor:
Format data wipe internal storage so can I install rom from otg pendrive..?
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] bhanu saini:
Please post some as so that I can verify
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] PriPhaze:
Yea, this is making me wanna sell my note 4 and get something else because Xiaomi advertise their phones with things like "Sony camera sensor IMXblah blah" but irl they use even 4 different camera sensors and that goes also for fingerprint sensors. They should stick with one manufacturer for each thing.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] pratyush2173:
For the people with network drops:-

It seems to me that this isn't a firmware issue but instead a software one. The likely reason behind it is the Google Dialer and its companion apps i.e. contacts and messages.

To explain how I got this fixed:

At first, I used the Aroma package from opengapps with this ROM only to end up experiencing frequent network drops along with a "This device is not supported and phone calls may not work properly" message whenever I entered the dialer.

Whatever I tried, I couldn't get that resolved, so I ended up clean flashing the Gapps package included in this thread's OP that has the ported Google Dialer alongwith the messages and contacts app, resulting in the fix.

To confirm that this has been the real culprit behind this, I tried installing the Dialer (Phone on PlayStore), Messages, Contacts app from the PlayStore and the network drops started all over again. As soon as I removed the updates to those apps, the drops stopped.

( Remember, updating any single one of those three will result in network drops coming back.)

So, instead of flashing different firmwares, try with clean flashing the included gapps.

I won't be able to resolve your queries since this is in itself a trial and error solution. Though, be sure that this isn't a firmware issue.

Edit: It's just the Phone and Contacts app, Messages is irrelevant to network drops and can be installed/updated from PlayStore.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] neokragu:
yes, and from sdcard also.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] jay626:
anyway to stop headsup notification..?

---------- Post added at 03:18 AM ---------- Previous post was at 03:16 AM ----------

yes you can after that mount otg from twrp otion and than flash.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] dhsomani:
Recently installed Facebook and messenger from play store, signal dropping starts very frequently near to continuous and phone heats up, and after uninstall it become rare and only drops when i try to call or open dialer app..so i think whenever CPU is under load problem occurs.!

Ps:- just to inform.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] chiangkl:
this rom is great! I like redmi note 4 with the latest android.

The only feature I missed from MIUI is Dual App. Is Dual App an Android feature? Or, Any workaround?

Thanks
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] anak1n:
Try Parallel Space

https://play.google.com/store/apps/details?id=com.lbe.parallel.intl&hl=en
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] Gurniwa:
check block visual disturbances under do not disturb preference
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] 1lyharry:
I have been using this rom for 2 weeks. Except for Jio LTE connection problem, this is very stable.

Y'day, I faced a problem. The screen went blank seconds after bootup. Logcat showed Android Runtime StackOverflowError. Dirty flash did not help. I assumed it was ROM issue and clean installed RR Nougat.

But it looks like bug in Oreo. This only happened since I updated "Swipe For Facebook Pro" to 7.2 version. The problem is mentioned here.

Wish I saw this link before reverting ROM :(.

If anyone else faces the same issue just uninstall the recently updated apps through adb and reboot.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] Kazinadim87:
Can anybody provide release notes of this rom?
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] ZZhao0809:
Dear Sir

Could you add Night Mode into next build?

In the evening, the yellow screen makes me eyes feel comfortable.:):good:
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] soreldc:
+1:svetius:
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] eliezerjk90:
Here some read

https://xdaforums.com/android/general/info-android-device-partitions-basic-t3586565

(read mainly the vendor partition part)

And this one... https://www.xda-developers.com/xiaomi-redmi-note-4-project-treble/

If I understand correctly, the content of some stock vendor partition (mainly HALs, blobs, etc) are shifted to cust vendor when you flash LOS 15.1. So basically the vendor partition after LOS 15.1 has lost some of it vital contents to cust partition. That's why you get a bootloop when downgrading because the vital elements were shifted to cust partition.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] lguti:
That's right. That's why I suggest starting from scratch, flashing MIUI and from there, clean flash LOS14.1 and later, restore nandroid backup.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] eliezerjk90:
That's also exactly what I suggested a few pages back then... Read the end of the post ;)
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] Mintappan:
Can I do it in the redwolf twrp terminal???

:cowboy:
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] anisursamsung:
I don't know that. You can use Termux from playstore
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] naryhd:
hi guys , how can i theme this rom?! is substratum the only option?! if yes, dose this rom support that?! if yes should i disable overlays before updating the rom?!

---------- Post added at 10:12 AM ---------- Previous post was at 09:53 AM ----------

one more thing , press back button multiple times, it acts like pressing home button!!!!!!!
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] majod1:
On 14.1 I had an older version of a Google Camera port which worked flawlessly without rooting my phone or changing anything, now there are so many versions but most of them don't work. I tried bunch of versions I found on various XDA posts but HDR+ either didn't work, or the app couldn't be installed, or it would crash on launch.

The only version which more or less works is the one presented here https://www.xda-developers.com/google-camera-mod-portrait-mode-lens-blur-4k-video/ but it still crashes occasionally.

Is there any better/newer version that don't require rooting the phone? Thank
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] bnesic:
On Oreo you must have GApps installed for GCam ports. That was not the case for Nougat ROMs. Thats one of the reason why im still on 7.1.2 [emoji18]
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] majod1:
But I have Gapps mini installed. Is a different version required?
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] p3dboard:
Check out the Urikill version of the app on the opening post of the thread for LineageOS extended edition - in the General News / Discussion area, not under android development threads. It is pretty reliable, but can still occasionally crash.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] RedMi92:
Since latest LOS i can't hear anything: audio works only through headphones or loudspeaker, normal speaker is dead. I flashed back MIUI and other custom Roms, the problem remains. On MIUI it says headphones are inserted even if they are not. Anybody knows how to solve this problem?
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] k3lcior:
Clean headphone port, there's probably something stuck in it and phone thinks headphones are connected. (or you broke it somehow)
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] eliezerjk90:
Looks like a hardware defect. Most likely your earphone port is broken and therefore it detects as if you have earphone on.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] supermario3:
The problem is not LOS or MIUI.

I had the same problem with stock global with locked bootloader.

Clean very good the headphone port.

If you still didnt solve: (it may sound stupid)

put and remove the headphones several times in the port, rapidly, in and out.

You have no idea how much time I wasted looking for this solution!

I hope you can solve, let me know :)
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] Kake41:
I have pretty horrible battery drainage. I get around 4-5 hrs of SOT. Not many apps installed and the ROM was installed with full wipe. Any suggestions? Maybe an another kernel?
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] mAlvarado1986:
Install better battery stats app (search here in the forums), let the phone rest some hours and check what's causing xtreme wakelocks.
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] Szabi01:
Hi! Could anyone tell me if Smart Cover is working? If not, please, [MENTION=6070905]abhishek987[/MENTION], could you take a look at this ?
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] ManyPhones:
Well, I gave it another try before I am going to try out your suggestion above....

This time I restored all items from the LOS 14.1 backup done with TWRP 3.1.1-0, namely System, Data (ecl. storage), Cache, Cust, Recovery, Boot, EFS, Firmware, Persist, Bootlaoder and EFS..

Result: successful boot into 14.1 system, full access to external SD card (encryption keys successfully restored!)

=> so I now made a copy of all the contents of the external SD card to my PC external USB harddrive. So far so good.

The problem now ist, that the device

- does not detect the SIM cards (I have an adapter for simultaneous used dual SIM+external SD)

- does not allow me to swith on WiFi

Options say that Baseband version is "Unbekannt" => unknown.

I also wiped system again and re-flashed LOS 15.1. It is booting into system, but the problem persists.

Is that related to the vendor partition having been altered?
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] laviniu_c:
try flashing the latest firmware for mido from here: https://xdaforums.com/redmi-note-4/...lopment/firmware-xiaomi-redmi-note-4-t3760917

https://sourceforge.net/projects/xi..._V9.5.9.0.NCFMIFA_b57067babe_7.0.zip/download

baseband unkown+nosim = firmware issues...
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] penglezos:
Found a kernel implementation for this, I'm working to port it
[Xiaomi Redmi Note 4 [Snapdragon] ROMs, Kernels, Re] k3lcior:
You probably broke something by playing with efs/firmware/persist partitions, never backup and restore them there is no need to.

Go back to stock with MiFlash fastboot method to restore these partitions to default state, then reflash TWRP and whatever ROM you have been using.

http://en.miui.com/thread-565784-1-1.html

With TWRP backup only System/Data/boot/Vendor* (*if you are using Treble ROM) dont touch other partitions.