Remove All Ads from XDA

[How to] Set Selinux to permissive on boot

806 posts
Thanks Meter: 450
 
By padhu1989, Senior Member on 18th February 2015, 05:13 PM
Post Reply Email Thread
Everyone ecxited about xposed framework released for lollipop.. But there are many facing problems installing framework because of SELinux set to enforce by default.

You can check you Selinux status in settings - About phone

You can set the SELinux to Permissive temporarily by running the bellow two commands in Terminal emulator

su
setenforce 0

But it SElinux will change to default once you hard reboot your phone.. In order to keep it in permissive, you need to soft reboot always whenever reboot needed and it's quite annoying..

So I found a workaround to Set the SELinux to permissive on boot itself.

For this you need to have init.d support.. If you don't have just install it via universal init.d tool available in xda.. (just do a search, u will get it) install universal init.d and activate init.d..

Then go to /etc/init.d directory, create a file and rename it as "08setperm" (without quotes) and add the below lines in the file and save it..

#!/system/sh
setenforce 0

And give full permission (rwxrwxrwx) .. Use root Explorer to edit and give permissions..

Now hard reboot your phone and you can see SELinux is set to "permissive" on boot itself..

Now install Xposed framework by following the steps mentioned in the official xposed thread..

This method is tested in moto G and working fine for me... I'm not responsible for anything if happened with your mobile after trying this..

Ps: if you flash any new nightly or new rom, you need to add the file in to init.d directory again..

I posted this using my mobile. So pardon me if any formatting issues..

Hit thanks if i helped you..
The Following 214 Users Say Thank You to padhu1989 For This Useful Post: [ View ] Gift padhu1989 Ad-Free
 
 
18th February 2015, 05:54 PM |#2  
Senior Member
Thanks Meter: 656
 
More
Very obviously, can't set permissive on Galaxy S5. Hopefully soon though.
The Following 5 Users Say Thank You to ldeveraux For This Useful Post: [ View ] Gift ldeveraux Ad-Free
20th February 2015, 03:11 PM |#3  
Senior Member
Flag Louisville
Thanks Meter: 196
 
More
Thanks, I was looking for the enforce command to make a script. It worked perfectly for me on an S4.
The Following 2 Users Say Thank You to LGtMgG2t For This Useful Post: [ View ] Gift LGtMgG2t Ad-Free
20th February 2015, 03:53 PM |#4  
padhu1989's Avatar
OP Senior Member
Flag Chennai
Thanks Meter: 450
 
More
Quote:
Originally Posted by LGtMgG2t

Thanks, I was looking for the enforce command to make a script. It worked perfectly for me on an S4.

Press thanks button dude instead of saying it..
The Following 9 Users Say Thank You to padhu1989 For This Useful Post: [ View ] Gift padhu1989 Ad-Free
21st February 2015, 03:07 AM |#5  
Zwulf's Avatar
Senior Member
Thanks Meter: 315
 
More
Doesn't work on Z3 Compact (D5803) CM12 nightly.
21st February 2015, 09:02 PM |#6  
Junior Member
Thanks Meter: 0
 
More
Nexus 6
"Alright So i have everything down according to your installation guide, When i want to set the file "08setperm" is when root browser tells me that the operation failed even though it has SU Granted."
Okay so I did some tinkering, Got it to work Reboot but after the 2nd Reboot it Boot-looped, On my Nexus But it can work .
22nd February 2015, 01:37 AM |#7  
padhu1989's Avatar
OP Senior Member
Flag Chennai
Thanks Meter: 450
 
More
Quote:
Originally Posted by Scriptkiddie7

"Alright So i have everything down according to your installation guide, When i want to set the file "08setperm" is when root browser tells me that the operation failed even though it has SU Granted."
Okay so I did some tinkering, Got it to work Reboot but after the 2nd Reboot it Boot-looped, On my Nexus But it can work .

Upgrade your root Explorer or super Su and try
22nd February 2015, 05:18 PM |#8  
Senior Member
Thanks Meter: 704
 
More
Using the commands below should get permissive even after reboot
per http://forum.xda-developers.com/show...&postcount=230

su
mount -o remount,rw /system
mkdir /system/su.d
echo "#!/system/bin/sh" > /system/su.d/permissive.sh
echo "echo 0 > /sys/fs/selinux/enforce" >> /system/su.d/permissive.sh
chmod 755 > /system/su.d/permissive.sh
The Following 24 Users Say Thank You to aalupatti For This Useful Post: [ View ] Gift aalupatti Ad-Free
22nd February 2015, 05:21 PM |#9  
mattdm's Avatar
Senior Member
Thanks Meter: 457
 
More
Quote:
Originally Posted by Zwulf

Doesn't work on Z3 Compact (D5803) CM12 nightly.

Which part didn't work? As far as I can tell, we don't have init.d support on the Z3 Compact yet. Was it the Universal init.d Tool that didn't work for you?
22nd February 2015, 11:25 PM |#10  
Quote:
Originally Posted by mattdm

Which part didn't work? As far as I can tell, we don't have init.d support on the Z3 Compact yet. Was it the Universal init.d Tool that didn't work for you?

CM has init.d support buddy.
The Following User Says Thank You to was12 For This Useful Post: [ View ] Gift was12 Ad-Free
23rd February 2015, 01:23 AM |#11  
Zwulf's Avatar
Senior Member
Thanks Meter: 315
 
More
Quote:
Originally Posted by aalupatti

Using the commands below should get permissive even after reboot
per http://forum.xda-developers.com/show...&postcount=230

su
mount -o remount,rw /system
mkdir /system/su.d
echo "#!/system/bin/sh" > /system/su.d/permissive.sh
echo "echo 0 > /sys/fs/selinux/enforce" >> /system/su.d/permissive.sh
chmod 755 > /system/su.d/permissive.sh

Doesn't work this way. You should have read following posts.

Solution:
Quote:

su
mount -o remount,rw /system
mkdir /system/su.d
echo "#!/system/bin/sh" > /system/su.d/permissive.sh
echo "setenforce 0" > /system/su.d/permissive.sh
echo "0" > /sys/fs/selinux/enforce
chmod 755 /system/su.d/permissive.sh

Works!
Finally got a permissive system on reboot.

Edit: Doesn't help to get XPosed working on my Z3C though.
The Following 29 Users Say Thank You to Zwulf For This Useful Post: [ View ] Gift Zwulf Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes