Hello everyone!
Making another guide, this time on how to fix RIL on CM12 based roms e.g. Vanir and FXP.
The cause of the problem is once again SELinux and the fix is rather simple... let's go!
Before we start there is one crucial requirement! :
Do you have a SIM PIN set? If YES just continue reading. If NO, please set one BEFORE flashing a CM12 ROM.
We need to be able to set SELinux to permissive before the phone attempts to access the SIM card or it will not work! If you have a PIN set, your phone will not "try" to load it till you entered the PIN and that gives SELinux mode changer the time to change the mode! If you have no PIN set the phone will load the SIM card almost immediately and the app is not quick enough to set the mode to permissive before it loads the SIM! Users with no SIM PIN can try "method 2"
Steps:
METHOD1:
1: Install a build of your choice (Vanir/FXP, and no this fix is not for locked bootloader CM12 roms like RR, there is another fix for those roms!).
2: Once your device has booted up, turn off auto brightness to prevent your phone from rebooting while doing these steps. (your phone will soft-reboot once after disabling auto brightness)
3: Download and install SELinux mode changer from here: Google Play (or any other app that is able to set SELinux to permissive on boot.)
4: Open the app grant root access and check the "show notification" Checkbox.
5: Fully reboot your device and WAIT on the lockscreen till the app says that it changed the SELinux mode to permissive!!!
6: Enter your SIM PIN and you should be ready to go!
METHOD2:
1: Create a new script file in /system/su.d.
2: Put this inside of the file:
Code:
#!/system/bin/sh
echo 0 > /sys/fs/selinux/enforce
3: Set correct permissions.
4: Reboot
(this method was not comfirmed by me! And it might not work, can someone try it?)
Remaining bugs:
1: When you call someone or you get called, the sound will be glitchy!
2: Auto-brightness still does not work!
3: More?
The fix was found by : @AndreAkaNick
Method2 found by @jojos10
Enjoy CM12!,
Noahvt
credits to @AndreAkaNick
Gara91 said:
credits to @AndreAkaNick
Click to expand...
Click to collapse
I almost forgot, thank you
@noahvt
The call gets really bad? You can hear the person on the other side?
lvints said:
@noahvt
The call gets really bad? You can hear the person on the other side?
Click to expand...
Click to collapse
Let me try that for a sec. I'll report when I get back AKA when my phone boots up to FXP 24/02
what if I run su setenforce 0 in terminal and reboot? Do I still need to set SIM PIN then?
vvaklnprm said:
what if I run su setenforce 0 in terminal and reboot? Do I still need to set SIM PIN then?
Click to expand...
Click to collapse
I tried that and it doesn't work...
After reboot selinux returns to enforcing...
How to make permissive selinux with init.d script?
I'm too lazy to download selinux mode changer
Or you can use this init.d script:
Code:
#!/system/bin/sh
echo 0 > /sys/fs/selinux/enforce
Or if init.d doesn't work in your ROM (like current FXP-CM12), you can install SuperSU and put the script in /system/su.d directory.
This way, there is no need to worry about SIM PINs and whatnot.
jojos10 said:
Or you can use this init.d script:
Code:
#!/system/bin/sh
echo 0 > /sys/fs/selinux/enforce
Or if init.d doesn't work in your ROM (like current FXP-CM12), you can install SuperSU and put the script in /system/su.d directory.
This way, there is no need to worry about SIM PINs and whatnot.
Click to expand...
Click to collapse
could you please make a flashable zip?
also how to get rid of cyanogen recovery? cant install anything
2 not working....but wait...what name this file should have?RIL?RIL fix?
The second fix will not work if Google Now is activated.
I get an error that Google (Now) has a network error while my data and radio works.
dimitrakhs1 said:
2 not working....but wait...what name this file should have?RIL?RIL fix?
Click to expand...
Click to collapse
2 only works if you have flashed chainfire's supersu zip and you can choose any name you like for the .sh file
Sent from my Nexus 7 using XDA Free mobile app
Yeah,but it don't need it in this version,it's pre-rooted already(Resurrection v5.3.6).You suggest flashing this anyway?
dimitrakhs1 said:
Yeah,but it don't need it in this version,it's pre-rooted already(Resurrection v5.3.6).You suggest flashing this anyway?
Click to expand...
Click to collapse
You can flash it if you want. I didn't flash it and now I'm using SELinux Mode Changer.
I have tried the 1st method
It works also on RR 5.3.6 #1 build by Furrydaus
jojos10 said:
Or you can use this init.d script:
Code:
#!/system/bin/sh
echo 0 > /sys/fs/selinux/enforce
Or if init.d doesn't work in your ROM (like current FXP-CM12), you can install SuperSU and put the script in /system/su.d directory.
This way, there is no need to worry about SIM PINs and whatnot.
Click to expand...
Click to collapse
I kept trying with FXP CM12 9th Feb , did all the above but RIL still not working.
edit - copied accidentally with a space behind the sh on the first line, hence wasn;t working. Everything works!
does not able to set 3g .. on latest vanir
hey im using latest vanir ... 5.0.2 022715 .. and tried the first method .. set a sim pin .. and it works but when i turn on data ... and set to 3g .. it reboot(screen fade out slowly ) and now when it reboot and again asked for the pin .. and i entered my pin then again it reboots
-EDIT-
it works, accidentally had a space behind the first line of the script hence it didn't work.
Guys my apologies.
Tested again. Turns out the script is not activating no matter what was done - permission set correctly (RWX RX RX chmod755), SuperSU flashed and set on boot, script inside /system/su.d folder. SELinux status keeps being on enforcing.
where can I find the system / su.d
Sent from my Xperia SP using XDA Free mobile app
Feature list
- sets hostname to LG-G4 something that was missing at first from lineage/aosp 7.1.1 (maybe i will remove that)
- Better mount point flags
- Internal storage:
nomerges
nr_requests
lower safe read_ahead_kb
cfq scheduler
cfq scheduler tweaks
remove add_random (if its enabled in the kernel by default)
rq_affinity
- external storage:
nomerges
nr_requests
lower safe read_ahead_kb
cfq scheduler
cfq scheduler tweaks
remove add_random (if its enabled in the kernel by default)
rq_affinity
- Net and virtual memory:
tcp_congestion_control
disable_ipv6
dirty_writeback_centisecs
dirty_expire_centisecs
dirty_background_ratio
dirty_ratio
drop_caches
kernel.panic
min_free_kbytes
overcommit_ratio
panic_on_oom
swappiness 0 #llama doesn't have zram feature, it's useless on Lg G4
vfs_cache_pressure
- CPU customisations ~depends on your choice of script~
balanced ~doesn't make any cpu changes~
less ~for less battery drain, cpu rests more~
more-less ~for a lot less battery drain, but with a big lag (will soon try fix stability and smoothness)~
performance ~for full cpu power, but rest when the screen is off~
- Kernel customisations
msm_thermal ~off on battery save / on and set a safe temp. for performance~
lowmemorykiller
read_wakeup_threshold
write_wakeup_threshold
hotplug customisation
- Only the safe internet customisations
tcp_timestamps
tcp_tw_reuse
tcp_sack
tcp_tw_recycle
tcp_window_scaling
tcp_keepalive_probes
tcp_keepalive_intvl
tcp_fin_timeout
For stock based roms follow the guide in post #2
How to "install" it ? Simple
1.unzip
2.place it in /system/etc/init.d
Code:
adb root
adb remount
adb push <your tweak> system/etc/init.d/
3.change its permissions to 755
4.lastly change owner:group to root:shell
Code:
adb shell
su
mount -o remount rw /system
chmod 755 /system/etc/init.d/<your tweak>
chown root:shell /system/etc/init.d/<your tweak>
If you don't have a pc, type in a terminal inside your g4
Code:
su
mount -o rw remount /system
chmod 755 /system/etc/init.d/<your tweak>
chown root:shell /system/etc/init.d/<your tweak>
Those of you that use the new systemless root method of chainfire you can put the script in /system/su.d or in /su/su.d with permissions 700 (same permissions at folder and script) and set owner:group to root:root
Those of you that use the new magisk root method you can put the script in /magisk/.core/service.d/ with the same permissions and ownership as in init.d
Those coming using search bar and don't have this phone and this kernel, don't try it, unless you know what to edit to "fit" your own kernel.
These tweaks aren't just for faster easy setting up our phone, they are more useful for those that don't want to have root access ON, for various personal reasons. They can apply those settings on boot and setup their phone without the need of root and an app asking for root.
Easy removal: delete the script and reboot. And never use more than one of these scripts inside init.d
Careful, some stock based roms have preinstalled some scripts inside init.d by default.
Those must be removed after flashing Llama Sweet Kernel. They are not compatible and they cause instability !
BIG Thanks to this genius
@genesixxbf3
for his kernel to our lg g4.
XDA:DevDB Information
[Tweaks][MM/N][H815][H811]Kernel Tweaks[CM/STOCK/AOSP], Tool/Utility for the LG G4
Contributors
kessaras, genesixxbf3
Version Information
Status: Stable
Created 2016-12-09
Last Updated 2017-04-25
Reserved
This is a guide for ALL stock based roms and all kernels.
My script will only add tweaks that apply to all kernels.
For those that are rooted with SuperSu, they must first fully remove it.
Nub guide to change SuperSu for Magisk root:
Step 1.
SuperSu must be removed.
Go into supersu -> settings -> fully remove root access.
###Or download and flash in recovery mode the UnSu script from osm0sis thread.###
Step 2.
Use hardware key combination to boot to TWRP.
###If you used the UnSu script, no need to reboot to recovery, skip step 2 and go to next one.###
Step 3.
Flash latest magisk flashable zip for users that are not rooted yet.
It sais: "If you're not rooted, or something went wrong and you need a clean start"
Download that .zip file and flash it.
Now you are rooted again. Reboot to your rom.
Step 4.
Download Magisk Manager from play store. In that app you can even enable systemless root to hide root from the apps, or do many things that you like.
Questions further go to magisk thread not here. And don't forget to re-enable usb debugging. After you removed root, that was toggled, ###Unless you used the UnSu script again. That means that before reboot you were already rooted.###
Now it's time to install your script.
Download the compressed tweak from this post , uncompress it and follow the next guide.
The steps are the same with the lineage based roms and it works for ALL lineage based roms too
If you use a root file manager then you can skip the guide and just cut - paste the script in /magisk/.core/service.d/
set permissions to 755, ownership to root:shell and reboot.
INSTALLATIONStep 1.
place it in /magisk/.core/service.d/
Code:
adb push /<path to the script>/90balanced /sdcard/
adb shell
su
mv /sdcard/90balanced /magisk/.core/service.d/
Step 2.change its permissions to 755 if it's not already set to 755 by default
Code:
chmod 755 /magisk/.core/service.d/90balanced
If you don't have a pc, type the same commands in g4 terminal but of course without the adb command. Script is supposed to be in path /sdcard/
not in /sdcard/download/ or whatever path. Otherwise edit the command "mv ..." to match the script path.
That's it. Reboot to apply your tweaks.
~I will add Llama Sweet kernel tweaks for stock based ROMS when Genesixxbf3 fixes the bluetooth issue.
Until then all use this one that applies to all kernels including Llama.
Special thanks to:
@topjohnwu for developing Magisk
and to
@osm0sis for his UnSU script
My scripts are not meant for use with kernel adiutor.
Changelog
31/01/2017
- fixed stability for "90less"
- changed to "westwood" tcp congestion control
01/02/2017
- changed to Fiops scheduler only for the 90less and 90more-less
- fixed stability for 90more-less
12/02/2017
- when screen is on, 3 cores always online not 1.
- fixed stability for 90less , 90more-less
- 90balance, interactive governor stable and at the same time conserving some battery
- big cores governor is same with small cores
15/02/2017 and 20/02/2017
- changed back to cfq scheduler
- added cfq scheduler tweaks
- fixed path to disable ipv6
09/03/2017
- fixed a bug for those that big cores were found disabled on boot
Although this is something caused from dirty flashing and can only be fixed with a clean flash
18/03/2017
- Added better mount point flags for Lineage/Aosp based roms, for f2fs, for those that prefer using f2fs partitions format
- i changed the way the mount points get set, now you don't need busybox if you don't want to.
- bigger timer rate for interactive governor for the balanced tweak, balanced can conserve battery now too.
25/04/2017
- Less-more is not lagging anymore but of course it still loads slow since cpu runs at a lower frequency
- interactive governor in balanced script saves more battery than before
- All scripts now give a small cpu frequency amount on input to reduce lag
- At less and less-more the hotplug sets the cores online at a lower frequency. Before, with those scripts you could rarely see the other cores online
kessaras said:
You can request any setting for kernel and cpu you want. I can add them for you.
Screenshots of battery with 90less.
~Haven't done anything special. Brightness is at normal with "auto" ON, gapps stock, usage: Normal, chat, xda, phone Calls/Messages, GPS ON.
Many factors determine the battery drain, such as 3rd party apps, ads from apps, services and more, don't blame my settings. Those settings are absolute and tested and i only do this to help everyone.
Click to expand...
Click to collapse
Thanks for you work, I am using H818p without BL unlock. Currently, I can modify /etc/init/qcom.post_boot.sh from this thread (http://forum.xda-developers.com/tmo...-msm-8992-cpu-io-ram-interactive-gov-t3351478).
The question is, can I port some tweaks from this thread to the stock kernel using qcom.post_boot ? I am not familiar with the seqence of boot, any idea ?
Thanks,
jskasia said:
Thanks for you work, I am using H818p without BL unlock. Currently, I can modify /etc/init/qcom.post_boot.sh from this thread (http://forum.xda-developers.com/tmo...sm-8992-cpu-io-ram-interactive-gov-t3351478).
The question is, can I port some tweaks from this thread to the stock kernel using qcom.post_boot ? I am not familiar with the seqence of boot, any idea ?
Thanks,
Click to expand...
Click to collapse
Scripts are only for Llama kernel. So,
it depends if the stock kernel has same file "trees". Worst case scenario is to not be able to boot. If you can enter recovery you can fix it by doing :
Code:
rm /system/etc/init.d/<name of the script>
Or use the recovery file manager to delete it,
reboot and you are fine.
Don't use 90less as it is or for sure you won't boot. Less is using alucard governor which doesn't exist in stock. Open script and edit those lines, change alucard to interactive.
"kernel tweaks" delete them. the stock kernel doesn't have same hotplugs and heat protection.
EDIT:
a part of the scripts does work for stock without llama kernel. it's not dangerous because the stock lg rom doesn't have init.d support on boot and the script only can be applied inside kernel adiutor by enabling init.d emulator.
you can use it then. you will just not get the 100% out of it.
in the 90less you wont get the alucard governor and the hotplug to let the cpu rest.
the only alternative available is to make you one that edits the interactive governor to work almost the same as alucard and conserve a bit more battery than the stock interactive does.
@matgesiarz
follow the op
kessaras said:
Scripts are only for Llama kernel. So,
it depends if the stock kernel has same file "trees". Worst case scenario is to not be able to boot. If you can enter recovery you can fix it by doing :
Code:
rm /system/etc/init.d/<name of the script>
Or use the recovery file manager to delete it,
reboot and you are fine.
Don't use 90less as it is or for sure you won't boot. Less is using alucard governor which doesn't exist in stock. Open script and edit those lines, change alucard to interactive.
"kernel tweaks" delete them. the stock kernel doesn't have same hotplugs and heat protection.
Click to expand...
Click to collapse
Okay, I successfully put the tweaks (balance) on to init.qcom.post_boot.sh. My phone boot without any problem. After few days we will see the result.
Thanks
we just need to push scripts or I need also to clean the init.d folder first from other scripts? I am on ChyperOS 3.1.4
If I understand right, if I put this tweak I don't need to setup any kernel modification in apps like EX Kernel manager, isn't?
Vipery said:
we just need to push scripts or I need also to clean the init.d folder first from other scripts? I am on ChyperOS 3.1.4
Click to expand...
Click to collapse
no you don't clean the init.d folder. if you do that you will lose important script that needs the rom to boot. you only use one of those scripts in init.d, if you put 2 of those in, delete the one.
Oletros said:
If I understand right, if I put this tweak I don't need to setup any kernel modification in apps like EX Kernel manager, isn't?
Click to expand...
Click to collapse
exactly and if you need any change and you don't know how to edit the script, you can ask me to add it for you
kessaras said:
no you don't clean the init.d folder. if you do that you will lose important script that needs the rom to boot. you only use one of those scripts in init.d, if you put 2 of those in, delete the one.
Click to expand...
Click to collapse
Thank you. Another thing, I need to set owner and group to shell or just group? The other scripts are set root/shell and not shell/shell.
Vipery said:
Thank you. Another thing, I need to set owner and group to shell or just group? The other scripts are set root/shell and not shell/shell.
Click to expand...
Click to collapse
only what the op sais. only group owner. its already set from me, but you have to at least check if its set, if not, set it. group owner shell
Thanks for the tweaks!
Sorry for this perhaps silly question, but which is supposed to be more battery friendly between balanced and less?
joaste said:
Thanks for the tweaks!
Sorry for this perhaps silly question, but which is supposed to be more battery friendly between balanced and less?
Click to expand...
Click to collapse
less refers to less battery consuption and its only by a little cause we don't want to have lags. Of course we can do it even more battery friendly but we will have a very slow phone.
kessaras said:
less refers to less battery consuption and its only by a little cause we don't want to have lags. Of course we can do it even more battery friendly but we will have a very slow phone.
Click to expand...
Click to collapse
Thanks for the clarification!
kessaras said:
exactly and if you need any change and you don't know how to edit the script, you can ask me to add it for you
Click to expand...
Click to collapse
Thanks
Ok,I applied your 90less tweaks and here's what I've got after reboot:
The big cores governor-interactive,max.freq.-1248
The little cores governor-alucard,max.freq.-1440
MSM Hotplug-OFF
MSM MPDecision Hotplug-ON
Is that ok or...?
welder73 said:
Ok,I applied your 90less tweaks and here's what I've got after reboot:
The big cores governor-interactive,max.freq.-1248
The little cores governor-alucard,max.freq.-1440
MSM Hotplug-OFF
MSM MPDecision Hotplug-ON
Is that ok or...?
Click to expand...
Click to collapse
nothing applied on boot.
in less,
max for the big is set to 1536
and hotplug is off to not get load for nothing since the temp wont go higher than 60 even under the hot summer sun.
kessaras said:
nothing applied on boot.
in less,
max for the big is set to 1536
and hotplug is off to not get load for nothing since the temp wont go higher than 60 even under the hot summer sun.
Click to expand...
Click to collapse
So I should change the max for the little cores to 1536 and everything else is ok?
Vipery said:
Thank you. Another thing, I need to set owner and group to shell or just group? The other scripts are set root/shell and not shell/shell.
Click to expand...
Click to collapse
...
I searched lots of things to make it permissive...
I did this things
1)
/etc/init.d directory, create a file and rename it as 08setperm
2)
Added lines on that file
#!/system/sh
setenforce 0
It did work but when i tried rebooting it didn't...
Im using cm14.1 official..
I can't wipe anything because my storage is full
Twrp doesn't give me permission to do that and says selinux not premssive...
How to do it then?? I want it permanently not for temp purpose
Have you tried SELinux Mode Changer app? http://forum.xda-developers.com/showthread.php?t=2524485
acejavelin said:
Have you tried SELinux Mode Changer app? http://forum.xda-developers.com/showthread.php?t=2524485
Click to expand...
Click to collapse
But that's for temp use bro...
I can't add exposed....
Sagar_1401 said:
But that's for temp use bro...
I can't add exposed....
Click to expand...
Click to collapse
Yes you can. Set it where when the phone boots it notifs you that its changed to permissive. I've used it on LP, MM, and now 7.1. I've used it with Xposed and Viper just fine
I've read a couple posts where folks say they're running their stock rom but with a permissive kernel. I can't seem to find said kernel for the sm-t280. It appears to only be available for the t285.
Is a permissive kernel available for the t280 and if so, where might I find it?
Thanks!
The post was made in one of @_mone's threads for an updated TWRP and Magisk, it is an SELinux Permissive Available kernel.
https://forum.xda-developers.com/showpost.php?p=73181495&postcount=59
_mone said:
Under request of quite few users I've uploaded two boot.img that have a kernel able to set SELinux to permissive.
With Magisk-v12.0 ramdisk patches:
T280XXU0AQA4-Magisk-v12.0-SPA-boot.img
With SuperSU-v2.82 ramdisk patches:
T280XXU0AQA4-SuperSU-v2.82-SPA-boot.img
The tag SPA stands for SELinux Permissive Able, this means that the kernel is able to set SELinux to permissive mode but it is not set by default.
You can set it running from terminal:
Code:
su
setenforce 0
If you want to set SELinux to permissive at boot there are few methods that you can use, you can find them here at xda.
I would like to have feedback about these boot.img as I have not tested them because I'm currently running T280XXU0AQF1 with SuperSU in system mode, and it has a different ramdisk, and I rather skip the pain to restore an old backup of AQA4 and test the images with the different root methods.
Kernel source: https://github.com/underscoremone/android_kernel_samsung_gtexswifi/tree/T280XXU0AQA4-SPA
What I have done is just remove the awful CONFIG_ALWAYS_ENFORCE, a proper custom kernel will may arrive in the near future.
Screenshots are taken from my device running T280XXU0AQF1 with the same kernel included in the boot.imgs shared in this post.
Looking forward for your feedback.. if everything is ok I'll add the link to the OP, if it is not I'll restore the old backup, make the tests for you and provide the new boot.img.
Click to expand...
Click to collapse