The ~ultimate guide to unlock bootloader, use twrp, flash beta from stock rom, setup and hide magisk + edxposed for mi 10 umi, use LP, plus extra tips


Did you manage to unlock bl/flash the rom/use twrp/root your phone successfully with this guide?


  • Total voters
    24
Dec 3, 2020
747
102
It's a bit hard for newcomers to do all these when they want to start using the xiaomi eu rom, so after some of us were talking about making a guide for all these for mi 10 (because it may require a kinda special process) I decided to actually make one. Tjis may save you some time. This works ~as of 23-7-2021 and applies for mi 10 Umi (many parts may apply for mi 10 ultra, maybe mi 10 pro and other devices). I've also put many tips you might find usefuld in the end of the guide. If you don't understand any terms please search them beforehand. (I'm ~not responsible for any damage that you may and may not do to your phone). Also any info in this guide inside spoilers ~are outdated info that is corrected by the info above and below the spoilers (if you wanna check them tap/click on the spoilers).

Contents:
  • Setting up
  • Unlocking bootloader
  • Flashing the rom (clean flash, deletes data) and installing magisk
  • Clearing out some issues and misunderstandings about twrps (extra, but very good info)
  • Setting up magisk and passing safety net
  • Installing and setting up Lsposed-EdXposed-Riru
  • Extra notes:
1)Lucky Patcher (LP)
2)Safe mode
3)New twrp
4)Backing up
5)Managing files - total commander
6)Dual apps - island
7)Kill background apps - greenify
8)Monitor battery - gsam battery monitor
9)Migrate playlists
10)Care of battery charging - AccA
11)Changing SELinux status -the SELinux switch
12)Optimising the phone after rom flash
13)CustoMIUIzer
14)Useful links

So here we go:

Setting up

1)Install the drivers from this site https://flashxiaomi.com/xiaomi-mi-10-usb-driver/, they will probably prove to be helpful for what we're gonna do
Qualcomm drivers: http://www.mediafire.com/file/mclznqmya1s5i8c/qualcomm_driver.zip
Adb driver: https://dl-ssl.google.com/android/repository/latest_usb_driver_windows.zip (as you may see, when intstalling this driver there are options to install bootloader and composite adb interface drivers, install them too)
2)Install latest minimal adb https://androidmtk.com/download-minimal-adb-and-fastboot-tool

Unlocking bootloader

(It deletes your data, first backup app data from previous phone or the same phone with helium backup, backup apks with a simple backup app, move files to pc and check for anything left):
(Check this guide https://fossbytes.com/how-to-unlock-bootloader-on-xiaomi-devices-using-mi-unlock-tool/)

For ~"quicker" download of roms use a download manager, like fdm: https://www.freedownloadmanager.org/

1)Download mi unlock tool:
2)Make a Xiaomi account, add a working number, log in from the phone and enable Find My Device.
3)Authorize Mi Unlock in the developer settings
4)Connect the phone to pc with usb debugging and oem unlock on and open mi unlock tool.
5)Apply for unlocking bootloader
6)Wait ~1week (don't sign out of your mi account from the phone and keep the sim of the phone number you used to put it back in when you'll unlock it)
7)Connect the phone to pc with usb debugging and oem unlock on, open mi unlock tool and this time try to unlock the bootloader.
You're probably done!

Flashing the rom (clean flash, deletes data) and installing magisk

1)Get the MBTWRP_21-05-2021_UMI.img TWRP.

[4/3/2021:New TWRP for umi!!!
Get the new MBTWRP_12.2.5_UMI.img one that supports decryption better (https://forum.xda-developers.com/t/recovery-3-5-0-0-unofficial-twrp-xiaomi-mi-10-umi.4241705/)

Due to encryption issues, you have to only boot into the 3.4.2b-1206 twrp, not flash it, and remove pins/passwords (just temporarily disable security locks etc.).
Get the twrp (3.4.2b-1206) https://androidfilehost.com/?fid=17248734326145679752 (check this thread https://xiaomi.eu/community/threads/twrp-recovery-list-of-relevant-recovery-in-one-place.57730/unread)]

Also get the latest beta rom and the magisk files (https://github.com/topjohnwu/Magisk): magisk manager canary veresion ("debug.apk") from https://github.com/topjohnwu/Magisk (https://raw.githubusercontent.com/topjohnwu/magisk_files/canary/app-debug.apk) magiskbeta.zip and magisk uninstaller (currently from https://github.com/topjohnwu/Magisk/releases). (If you want, you might be able install the stable or beta versions of magisk instead, but are we beta testers or not? :emoji_upside_down:)

If you update and already have magisk don't delete it, flash the new beta update, boot normally and then reflash magisk. (This will probably keep the modules.) Tnx @geoorg.
If you want to go extreme and magisk is already installed delete it from the app (to ~prevent any problems, but flashing a rom ~deletes it anyways).
Deleting magisk ~usually deletes its modules as well. To back them up, go from twrp or root file manager to data/adb and copy ~everything, maybe apart from magisk.db and the magisk and service.d folders, to an external drive (if you copy them to internal storage, the may be deleted with magisk again). Probably an outdated link: https://forum.xda-developers.com/t/export-magisk-module-list.3897552/

2)New magisk versions allow to flash magisk manager in twrp without any other companion app/zip. To do this change the extension of the app from "debug.apk" to "debug.zip" which will allow twrp to be able to flash it. (https://www.xda-developers.com/install-magisk-manager-without-separate-zip/)
3)Put phone into fastboot mode (after power off, boot up pressing volume down and power button) and connect phone to pc.
4)Unpack the twrp rom in the folder minimal adb is installed and open minimal adb.
The MBTWRP_21-05-2021_UMI.img twrp you should ~only be flashed (booting into it instead while having an older twrp may cause recovery loop). Enter fastboot devices command, then enter fastboot flash recovery "twrp filename.img" command and reboot into the recovery by pressing the power button and the volume up button when the phone starts booting up.
Note that when you flash a twrp and you boot normally instead of straight into the new twrp, it is possible that the new one gets overwritten by the old one, this may have changed.
If you wanna follow a more tested route, use the TWRP 3.4.2b-1206 which this time, you should ~only boot into it. But you ~mustn't have this MBTWRP_12.2.5_UMI.img twrp in your system as there might be conflicts; https://xiaomi.eu/community/threads/21-3-3.60197/post-594885. Please don't mix things up, read this section again... Enter fastboot devices command, then enter fastboot boot "twrp filename.img" command and reboot into recovery.
5)Wait ~2mins to boot into twrp.
6)The wiping:
a)Go to wipe tab->advanced
b)Wipe cache, davlink/art and data
c)Go back and wipe data (deletes apps + app data)
d)Do factory reset (deletes apps + app data)
(For updating roms in the future, just wipe cache and davlink)
7)Get a flash drive
Put inside the rom.zip the magisk manager "debug"/magisk.zip (and magisk uninstaler.zip)
8)Connect it to the phone with otg.
9)Go to install tab and flash the rom from the otg storage
10)Do step 6) again ( for a "full wipe" when going from stable to beta or from stock to beta, for updating roms in the future, just wipe cache and davlink)
11)Flash the magisk.zip file
12)Wipe cache and davlink
13)From advanced tab, go to file manager and delete the folder /data/system/package_cache
14)Wipe cache and davlink
15)Reboot
Yay, well done! It may take a while.
(Set up google/mi accounts and the phone)

Note 1: About the wipe proccess when updating the rom, not flashing it first time which is what we are doing here, @Igor Eisberg here clears some misunderstantings.

Note 2: About the wipe proccess when flashing for the first time, @Poney70 has told me that you could probably just only wipe data only after you flash the rom. ~No need for the nuke I describe above :emoji_upside_down:. Btw, keep in mind that every time you wipe data or factory reset, the internal storage may be encrypted differently, thus losing access to it from twrp. To fix it, either reboot normally, wait for google to greet you into your "new" device and reboot to recovery or from the recovery go to reboot tab and press reboot to recovery.

Clearing out some issues and misunderstandings about twrps (extra, but very good info)


In this guide I went a bit overkill with the twrp process. So I'll try to write here some extra info and alternative steps ~using also the material @Iain_B gave me:

In May 2021, M.B. released a 3.5.2 twrp, named MBTWRP_21-05-2021_UMI.img (3.5.2).
In March 2021, the user Manuel Bianco (M.B.) released 3 twrps (3.5.1) for mi 10 (and other devices too):
It is the MBTWRP_02-03-2021_UMI.img (v1.0), the MBTWRP_08-03-2021_UMI.img (v1.1) and the MBTWRP_14-03-2021_UMI.img (v1.2). It is recommended to use the 3.5.2 one. Those are stable (especially the latest one) and can be flashed in the system. They work very well. One issue they might have, is their incompatibility with the older twprs, like the 1206. If you ever change twrps from the mb ones (mb short for manuel bianco) to the older ones, you should probably flash them, not boot into them. If both old and new are on the same system you might have and issue like a recovery/fastboot loop. The xda thread is here: https://forum.xda-developers.com/t/recovery-3-5-1-unofficial-twrp-xiaomi-mi-10-umi.4241705/

In 4/3/2021 a new stable (probably) twrp that supports encryption in a better way is out MBTWRP_12.2.5_UMI.img. You may be able to just flash this and do your job correctly (note that this twrp is still very new, for some it may cause recovery loop, not for me though so far).

After the beginning of November 2020, there started to be conflict problems between Mi 10 (umi) and TWRP (and some other mi 10 phones). This was largely due to Xiaomi changing their kernel codes which in turn affected the encryption process. After 11 November 2020, to avoid Boot loops, it was important to use a different and stable TWRP. This stable TWRP, after 18 November 2020, was included automatically with each new ROM installation. This is an unofficial version of TWRP - 3.4.0 (LittleTurtle2333). This stable twrp is ~no longer included in the roms since 21.1./7.

Because this is based on an earlier version of TWRP, it does not decrypt data. It also initially loads up in Chinese. To go into English, click on the 2nd to bottom button on the right, and then click on the globe option, and choose English. Because it does not decrypt your data, the only option to install the beta ROM is through USB-OTG, as I did on the steps before.
Also since it can't decrypt data, using mtp or creating nandroid backups with this rom may fail or create corrupted files. It's ~not tested.
It's probably much safer/better to use the newer twrps.

About the 2 unstable twrps
There are 2 unstable versions (I ~can't find the old) with the newer being TWRP 3.4.2b-1206.
You can ~only boot (NOT flash) into them from Fastboot. It takes about a minute to load and may take a short time for you to be able to input your pattern (not password). Yep, it may decrypt data, but you input ~only a pattern. (I ~just don't use any locks.)

The fastboot command:
fastboot devices
(~just to know the pc recognises the phone)
fastboot boot [temp-TWRP-recovery.img]
boots ~only using that recovery temporarily, and ~does not touch the recovery partition. Once you exit from this recovery, it ~disappears from memory.

With the TWRP 3.4.2b-1206 and MB twrps you can:

1)Use MTP; transfer the rom.zip to the internal storage and flash it
2)Use otg (maybe a bit safer); that's ~what I did in the steps of this guide before.
3)Perform nadnroid backups. From what Iain told me you can ~do a full backup:
[Before you do the backups, go first into twrp; advnaced->file manager and delete the file /data/extm folder]
Go into backup tab
Tick ~all the boxes, except maybe the 'cache'. When restoring, ~everything comes back; data, icons, widgets - ~all in the exact same position. The ~only thing is (which is understandable) ~all of the secure apps, eg. bank, have to be re-registered - but they are ~still there.

Btw, ota may no longer work with mi 10 (~not tested)

Also some extra info about phone encryption here (it turns out full-disk encryption that ~existed on android 5-9 ~no longer exists in android 10+): https://source.android.com/security/encryption

Setting up magisk and passing safety net

For old magisk versions: 1)Install magisk canary app https://raw.githubusercontent.com/topjohnwu/magisk_files/canary/app-debug.apk
2)It may ask to give it root access, do it.
1)Open the magisk manager (canary) app, go to modules and install busybox for android ndk (needs reboot afterwards). Busybox is very powerful and many root apps needed actually, so it might be a good idea to have it anyways.

2)Hide your Magisk (get Google Pay etc. working):
a) Enable your app installation over USB in your developer settings on your phone.
b) Go into your Magisk Manager Settings and click "Hide Magisk" under the "Manager" category, there enter an alternative name for your Magisk. (A random, but goo looking one might be better)
c) After installing the hidden Magisk manager, go into its settings and enable "MagiskHide" under the "Magisk" category.
d)If you have any apps that shut down/don't want your phone to be rooted, go to superuser tab->magisk hide and add those apps (like CoD:Mobile etc.).
e)Reboot and the check if you pass safety net (if not try to delete cache of google services and google play and reboot).

EDIT: The next steps 3-4 may actually no longer be needed, ~due to Framework-level key attestation blocking used in 21.1.13/14 and newer betas: https://xiaomi.eu/community/threads/21-1-13-14.59414/page-9#post-584901
If you fail safety net, you may want to try them (or if ~for some reason you want to change your device model name).

3)Go to modules and install MagiskhideProps (needs reboot afterwards)

4)Set up magisk props and magisk hide (check this guide: https://xiaomi.eu/community/threads/tutorial-fix-safetynet-issues-with-magisk-also-cts-profile-match.58555/) what it does is to change the device name of your phone to be undetected
a) Download and install Termux(any terminal editor for android) from Google Play
b). Type "su" hit enter,
c) Open up Termux and grant root/superuser access.
d) then the "props" command and hit enter
e) After MagiskHide-Props loaded successfully, type "2" to choose "Force BASIC key attestation"
f) Type "c" and hit enter for activating the option.
g)Select a device name for your phne (it ~just mustn't be the one your device has, just type your device name and add "Eu" in the end.
Type "y" and hit enter for activating the option.
h) Type "y" and hit enter to reboot your phone.
i)Check if you pass safety net, if not, try one more reboot and/or delete cache of google services and google play and reboot.

Installing and setting up EdXposed-Riru

There's a new xposed manager, called LSPosed. Edxposed now fails safetynet and hasn't been updated ~since March 2021 (RIP).

1)Install latest "riru" module from magisk manager (also here).
2)Reboot.
3)Install latest "riru - lsposed" module from magisk manager (also here)
4)Reboot.
5)It may be a good idea to enable resource hooks from lsposed settings.
You should probably see now "Activated" on LSPosed's home screen.

Note: I've noticed that everytime I update my phone lsposed reports an issue with selinux policy. To fix/prevent this, there are 2 ways:
1)Either disable the riru - lsposed module before updating and enable it after you have flashed magisk (haven't tried it before flashing magisk). Reboot afterwards.
2)Or delete the riru - lsposed module and reinstall it. The xposed modules are lost when doing this, so you may want to create a backup from lsposed settigs to restore afterwards.
(The 1st way seems less painful and quicker.)

Edxposed may not always work
or it may cause some other problems. Nandroid backups recommended.
There are some reports that you should do the steps in a different way etc., but this ~worked for me.
(If you want check these guides:
)
1)Install "EdXposedManager-4.5.7.apk" (the canary version):https://github.com/ElderDrivers/EdXposedManager/releases (scroll a bit down and you may find the app).
2)Go to magisk->modules and find the riru module. Install it.
3)Go to edxposed manager app->canary tab-> framework tab and install the Yahfa drivers (sandhood drivers might brick it, if yahfa drivers brick your device, you may want to try sandhook). I think you can also find the drivers from magisk, from github and from https://ci.appveyor.com/project/ElderDrivers/edxposed/build/artifacts.
EDIT: As of 18/1/2021, there's ~only one version called "master" and ~no the other 2 driver names (at least in canary), it seems to be working. ~Get this and not the old ones.
4)Open EdXposed Manager > modules
5)Turn on "EdXposed Manager" and reboot.
6)Because you may fail safetynet follow these steps:
a)Open Edxposed Manager > settings > scroll to framework section.
b)Turn on "app list mode", "force hook modules" and "pass safetyNet".
c)Open Edxposed Manager > applications Xposed Hide [(black)].
d)Turn on "google play services" and "google service framework" (this adds them to whitelist/blacklist) or turn on "android system" and "system ui" (I've actually added CoD:M too).
e)Reboot

Extra notes:

1)Lucky Patcher (LP) may put the phone into bootloop if you give it root access (at least in android 11). Thanks to @geoorg, I managed to make it semi-work with root access. Before you try anything, please do a nandroid backup to resotre you device in case you brick it. It took me ~15 mins to backup and ~15 mins to restore. If I hadn't done this it may have taken me much much more (note that I ~was using instructions and ~still bricked it many times). So the link to geoorg's post: https://xiaomi.eu/community/threads/21-1-6-7.59279/post-583781

[EDIT: It turns out after already having done the next steps and updating LP to the 9.3.8 version, it was finally fixed and managed to install apks through LP without bricks!! The update itself ~said it fixed some bricking issues in android 11. (Still I reverted to a nandroid backup I had for extra safety and avoided installing apps through this app.)]

The steps:
I had LP installed already, then I installed Edxposed LSPosed and then I set up LP.
1)Install LSPosed as described previously.
2)Go to LP and give it root access.
3)Go to toolbox->Patch to android
4)Untick "only patch dalvik-cache" and tick "use the magisk module to apply the patch".
5)Now, because it ~can't start doing the patch without something to patch select "disable signature verification in the package Manager".
What it actually tries to patch ~doesn't work though (the signature disabling), but it seems that somehow LP becomes stable after this.
If you run the test for patch, you'll probably see it fails in ~everything. What we ~want though is the LP magisk module which ~is created after the patch.
If you want you ~can remove that signature verification patch from ~the same settings again as it ~doesn't do anything.
If the phone bootloops afterwards, boot to twrp and delete "data/adb/modules/luckypatcher".
Notice that the LP module ~should be deleted before any rom update. (~Just follow the previous steps to install it.)

6)Now LP might be stable. Though it might be a good idea to enable the LP LSPosed module from lsposed.
7)Turn on "Lucky Patcher" from LSPosed modules tab (from within the LP module enable System Framework and System UI) and reboot.
8)Open lucky patcher > toolbox > Xposed settings and turn on the first 2 options., if you find them, because, probably, depending on the support of the drivers they might not show up. I updated my yahfa drivers on 17/1/2021 and they appeared.
9)LP ~still can cause the phone to bootloop though. Installing ~any app (either as a downgrade or a patch disabling permissions to some of your own apps, etc.) will bootloop the phone (this may and may not happen after you open this new app). So to prevent this:
10)Go to LP settings->Apks installer operating mode and select "Don't use root for Apks insaller". But you're ~not done yet.
11)For patching apps (like removing not privacy friendly permissions to some of your own apps, etc.) when selecting menu of patches select ~only the "Create Modified APK file", create your patched app and then install the app from you file manager (by finding the path of the apk), not LP! If you chose any other option, ~since LP has root access, it ~will install the app by itself (doesn't even ask for permission) and you' ll probably brick the device. Also probably any other action that might require apk install through LP will probably brick the device.
12)As a final step enable draw on other apps for it.
(LP might be a time bomb for some users...)
13)If you also want, set the selinux status to permissive instead of enforcing. The way of doing this is described later. It ~gives "more" access to apps, but might expose your phone even more. Turning it on ~didn't prevent any bootloop from LP.

Notice: some may actually be able to install apks directly from LP without bricks. Well, it probably depens on the support of the device and the drivers. Though bootloops may be caused.

If you want to use it very safely ~just don't give it root access and enable draw on other apps for it. If you have already bricked the device you may wanna try these methods (check this post: https://xiaomi.eu/community/threads/20-12-28-29.59085/post-581529):

Method 1)
Flash the same rom again on top of the other, it may retain almost everything.

Method 2)
Boot into safe mode (reboot the phone and after the mi logo dissapears press the volume down button)
Unistall LP from settings
Note: this will probably remove icons from your launcher.

Check this post for how to enter safe mode: https://xiaomi.eu/community/threads/20-12-28-29.59085/post-581398

Method 3)
Factory reset from twrp, it will probably delete apps and app data. Note that some apps you have installed, though a bit rare, might not be on google play anymore, but on third party stores, so you might have to install them from there

Method 4)
Factory reset from twrp + same rom flash

Method 5)
The nuke... Factory reset from and wipe data as well from twrp. If you want reflash the rom as well.
(These methods actually may be useful went trying to fix other app or rom related issues as well.)

2)To enter safe mode: (https://xiaomi.eu/community/threads/20-12-28-29.59085/post-581398)
Safe Mode (This is not the "Recovery mode" or the "Fastboot mode" )
In case your phone shows a lot of errors and you cant handle them because there are a lot of pop up windows or you want to deinstall something from magisk as example ... try the "safe mode" only some important standard apps will be loaded:
  1. Power off your Android device and then power it on. You can also use the Reboot or Restart option.
  2. You will see the Powered by Android logo and MI logo on the boot screen, If they disappear and the Screen ist black, press and hold the Volume Down key down so long till system ist loaded
  3. The System will load and you will see a watermark... Safe mode
  4. Deinstall the app with the error / analyze the root cause of the issue and so on ...
  5. Reboot the phone to get off the "safe mode"
  6. Perhaps after loading you have to disable AirPlane Mode
3)After each rom install,
the old twrp is flashed on your phone, but as said before it's ~the stable one that ~can't dedcrypt data, thus you have to boot into the new twrp the way it was described before (check also the extra info ~right after the rom flashing section above).
the new twrp (MBTWRP_14-03-2021_UMI.img) is installed and seems to be working very well.

4)Backing up:
There are some options:

a)Nadnroid backups (from twrp). You can ~do a full backup:
Tick ~all the boxes, except maybe the 'cache'. When restoring, ~everything comes back; data, icons, widgets - ~all in the exact same position. The ~only thing is (which is understandable) ~all of the secure apps, eg. bank, have to be re-registered - but they are ~still there.
Probably the best way to create a restore point for your phone.

b)Using Titanium Backup (TB) to backup app data (can't restore apk, only data) and another app to backup apks, like backup and restore
(https://play.google.com/store/apps/details?id=com.keramidas.TitaniumBackup&hl=en
https://play.google.com/store/apps/details?id=mobi.infolife.appbackup)

c)Using swift backup to backup app data and apks (edit 23/3/2021:) Probably one of the best options for free users: it supports, split apks and recently made batch backup/restore free
(https://play.google.com/store/apps/details?id=org.swiftapps.swiftbackup&hl=en)

d)Using migrate app to backup apks and app data
(https://play.google.com/store/apps/details?id=balti.migrate&hl=en
https://play.google.com/store/apps/details?id=balti.migrate.helper
https://play.google.com/store/apps/details?id=balti.migrate.flasher)

e)Using twrp to make nandroid bakups (no root)

f)Using helium (no root) to backup app data (can't restore apk, only data) and another app to backup apks, like backup and restore.
(https://play.google.com/store/apps/details?id=com.koushikdutta.backup
https://play.google.com/store/apps/details?id=mobi.infolife.appbackup)

g)Using miui's native backup process to backup app data and apks (my device->backup and restore). If find it to work kinda well with backing up the launcher and the wifi settings.


5)For managing moving files (during backups) you may want to use total commander (and give it root access).
(https://play.google.com/store/apps/details?id=com.ghisler.android.TotalCommander, check it's plugins as well)
It can ~retain the last modfied date, explore root and apps, connect to pc with lan, make your device ftp server, unzip zips etc.

6)For dual apps use island app, it deos its job ~very well (if you install it and then isnatll magisk, it's gonna be installed in island app too).
(https://play.google.com/store/apps/details?id=com.oasisfeng.island&hl=en)

7)To kill background apps, you may want to use greenify apart from the miui settings
(https://play.google.com/store/apps/details?id=com.oasisfeng.greenify)

8)To monitor battery you may want to use gsam battery monitor (you can give it root access, if you go to apps usage app, select an app and wait a little).
(https://play.google.com/store/apps/details?id=com.gsamlabs.bbm&hl=en)

9)To migrate playlists from pc get the music files and put the inthe same folders that they are on pc, get the playlist.m3u files, edit them by fixing the paths (remember to change "\" to "/")

10)To take care of battery charging check the app AccA (you ~can find it in magisk too as Acc and use it with a terminal editor, but ehh).
Github:https://github.com/MatteCarra/AccA
App on F-Droid:https://f-droid.org/packages/mattecarra.accapp/
Extra info about Li-Ions/LiPos: https://batteryuniversity.com/index.php/learn/article/how_to_prolong_lithium_based_batteries/

11)Changing SELinux status between Enforcing and Permissive (note; it may expose your device even more to threats) using the "the SELinux switch":
a)Get the zip of this app (the .zip, not the .m5d):
https://androidfilehost.com/?w=files&flid=203152
(XDA: https://forum.xda-developers.com/t/app-tool-2-0-official-the-selinux-switch.3656502/)
b)Flash it through twrp
c)Reboot and find/open the app
d)Give it root access
e)Tick the notification box
f)Select the mode/status you want
More info about SELinux:
https://forum.xda-developers.com/t/app-tool-2-0-official-the-selinux-switch.3656502/
https://androidmore.com/set-selinux-permissive-android/
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/using_selinux/changing-selinux-states-and-modes_using-selinux
https://serverfault.com/questions/371409/selinux-how-to-change-to-permissive-mode-without-a-reboot

12)Optimising the phone after rom flash
I found the info about this here: https://xiaomi.eu/community/threads/tutorial-battery-drain-lag-after-os-update.58011/ (tnx @MAMAC)
After you flash a new rom, the system will try to optimize the apps, ~only though when your phone is nearly fully chargesd and left alone for a while. If you want to do the optimization sooner, download termux (an android terminal emulator, needs root, if you haven't root, try using adb which is described later) and type the 2 commands (after each press enter):
su
cmd package bg-dexopt-job

This should probably take ~10-15minutes, until it's done though it will look as if nothing happens. When it finishes there should probably be a success message. If you want to do it with adb the commands are:
adb devices
adb shell cmd package bg-dexopt-job


Note that you may not have to optimize anything, it should probably happen during the first boot up. @Igor Eisberg explains here very well what's going on.

13)CustoMIUIzer

Customiuizer is a very powerful modding tool that can give users many more settings to play with. Currently it is supposed to work till android 10, but many parts seem to work on android 11 too.
1)Install customiuizer app from google play or the creators version of github (??).
2)Go to lsposed/edxposed and enable the customiuizer module.
3)Reboot.

Done. Now you may play with the settings. It is advised to take a backup of the customiuizer settings before you do anything (from the settings management in the app) to restore in case things go sideways... To apply any new setting you may want to soft reboot from the app's settings (it may work without any reboot, but others require a single soft reboot).

14)Useful links
This is for links I ~didn't know where to put them:
a)From @Iain_B, a short guide on preparing the phone before updating the rom: https://xiaomi.eu/community/threads/mi-10-umi-my-process-for-installing-weekly-roms.60176/

This guide contains knowledge and parts from the xiaomi.eu forum (and other sites).
It ~couldn't be made without the help of many many people. I might not remember all of them, but
HUGE THANKS TO:
@Iain_B
@gkalen
@katerpanne
@RainerReinfall
@Poney70
@geoorg
@Camerado
@MAMAC
@the developer team
And many other people!

Please feel free to continue this thread!!!
 
Last edited:
Dec 3, 2020
747
102
If I want to pass safety net, I actually need to install magisk and do all that process? Because I don't need Magisk
Hm, have you tried deleting the /data/system/package_cache folder?
I had a similar problem, but I ~solved this with magisk. Do you have mi 10? Btw, in the latest rom I think some other people had simar problems. If it was caused by the latest update you may want to (safely), revert to the previous beta.
Also, if you think it's a bug, let the developers know.
(Haha, I ~forgot to ask if you actually have this problem.. Do you?)
 

robertb_45

Members
Feb 2, 2018
403
67
Hm, have you tried deleting the /data/system/package_cache folder?
I had a similar problem, but I ~solved this with magisk. Do you have mi 10? Btw, in the latest rom I think some other people had simar problems. If it was caused by the latest update you may want to (safely), revert to the previous beta.
Also, if you think it's a bug, let the developers know.
Oh, I haven't installed the ROM yet, I have a Mi10T, but I'm thinking of installing stable, not beta, but my question is that if magisk installation is mandatory if I want everyting working (widevine L1, certifications)?
 
Dec 3, 2020
747
102
Oh, I haven't installed the ROM yet, I have a Mi10T, but I'm thinking of installing stable, not beta, but my question is that if magisk installation is mandatory if I want everyting working (widevine L1, certifications)?
Ah, well, I think when I flashed the rom the safetynet test failed from magisk. But anyways, 1)we ~don't have the same phones 2)it was another rom version and 3)I might just did something wrong.
Ask or search in the stable rom thread if you want. There may be people who had this issue and people who solved this. I'm using betas, so I ~can't help much.
 

DZUKELA84

Members
Oct 4, 2020
9
15
Is this procedure mandatory for stable build too? My unlock time expires tomorrow and i want to flash latest stable xeu for mi 10.
Or there is easyer procedure?
 
  • Like
Reactions: robertb_45
Dec 3, 2020
747
102
Is this procedure mandatory for stable build too? My unlock time expires tomorrow and i want to flash latest stable xeu for mi 10.
Or there is easyer procedure?
If you go from stable or stock rom then you ~have to perfom a clean flash. Updates ~can be dine with a simple flash. (Oops, should have probably included that.)
Or are you asking what to do to go from stock to stable?
If yes, I haven't checked the stable rom forums much, but I think going from stock to stable requires clean flash too. Updates though I think can be done with a ~simple flash. Remember though, the new twrp came for betas after ~November 2020. I ~don't know exactly which twrps should used. Maybe you too should use the new twrp too, as your stock rom is new too.
Check the stable roms forums for more info.
Btw Iain_B contacted me with much insight about twrps, so I'll probably add more info in the coming hours/days.
EDIT: I ~just checked the stable forum. The latest stable is from December, so you should probably use the new twrp too. (From what Iain_B told me, my proccess with the twrp might be a bit overkill, but eh, it might be more safe. As I ~said, I'll try to update the process in the future.)
 
Last edited:

DZUKELA84

Members
Oct 4, 2020
9
15
Yeah im going from stock to xeu stable. Can i permanently flash twrp and then from twrp flash the rom or i boot the twrp and use otg to flash it?
It was much easier on mi 9 :))
 
Dec 3, 2020
747
102
Yeah im going from stock to xeu stable. Can i permanently flash twrp and then from twrp flash the rom or i boot the twrp and use otg to flash it?
It was much easier on mi 9 :))
You ~mustn't flash the new twrp! It may brick your phone! (Though I ~accidentally did it, but that might was an exemption..) Besides, flashing a xiaomi rom ~replaces recovery with the old twrp that ~can't encrypt data, but it's stable.
@Iain_B be ~told me about a simpler process, but I ~haven't much time to inlcude it today.
 

DZUKELA84

Members
Oct 4, 2020
9
15
I dont need data encryption and im not using pin or fingerprint to unlock. If older twrp is stable then its all good :)
 

robertb_45

Members
Feb 2, 2018
403
67
You ~mustn't flash the new twrp! It may brick your phone! (Though I ~accidentally did it, but that might was an exemption..) Besides, flashing a xiaomi rom ~replaces recovery with the old twrp that ~can't encrypt data, but it's stable.
@Iain_B be ~told me about a simpler process, but I ~haven't much time to inlcude it today.
So if I want to update my existing xiaomi.eu installation, do I boot from the newest TWRP my device has, or do I have to use the TWRP that xiaomi.eu ROM's installs and replaces the stock one with?
 

Asimo

Members
Jan 24, 2018
10
15
Hi,
I have my Mi10 with the weekly rom Miui 12 | 20.6.18(Android 10) and twrp 3.4.2b 0623, I already tried the android 11 when it came out but I had too many problems so I came back to Android 10, and now that I think that Android 11 is more stable I decide to give it a shot and see if my old problems are already fixed. I already read your guide but I came up with some questions. You mentioned that to flash the new weekly rom we need to have a USB pen and flash by OTG, it means that I need a special cable, female USB to put the USB pen and type c to connect the phone, but I haven't. Is there a solution to flash the new rom without it? And to upgrade my phone from my rom version to the latest one I can use the steps that you said in your guide? Thanks for the good work and if you can reply to me I will be very grateful.
 

Iain_B

Members
Mar 25, 2013
1,376
297
So if I want to update my existing xiaomi.eu installation, do I boot from the newest TWRP my device has, or do I have to use the TWRP that xiaomi.eu ROM's installs and replaces the stock one with?
It depends upon what your existing .eu installation is, eg. a stable ROM, or a weekly beta ROM.
And what do you want to update it to?
 
  • Like
Reactions: Blastboom Strice
Dec 3, 2020
747
102
Hi,
I have my Mi10 with the weekly rom Miui 12 | 20.6.18(Android 10) and twrp 3.4.2b 0623, I already tried the android 11 when it came out but I had too many problems so I came back to Android 10, and now that I think that Android 11 is more stable I decide to give it a shot and see if my old problems are already fixed. I already read your guide but I came up with some questions. You mentioned that to flash the new weekly rom we need to have a USB pen and flash by OTG, it means that I need a special cable, female USB to put the USB pen and type c to connect the phone, but I haven't. Is there a solution to flash the new rom without it? And to upgrade my phone from my rom version to the latest one I can use the steps that you said in your guide? Thanks for the good work and if you can reply to me I will be very grateful.
Yep, use the new one with mtp. I have updated the guide, so check the section
Clearing out some issues and misunderstandings about twrps (extra, but very good info)
So if I want to update my existing xiaomi.eu installation, do I boot from the newest TWRP my device has, or do I have to use the TWRP that xiaomi.eu ROM's installs and replaces the stock one with?
It's ~actually possible with ~both.
Check the section "Clearing out some issues and misunderstandings about twrps (extra, but very good info)"

To both of you, in my guide I went a bit overkill with the flashing process inthe section Flashing the rom (clean flash, deletes data) and installing magisk:
so with the help of Iain_B I ~added the section I recommended you to read.
 
Last edited:

robertb_45

Members
Feb 2, 2018
403
67
It depends upon what your existing .eu installation is, eg. a stable ROM, or a weekly beta ROM.
And what do you want to update it to?
I want to install the stable version, and obviously update it whenever there is an update available
 

robertb_45

Members
Feb 2, 2018
403
67
It depends upon what your existing .eu installation is, eg. a stable ROM, or a weekly beta ROM.
And what do you want to update it to?
I want to install the stable version, and obviously update it whenever there is an update available

It's ~actually possibel with ~both.
Check the section "Clearing out some issues and misunderstandings about twrps (extra, but very good info)"

To both of you, in my guide I went a bit overkill with the fashing process inthe section Flashing the rom (clean flash, deletes data) and installing magisk:
so with the help of Iain_B I ~added the section I recommended you to read.
Thanks for the extra info!
 
  • Like
Reactions: Blastboom Strice

Asimo

Members
Jan 24, 2018
10
15
Yep, use the new one with mtp. I have updated the guide, so check the section
Clearing out some issues and misunderstandings about twrps (extra, but very good info)

It's ~actually possible with ~both.
Check the section "Clearing out some issues and misunderstandings about twrps (extra, but very good info)"

To both of you, in my guide I went a bit overkill with the flashing process inthe section Flashing the rom (clean flash, deletes data) and installing magisk:
so with the help of Iain_B I ~added the section I recommended you to read.
So for me you saying to boot from the latest twrp avaliable and copy rom.zip to internal storage and install from the latest twrp that I boot? Can I make a clean install? Like format data and then install the newest weekly xiaomi.eu rom with the steps that I said in the first place of this message, like boot from latest twrp and install through it?
 
Dec 3, 2020
747
102
So for me you saying to boot from the latest twrp avaliable and copy rom.zip to internal storage and install from the latest twrp that I boot? Can I make a clean install? Like format data and then install the newest weekly xiaomi.eu rom with the steps that I said in the first place of this message, like boot from latest twrp and install through it?
Yep, seems correct. Btw, since I ~dunno what you're going to delete, just to save some time, you may want first do the wipe and then move the twrp on the phone.
Also, google probably updated safety net yesterday, so you may fail safetynet if you flash a rom/root etc. and banking apps and netflix may not work. (Magisk may be updated with a fix.)
 

robertb_45

Members
Feb 2, 2018
403
67
Yep, seems correct. Btw, since I ~dunno what you're going to delete, just to save some time, you may want first do the wipe and then move the twrp on the phone.
Also, google probably updated safety net yesterday, so you may fail safetynet if you flash a rom/root etc. and banking apps and netflix may not work. (Magisk may be updated with a fix.)
Yeah I think google broke safetynet, because is not even working on official ROMs
 
  • Like
Reactions: Blastboom Strice

robertb_45

Members
Feb 2, 2018
403
67
5)The wiping:
a)Go to wipe tab->advanced
b)Wipe cache, davlink/art and data
c)Go back and wipe data (deletes apps + app data)
d)Do factory reset (deletes apps + app data)
Hey, I have a question about wipes, in step five you mention 4 steps of wiping:
What is the difference between c and b? I think what you're referring at c is Format Data (where you have to type "yes")? and d is just Data, cache and dalvik, again?
 
Dec 3, 2020
747
102
Hey, I have a question about wipes, in step five you mention 4 steps of wiping:
What is the difference between c and b? I think what you're referring at c is Format Data (where you have to type "yes")? and d is just Data, cache and dalvik, again?
Haha, well, my phone was about a week old when I was doing the flash so I wiped almost everything I found.. I think factory reset also wipes cache. Check the twrp site https://twrp.me/faq/whattowipe.html (if you'll understand anything). Data may wipe apps+app data, but in this twrp faq it seems like it wipes user data (data/media) as well. I think though wiping internal storage does this and not wiping data. It's still a bit unclear for me, so I ~nuked my phone with wipes.
Btw from an online pic I found:
 

Attachments

robertb_45

Members
Feb 2, 2018
403
67
Haha, well, my phone was about a week old when I was doing the flash so I wiped almost everything I found.. I think factory reset also wipes cache. Check the twrp site https://twrp.me/faq/whattowipe.html (if you'll understand anything). Data may wipe apps+app data, but in this twrp faq it seems like it wipes user data (data/media) as well. I think though wiping internal storage does this and not wiping data. It's still a bit unclear for me, so I ~nuked my phone with wipes.
Btw from an online pic I found:
Hahaha ok, thanks! I guess I'll do the wipes before and after installation and hope for the best
 
  • Haha
Reactions: Blastboom Strice

zeyentology

Members
Sep 11, 2018
190
40
Thanks. To be honest, this guide is way too bloated. I think the tldr; should simply contain the download link to the correct twrp and the information about NOT flashing but JUST loading twrp and temporarily disabling passcode prior flashing. Also your download sources are a bit "shady". The usb drivers provided by the official xiaomi flash tool are absolutely sufficient. Also is the officially available android sdk which comes with adb. Magisk IS NOT necessary to get the eu beta roms up and running. Magisk simply unnecessarily opens up the system, which could lead an unexperienced user into severe trouble.

Gesendet von meinem Mi 10 mit Tapatalk
 
  • Like
Reactions: Blastboom Strice