News Tips

How to Fix Viper4Android SELinux Policy Issues on Lollipop

Viper4Android has had trouble with SELinux enforcing mode introduced on Lollipop, and so far we’ve been trying to run it under the permissive mode by changing the SELinux policy,…

Viper4Android has had trouble with SELinux enforcing mode introduced on Lollipop, and so far we’ve been trying to run it under the permissive mode by changing the SELinux policy,…

54 Comments
Shivam Malani

Shivam Malani Shivam is our resident designer and web developer who also enjoys writing. He loves to meditate, drive on the freeways and hunt for snipers during his Call Of Duty playtime.

Email: [email protected]

Viper4Android has had trouble with SELinux enforcing mode introduced on Lollipop, and so far we’ve been trying to run it under the permissive mode by changing the SELinux policy, but thanks to maximumentropy over at XDA, you can now use Viper4Android without changing SELinux from enforcing to permissive.

The fix involves pushing a few ADB commands to the device on which you want to run Viper4Android and also make sure you’ve SuperSU as your superuser management app for it to work. Check out the original post by the user below:

This requires that you are using SuperSU on your system, as it provides both the su.d startup directory support and the supolicy binary. Execute these commands in a terminal on your Android device to create the startup script. It should execute at boot time, starting with your next reboot.

If case you’re scared of ADB commands, then thankfully we also have a recovery flashable zip for the same.

[ADB method] How to apply Viper4Android SELinux fix

  1. Setup ADB and Fastboot on your PC.
  2. Enable USB debugging on your device from developer options and connect it to the PC with a USB cable.
  3. Open a command prompt window on the PC and issue the following commands:
    su
    mount -o rw,remount /system
    cd /system/su.d
    echo '#! /system/bin/sh' > 50viper.sh
    echo '/system/xbin/supolicy --live "allow mediaserver mediaserver_tmpfs:file { read write execute };"' >> 50viper.sh
    chown root.root 50viper.sh
    chmod 755 50viper.sh
    cd /
    mount -o ro,remount /system
    exit
  4. Reboot your device.

[Recovery Flashable zip] Viper4Android SELinux fix

For folks who prefer to stay away from ADB or just don’t have access to PC. Here’s recovery flashable zip file to apply the fix.

[icon name=”download” class=”” unprefixed_class=””] Download Viper4Android SELinux Policy fix

To install, just boot into a custom recovery (TWRP, preferably), flash the zip file and reboot. Nothing else.

via XDA

54 responses to “How to Fix Viper4Android SELinux Policy Issues on Lollipop”

  1. Guest Avatar
    Guest

    […] Viper4Android for a number of devices. However, only recently we posted of a working method to get Viper4Android working on Lollipop with enforcing mode, and it seems the method also works on Galaxy S6 […]

  2. Guest Avatar

    Works on S4!!

  3. Edward Avatar
    Edward

    Works on S4!!

  4. Guest Avatar

    All I ever wanted to run on my droid was Viper4android. Been rooted for a while struggling with SE enforcing mode. Thanks so much for this fix!

    I have a verizon galaxy s4.

  5. John O'Connell Avatar
    John O’Connell

    All I ever wanted to run on my droid was Viper4android. Been rooted for a while struggling with SE enforcing mode. Thanks so much for this fix!

    I have a verizon galaxy s4.

  6. Guest Avatar

    Hi and thanks for this quick guide.
    I have a couple of questions though:
    – what happens if one day a new viper4android version ships without the selinux problem and I install it? Will it conflict with this change?
    – would at that point be enough to just delete the 50viper.sh bash script ?
    – is there something like an automated way to keep track of all small changes like this one and revert them at anytime?
    Thanks!

    1. Guest Avatar

      post your question here joyn in the thread quoting: http://forum.xda-developers.com/showpost.php?p=61242973&postcount=18854

  7. Joyn Avatar

    Hi and thanks for this quick guide.
    I have a couple of questions though:
    – what happens if one day a new viper4android version ships without the selinux problem and I install it? Will it conflict with this change?
    – would at that point be enough to just delete the 50viper.sh bash script ?
    – is there something like an automated way to keep track of all small changes like this one and revert them at anytime?
    Thanks!

    1. anonymous Avatar

      post your question here joyn in the thread quoting: http://forum.xda-developers.com/showpost.php?p=61242973&postcount=18854

  8. Guest Avatar

    […] It has only been a couple of days since Marshmallow released for Nexus 5, but some of you may already be missing the sound boost from Viper4Android on Lollipop. […]

  9. Guest Avatar

    […] mother of all the sound MODs available for Android devices. However, getting it installed can be tricky on Lollipop and Marshmallow running devices, and even more tricky on the Nexus 6P and 5X […]

  10. Guest Avatar

    thx work on S5 g900h lollipop

  11. Gelar Avatar

    thx work on S5 g900h lollipop

  12. Guest Avatar

    […] TWRP and root as per jcadduono’s thread then visit this link, have a read then downloading the file from the Dropbox link provided. Install the latest […]

  13. Guest Avatar
    Guest

    Tq… Worked on S5 g900f lollipop 5.0

  14. Sohnish Avatar
    Sohnish

    Tq… Worked on S5 g900f lollipop 5.0

  15. Guest Avatar
    Guest

    I don’t have /system/su.d. I check SuperSu and it says I am running SuperSu in systemless root mode. It isn’t possible to do a system install in through SuperSu. How do I get around this?

    1. Guest Avatar

      I had the same problem. I’m not familiar with SuperSU but I guess the ‘systemless’ part involves to not modify the /system partition. I found that the su configuration folder and the supolicy executable are both located in /su on my phone (a Honor 5C running Android 6.0). I could make it work by adapting the original commands:

      su
      mount -o rw,remount /su
      cd /su/su.d
      echo ‘#! /system/bin/sh’ > 50viper.sh
      echo ‘/su/bin/supolicy –live “allow mediaserver mediaserver_tmpfs:file { read write execute };”‘ >> 50viper.sh
      chown root.root 50viper.sh
      chmod 755 50viper.sh
      cd /
      mount -o ro,remount /su
      exit

      BTW for the OP: since the commands are invoked as root I’m pretty sure the chown command isn’t necessary. And thanks a lot for this workaround!

  16. Husker Avatar
    Husker

    I don’t have /system/su.d. I check SuperSu and it says I am running SuperSu in systemless root mode. It isn’t possible to do a system install in through SuperSu. How do I get around this?

    1. sclarckone Avatar
      sclarckone

      I had the same problem. I’m not familiar with SuperSU but I guess the ‘systemless’ part involves to not modify the /system partition. I found that the su configuration folder and the supolicy executable are both located in /su on my phone (a Honor 5C running Android 6.0). I could make it work by adapting the original commands:

      su
      mount -o rw,remount /su
      cd /su/su.d
      echo ‘#! /system/bin/sh’ > 50viper.sh
      echo ‘/su/bin/supolicy –live “allow mediaserver mediaserver_tmpfs:file { read write execute };”‘ >> 50viper.sh
      chown root.root 50viper.sh
      chmod 755 50viper.sh
      cd /
      mount -o ro,remount /su
      exit

      BTW for the OP: since the commands are invoked as root I’m pretty sure the chown command isn’t necessary. And thanks a lot for this workaround!

  17. Guest Avatar
    Guest

    Works using TWRP 3.0.2.0 on my Sprint Galaxy Note 4 running stock rooted Android 6.0.1 (N910PVPS4DPD1) and now the Driver Status finally shows NORMAL instead of Abnormal!

  18. Dave Avatar

    Works using TWRP 3.0.2.0 on my Sprint Galaxy Note 4 running stock rooted Android 6.0.1 (N910PVPS4DPD1) and now the Driver Status finally shows NORMAL instead of Abnormal!

  19. Guest Avatar
    Guest

    Works on HTC 10 also! I used audio_effect.conf from Samsung. Rename the original file from Htc: htc_audio_effect.conf to htc_audio_effect.bak in case you want to go back. Rename the Samsung file to htc_audio_effect.conf Reboot the device and have fun!

  20. Xenion Avatar
    Xenion

    Works on HTC 10 also! I used audio_effect.conf from Samsung. Rename the original file from Htc: htc_audio_effect.conf to htc_audio_effect.bak in case you want to go back. Rename the Samsung file to htc_audio_effect.conf Reboot the device and have fun!

  21. Guest Avatar

    I installed viper4android selinux policy fix.zip on galaxy s4 i9505 lollipop 5.0.1. But selinux mode did not change to permissive.selinux mode still to enforcing mode.
    Please help me to fix this issue

  22. Zohaib Avatar

    I installed viper4android selinux policy fix.zip on galaxy s4 i9505 lollipop 5.0.1. But selinux mode did not change to permissive.selinux mode still to enforcing mode.
    Please help me to fix this issue

  23. albie Avatar

    Can i use this zip for miui 7.5 running on marshmallow … my device is xiaomi mi3…thanks in advance

    1. Androiding Staff Avatar
      Androiding Staff

      It might not work. Why not use the ADB method, instead.

  24. Guest Avatar

    Can i use this zip for miui 7.5 running on marshmallow … my device is xiaomi mi3…thanks in advance

    1. Androiding Staff Avatar
      Androiding Staff

      It might not work. Why not use the ADB method, instead.

  25. Guest Avatar

    Can i use this zip for miui 7.5 running on marshmallow … my device is xiaomi mi3…thanks in advance

  26. albie Avatar

    Can i use this zip for miui 7.5 running on marshmallow … my device is xiaomi mi3…thanks in advance

  27. saigon Avatar
    saigon

    Works on Samsung Note 4 N910C rooted stock rom Marshmallow 6.0.1 with Busybox installed. MUST flash viper4android selinux policy fix.zip with TWRP recovery version 3.0.2.0, flash with CWM recovery WILL NOT work

  28. Guest Avatar

    Works on Samsung Note 4 N910C rooted stock rom Marshmallow 6.0.1 with Busybox installed. MUST flash viper4android selinux policy fix.zip with TWRP recovery version 3.0.2.0, flash with CWM recovery WILL NOT work

  29. Guest Avatar

    Works on Samsung Note 4 N910C rooted stock rom Marshmallow 6.0.1 with Busybox installed. MUST flash viper4android selinux policy fix.zip with TWRP recovery version 3.0.2.0, flash with CWM recovery WILL NOT work

  30. saigon Avatar
    saigon

    Works on Samsung Note 4 N910C rooted stock rom Marshmallow 6.0.1 with Busybox installed. MUST flash viper4android selinux policy fix.zip with TWRP recovery version 3.0.2.0, flash with CWM recovery WILL NOT work

  31. Guest Avatar

    […] soon came a workaround to use ViPER4Android on Lollipop while still running SELinux in enforcing mode (to ensure device security). The trick worked on […]

  32. Guest Avatar

    […] soon came a workaround to use ViPER4Android on Lollipop while still running SELinux in enforcing mode (to ensure device security). The trick worked on […]

  33. Chris J Avatar

    I tried the adb method on a Samsung Galaxy S4 active and it only works sometimes. How do I reverse it?

  34. Guest Avatar

    I tried the adb method on a Samsung Galaxy S4 active and it only works sometimes. How do I reverse it?

  35. Guest Avatar

    I tried the adb method on a Samsung Galaxy S4 active and it only works sometimes. How do I reverse it?

  36. Chris J Avatar
    Chris J

    I tried the adb method on a Samsung Galaxy S4 active and it only works sometimes. How do I reverse it?

  37. uqurb2 Avatar

    Samsung a5 2016 6.0.1 failed “custom binary blocked by frp”

  38. Guest Avatar

    Samsung a5 2016 6.0.1 failed “custom binary blocked by frp”

  39. Guest Avatar

    Samsung a5 2016 6.0.1 failed “custom binary blocked by frp”

  40. uqurb2 Avatar

    Samsung a5 2016 6.0.1 failed “custom binary blocked by frp”

  41. marc sijbrands Avatar
    marc sijbrands

    The su command was not working on my windows pc.
    so i tried several things.

    Then this is what i did.
    Opened terminal from the adb folder.
    then typed adb devices to see if my device is connected the right way.
    after this i typed adb shell to make the connection.
    and after these steps i can use the commands as told in the discription above.

    I am using cm13 snapshot

  42. Guest Avatar

    The su command was not working on my windows pc.
    so i tried several things.

    Then this is what i did.
    Opened terminal from the adb folder.
    then typed adb devices to see if my device is connected the right way.
    after this i typed adb shell to make the connection.
    and after these steps i can use the commands as told in the discription above.

    I am using cm13 snapshot

  43. Guest Avatar

    The su command was not working on my windows pc.
    so i tried several things.

    Then this is what i did.
    Opened terminal from the adb folder.
    then typed adb devices to see if my device is connected the right way.
    after this i typed adb shell to make the connection.
    and after these steps i can use the commands as told in the discription above.

    I am using cm13 snapshot

  44. marc sijbrands Avatar
    marc sijbrands

    The su command was not working on my windows pc.
    so i tried several things.

    Then this is what i did.
    Opened terminal from the adb folder.
    then typed adb devices to see if my device is connected the right way.
    after this i typed adb shell to make the connection.
    and after these steps i can use the commands as told in the discription above.

    I am using cm13 snapshot

  45. marc sijbrands Avatar
    marc sijbrands

    Correction!! It does not work!!

  46. Guest Avatar

    Correction!! It does not work!!

  47. Guest Avatar

    Correction!! It does not work!!

  48. marc sijbrands Avatar
    marc sijbrands

    Correction!! It does not work!!