Set enforcing to permissive - Samsung Galaxy S7 Edge Questions and Answers

I have rooted my SM-G935F on stock rom and have been wondering if it's possible to change SE to permissive without installing a different kernel?
I found this post which suggested the following in TE:
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
Someone tried it and said their phone became a bit slow afterwards.
Are there any other solutions or workarounds please?
If flashing a modified kernel is the only option, can anyone recommend one please and would it result in losing any data?
Thanks

just do it ok

I've been using this kernel with latest Samsung stock firmware:
https://forum.xda-developers.com/s7-edge/development/kernel-tgpkernel-t3501571
Anyway, you should always backup your data before flashing you can use Smart Switch for that one click backup.
Kernel is very stable, been running it for some time. With that kernel you can switch the enforcing / permissive thing. And as always keep OEM unlocking on enable and verify it is before flashing. Never disable developer options or OEM unlocking when you have a custom kernel / recovery installed.

Related

[TIPS] Set up Natural color on AMOLED with custom ROM

Want to switch to Natural mode colors on your recently Cyanogenmoded phone ?
Tested on Galaxy Note 2 N-7100 CM10 but it should work any Android 4.1+ Samsung AMOLED phone.
Open a shell on your phone
HTML:
echo 2 > /sys/class/mdnie/mdnie/mode
echo 2 > /sys/class/mdnie/mdnie/scenario
You should have the right colors (Natural mode)
How to make it directly at boot :
HTML:
su
mount -o remount,rw / && mount -o remount,rw /system
echo "#!/system/bin/sh
echo 2 > /sys/class/mdnie/mdnie/mode
echo 2 > /sys/class/mdnie/mdnie/scenario
" > /etc/init.d/99color
chmod 755 /etc/init.d/99color
mount -o remount,ro / && mount -o remount,ro /system
Original source here :
mathieumeuh said:
Want to switch to Natural mode colors on your recently Cyanogenmoded phone ?
Tested on Galaxy Note 2 N-7100 CM10 but it should work any Android 4.1+ Samsung AMOLED phone.
Open a shell on your phone
HTML:
echo 2 > /sys/class/mdnie/mdnie/mode
echo 2 > /sys/class/mdnie/mdnie/scenario
You should have the right colors (Natural mode)
How to make it directly at boot :
HTML:
su
mount -o remount,rw /
mount -o remount,rw /system
echo "#!/system/bin/sh
echo 2 > /sys/class/mdnie/mdnie/mode
echo 2 > /sys/class/mdnie/mdnie/scenario
" > /etc/init.d/99color
chmod +x /etc/init.d/99color
mount -o remount,ro /
mount -o remount,ro /system
Original source here :
Click to expand...
Click to collapse
thanks a lot. i can use it on my 4.3 mokee rom and neak kernel
Sent from my GT-N7100 using xda premium
Awesome Tips... I didn't know that on Other than Sammy based rom can use color mode
THanks for this Valuable Information
I tried this on my cm-10.1.3 Samsung Galaxy 2 phone (android 4.2.2) and it wouldn't write. I opened up the files themselves with vim and tried, and got some errors:
After successfully getting superuser, it told me a swap file couldnt be recovered (i hadnt even opened the file before). Then after the changes and trying to write&quit, it said
Code:
"mod" E509: Cannot create backup file (add ! to override)
Press ENTER or type command to continue
So i did :wq! and then
Code:
"mode" E667: Fsync failed
WARNING: Original file may be lost or damaged
don't quit the editor until the file is successfully written!
I quit. The file "mode" is still there, and the command "cat" reveals it still has one line, one character, being "0" (like it originally had).
There is also a GUI controller under System Settings > Advanced Settings under the "Color" heading, but changing anything doesnt seem to have an affect. I wonder if it's related to the "fsync" error.
I would upgrade to 10.2, but i just read that 10.2 has the system menu entry removed, so mdnie can only be controlled by command line. Lame.
gatchipatchi said:
I tried this on my cm-10.1.3 Samsung Galaxy 2 phone (android 4.2.2) and it wouldn't write. I opened up the files themselves with vim and tried, and got some errors:
After successfully getting superuser, it told me a swap file couldnt be recovered (i hadnt even opened the file before). Then after the changes and trying to write&quit, it said
Code:
"mod" E509: Cannot create backup file (add ! to override)
Press ENTER or type command to continue
So i did :wq! and then
Code:
"mode" E667: Fsync failed
WARNING: Original file may be lost or damaged
don't quit the editor until the file is successfully written!
I quit. The file "mode" is still there, and the command "cat" reveals it still has one line, one character, being "0" (like it originally had).
There is also a GUI controller under System Settings > Advanced Settings under the "Color" heading, but changing anything doesnt seem to have an affect. I wonder if it's related to the "fsync" error.
I would upgrade to 10.2, but i just read that 10.2 has the system menu entry removed, so mdnie can only be controlled by command line. Lame.
Click to expand...
Click to collapse
Do not try to open this file, it's not really a file. Just push the value to it.

[SOLVED] EFS empty - no Backup - no lockscreen/powermenu - EMEI works

Hi guys,
A friend of mine recently rooted his I9505 and tried to install a custom Rom.
He made an Nandroid backup of his Stock rom but TWRP wasn't able to mount /efs.
So he ignored it and made a Backup without checking /efs.
As he installed a custom Rom he did something wrong and wasn't able to boot system.
So he went back to stock rom.
The Problem now is that his /efs folder is empty and he has no lockscreen and powermenu.
But the strange thing is that he has no problems with IMEI or Baseband.
Is it somehow possible to get his /efs files back?
Or at least get his lockscreen an powermenu back working?
He would be even happy with and alternative lockscreen and powermenu. maybe a app?
I hope someone can help us
Thank you very much in advance for your answers
SOLVED:
I tried many different methods so i don't really know which one worked.
But here are several methods you can try if you have the same problem:
Method 1:
Code:
su
busybox mount /efs
echo -n ON > /efs/FactoryApp/keystr
echo -n ON > /efs/FactoryApp/factorymode
reboot
Method 2:
Code:
su
mke2fs /dev/block/mmcblk0p10
mount -w -t ext4 /dev/block/mmcblk0p10
echo -n ON > /efs/FactoryApp/keystr
echo -n ON > /efs/FactoryApp/factorymode
reboot
Method 3:
Code:
su
mount -w -t ext4 /dev/block/mmcblk0p10
echo -n ON > /efs/FactoryApp/keystr
echo -n ON > /efs/FactoryApp/factorymode
reboot
Try them all and one of them should work
Try a factory reset. If that doesn't work odin to stock should get you fixed up
Sent from my Nexus 10
9233 said:
Hi guys,
A friend of mine recently rooted his I9505 and tried to install a custom Rom.
He made an Nandroid backup of his Stock rom but TWRP wasn't able to mount /efs.
So he ignored it and made a Backup without checking /efs.
As he installed a custom Rom he did something wrong and wasn't able to boot system.
So he went back to stock rom.
The Problem now is that his /efs folder is empty and he has no lockscreen and powermenu.
But the strange thing is that he has no problems with IMEI or Baseband.
Is it somehow possible to get his /efs files back?
Or at least get his lockscreen an powermenu back working?
He would be even happy with and alternative lockscreen and powermenu. maybe a app?
I hope someone can help us
Thank you very much in advance for your answers
Click to expand...
Click to collapse
efs is not empty. you can not see inside because it is not mounted.
root the device, install terminal emulator. type:
Code:
su
mount /efs
mount -o remount,rw /efs
echo -n ON > /efs/FactoryApp/keystr
echo -n ON > /efs/FactoryApp/factorymode
reboot
samersh72 said:
efs is not empty. you can not see inside because it is not mounted.
root the device, install terminal emulator. type:
Code:
su
mount /efs
mount -o remount,rw /efs
echo -n ON > /efs/FactoryApp/keystr
echo -n ON > /efs/FactoryApp/factorymode
reboot
Click to expand...
Click to collapse
mount /efs is not working. I'm getting this Error Message:
http://dl.xda-developers.com/attachdl/8c9fb4bc3dc504c869fd2aebc109f0df/523b4bef/2/2/6/8/9/0/0/IMG-20130919-WA0003.jpg
9233 said:
mount /efs is not working. I'm getting this Error Message:
http://dl.xda-developers.com/attachdl/8c9fb4bc3dc504c869fd2aebc109f0df/523b4bef/2/2/6/8/9/0/0/IMG-20130919-WA0003.jpg
Click to expand...
Click to collapse
try without mounting: "su" then the "echo"
if not try mounting with these commands:
Code:
su
mke2fs /dev/block/mmcblk0p10
mount -w -t ext4 /dev/block/mmcblk0p10
reboot
if not, ignore mke2fs...... line
samersh72 said:
try without mounting: "su" then the "echo"
if not try mounting with these commands:
Code:
su
mke2fs /dev/block/mmcblk0p10
mount -w -t ext4 /dev/block/mmcblk0p10
reboot
if not, ignore mke2fs...... line
Click to expand...
Click to collapse
Thank you.
I don't have the phone here so i'll try it tomorrow and see what happens.
Your mount command didn't work because you are using the /system/bin/mount that is a part of Android. This version must get the device name and the mount point, you cannot omit one of them (with busybox mount you can omit one or the other).
I had the EXACT problem and already started a thread.
There was a lot of help given to me, try reading through my thread mate.
http://forum.xda-developers.com/showthread.php?t=2388663
In the end it turned out my EFS partition was so corrupt it had to go to service centre.
Sent from my GT-I9505 using XDA Premium HD app
Hi guys,
I tried it with the following and it works!!!
Code:
su
busybox mount /efs
echo -n ON > /efs/FactoryApp/keystr
echo -n ON > /efs/FactoryApp/factorymode
reboot
Thank you all for your Help and have a nice day!

i9506 I9506XXUCNJ1 - SElinux whatever I try, stays Enforcing

Hello, I have a huge problem with this firmware - but just a particular one. I had tried to go to the 5.0.1 (I9506XXUDOE4) where it worked fine, but I didn't like the UI and the OTG functionality didn't work at all.
I have moved back to the older ROM I was using before, running selinux in enforcing mode with a major problem - not able to write on NTFS formatted devices. Actually, a little problem was also on the Lollipop firmware with the CF AutoRoot but DeHAWK kernel solved it. Therefore I tried to move back on I9506XXUCNJ1 and decided to try this kernel out if it helps - but it didn't.
The SElinux status isn´t even showed up in the "About device" section.
What I tried already:
Paragorn SElinux set to Permissive (see screenshots what it does)
init.d 01selinux script
SELinuxModeChanger (changes back to enforcing when I start it again - actually does nothing)
CODE1:
Code:
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
CODE2:
Code:
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
Please help
A little bump, please help.

Is there a way to Set SELinux to Permissive on Galaxy S7 Edge, Stock, Rooted?

As the title says it all, is there a way to Set SELinux to Permissive on Galaxy S7 Edge, Stock, Rooted?
Any adb shell commands or do I need a modified stock kernel for this?
I have tried the commands SETENFORCE 0 but without success.
Use a terminal emulator or ADB to type these commands:
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
Of course you will need to be Rooted (SuperSU)
@dave7802 I followed the exact steps but after reboot my S7 has become too slow. How can i revert back the changes? please help

Make Viper4Android 2.4.0.1 work on Android 6.0

I had some trouble trying to make Viper4Android v2.4.0.1 work on my Honor 5C running Android 6.0. This could be helpful…
Viper4Android didn't work after installation and reboot, the driver status showing as "abnormal". It seems related to a change in default SELinux policy.
I read that changing globally the SELlinux policy to "permissive" can solve the problem but it may be an extreme solution (SELinux is a security feature to restrict what an application can do, I don't know the potential edge effects).
I found another solution on the web, which consists in patching the SELinux policies at boot, just enough for Viper4Android to work.
If you did not make a systemless installation of SuperSU, open an adb shell and use these commands (courtesy of androiding.how):
Code:
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
chmod 755 50viper.sh
cd /
mount -o ro,remount /system
And reboot.
If you did make a systemless installation of SuperSU, open an adb shell and use this instead:
Code:
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
chmod 755 50viper.sh
cd /
mount -o ro,remount /su
exit
And reboot.
Didn't work for me, tried the 2nd method as the first one gave an error at the 3rd step, completed everything, rebooted, still no luck
imrock said:
Didn't work for me, tried the 2nd method as the first one gave an error at the 3rd step, completed everything, rebooted, still no luck
Click to expand...
Click to collapse
I just noticed that in my 2nd block the characters ’ and ” were used instead of ' and ". I'm not a POSIX shell expert but since these are not the same characters it can make a difference.
I've updated the 2nd method, you can give it a try — you can use it "as it is", it will overwrite the previously created file.
This trick didn't work for me.
I ended up installing SELinuxModeChanger and now Viper is rockin' :good:

Categories

Resources