How to set SELinux Mode to Permissive Permanently in MIUI 9

How to set SELinux Mode to Permissive Permanently in MIUI 9

I know that it is hard to set SELinux mode to permissive permanently in MIUI 9. I came forward to show some simple and easy steps to fix this in miui9. Actually, its a problem of Android Nougat (7.0) and not just miui. There are some apps to change SELinux mode to Permissive from Enforcing but you have to do it everytime you turn on your phone which is hard.

Viper4Android needs SELinux to be permissive in order to work. But in MIUI 9 you have to enable developer mode in Viper4Android to disable SELinux everytime you boot. So, by following the below instructions you don’t have to enter developer mode every time as the policy changes to permissive automatically at startup.

set selinux mode

I found a method in which the SELinux mode changes to permissive automatically at smartphone bootup so that you don’t have to change it manually every time. This method involves rooting your phone so I advise you to take a backup of your phone. However, this method works perfectly without any problem if you follow the below steps properly.

Please install TWRP Recovery on your phone running on MIUI 9 to flash some files which can be downloaded below. If you don’t know how to install a custom recovery on your mobile you can search in XDA developers or in miui forums.

Instructions to set SELinux Mode to Permissive

  1. If you have already rooted the phone please unroot it. If you didn’t root your phone please move to step 2. If you have SuperSu installed on your phone go to settings and click on “Full unroot” option. Reboot your phone and your root access will be gone.set selinux mode
  2. Download the Magisk-v14.0.zip file from here to your phones internal storage.
  3. Download MagiskManager-v5.3.0.apk file from here to your internal storage.
  4. Install downloaded MagiskManager apk, and you might get an unknown source warning. You need to turn on Unknown Sources to turn it on, click on “Settings”.set selinux mode
  5. Reboot your phone into TWRP recovery and flash the downloaded Magisk-v14.0.zip file. Now reboot your phone to the system.
  6. You have rooted your phone now. You have to install a simple module to change the SELinux mode on bootup.
  7. Download Magisk SELinux Permissive Script module (zip file) from here. Credits to Jman420 for creating this script.
  8. Open Magisk Manager application and go to Modules section. Click on the “+” icon below and select the downloaded module zip file.set selinux mode
  9. Magisk Manager will automatically install the module and asks you to reboot the phone.
  10. Just reboot the phone and you are done! Every time you boot the phone Magisk will automatically change the SELinux mode to permissive.

You will see the screen above once you finish installing everything properly. You can now use Viper4Android on MIUI 9 or any other application without the need of disabling SELinux every time you start the phone. This method works on all phones and not just MIUI.

Hope you like this article. Please don’t forget to share and feel free to comment below if you have any queries!

Leave a Reply

Your email address will not be published. Required fields are marked *