A question regarding Magisk and global settings changes - Magisk

A few months ago, I upgraded to my phone to 7.1, and for some reason, my carrier disables tethering on my plan for this version. I did some poking around and found this article, which provided the fix. Namely:
setprop net.tethering.noprovisioning=true
settings put global tether_dun_required 0
The next issue I encountered was that these settings would be reverted any time I updated my ROM. Enter Magisk and stangri's tethering module, which addresses the first half of that issue flawlessly. I am, however, left with the second half of the puzzle that needs to be fixed after each flash.
I've tried placing a few simple lines in services.sh to perform a quick check to see what that setting's value is and adjust it as needed, I've tried putting scripts in various places to run on boot, and I've tried anything else I can think of, but it seems I'm not savvy enough to solve this particular problem on my own. So, I turn to you for suggestions. Can I either systemlessly set the value "tether_dun_required" to 0 via a Magisk module or use a Magisk module to place a script that'll run on boot and check the value? If it's even possible, can I get a hint on how it would be done? Thanks in advance.

You should be able to use the General Purpose Boot Scripts that @topjohnwu talks about here: https://forum.xda-developers.com/showpost.php?p=70897029&postcount=12.

Didgeridoohan said:
You should be able to use the General Purpose Boot Scripts that @topjohnwu talks about here: https://forum.xda-developers.com/showpost.php?p=70897029&postcount=12.
Click to expand...
Click to collapse
Hmm, yeah that has potential, but I suspect I'd run into the same problem I've encountered when putting the script into a module. Namely, it doesn't run. Maybe I'm missing something? For testing purposes, I've been keeping it to a single line with the actual command (settings put global tether_dun_required 0), but it doesn't actually do anything.

Related

How to make the phone automatically enter the PIN when booting?

Hi Guys!
Recently I hope to use Tasker to do something automatically when the phone is turned on, but I found that Tasker can't start when my phone is turned on but locked.
So I wrote an Android app that uses the shell to enter the password at boot time, but even if I used DirectBoot mode(developer.android.com/training/articles/direct-boot) it still doesn't work.
So I tried to write a module using Magisk, and automatically entered the password when I booted. This time I raised succeeded.
I think there may be other people who have the same needs as me, so I do a function that can customize the password for others to use.
At first we need install AutoInputBootPinManager(github.com/ZeroingIn/AutoInputBootPinManager) to configure your PIN. The application needs to grant root privileges.
Next we download and install this module(github.com/ZeroingIn/AutoInputBootPin) and reboot phone to enjoy it.
If you have any questions, please submit an issue.
Thank you all.
Interesting idea.
There are several modules available that use a shell script UI, run through a terminal emulator, to change settings for the module. App systemizer, Unified Hosts Adblock, MagiskHide Props Config, Energized Protection, etc. Take a look at them for inspiration.
A couple of things:
An explanation of the command in post-fs-data.sh might be a good idea.
Code:
supolicy --live "allow untrusted_app default_android_service service_manager find"
And, why are you setting this prop? As far as I can tell that's for the app Brevent...
Code:
log.tag.BreventServer=DEBUG
Didgeridoohan said:
Interesting idea.
There are several modules available that use a shell script UI, run through a terminal emulator, to change settings for the module. App systemizer, Unified Hosts Adblock, MagiskHide Props Config, Energized Protection, etc. Take a look at them for inspiration.
A couple of things:
An explanation of the command in post-fs-data.sh might be a good idea.
Code:
supolicy --live "allow untrusted_app default_android_service service_manager find"
And, why are you setting this prop? As far as I can tell that's for the app Brevent(play.google.com/store/apps/details?id=me.piebridge.brevent&hl=en)...
Code:
log.tag.BreventServer=DEBUG
Click to expand...
Click to collapse
Thank you very much for your advice, I will try it. Any progress, I will be posted in this post.
The setting of this prop is my mistake, and you have carefully discovered this bug that I have not noticed.
Because I was a beginner to make the Magisk module, I didn't see the Magisk Module Template(github.com/topjohnwu/magisk-module-template) at first, so I wrote it with reference to the Privileged Api Booter(github.com/Magisk-Modules-Repo/magisk-privileged-api-booter).I will fix this problem right away.
ZeroingIn said:
Thank you very much for your advice, I will try it. Any progress, I will be posted in this post.
The setting of this prop is my mistake, and you have carefully discovered this bug that I have not noticed.
Because I was a beginner to make the Magisk module, I didn't see the Magisk Module Template(github.com/topjohnwu/magisk-module-template) at first, so I wrote it with reference to the Privileged Api Booter(github.com/Magisk-Modules-Repo/magisk-privileged-api-booter).I will fix this problem right away.
Click to expand...
Click to collapse
In that case you have a couple of more things to rectify. The first part I mentioned, about the post-fs-data.sh script is also from that module. So, I'm going to assume you do not need it for your purpose. I'd suggest removing that as well... And after you've done that, you should also go in and edit config.sh and change PROPFILE and POSTFSDATA from true to false, because you're not using them anymore. From the looks of it you're only using service.sh, so only LATESTARTSERVICE needs to be active.
Didgeridoohan said:
In that case you have a couple of more things to rectify. The first part I mentioned, about the post-fs-data.sh script is also from that module. So, I'm going to assume you do not need it for your purpose. I'd suggest removing that as well... And after you've done that, you should also go in and edit config.sh and change PROPFILE and POSTFSDATA from true to false, because you're not using them anymore. From the looks of it you're only using service.sh, so only LATESTARTSERVICE needs to be active.
Click to expand...
Click to collapse
You are right, I modified it with reference to the template.Thanks a lot.
Are you going to.update this at all?
I have a bug if you are...
I only have 1 pin... But all 3 fire... Since there's no way to stop them without deleting it from the script

How can I check if I have logd enabled or not?

Hi, a few questions:
1) How can I check if I have logd enabled or not? I have Magisk 16.2 and my MagiskHide is not loading on bootup, I have to disable and reenable it for it to work and I think it may be due to 16.2 change to have MagiskHide disabled if logd is disabled.
2) Can you enable/disable logd from within android interface without a PC?
3) Is it safe to downgrade from 16.2 beta to 16.0 stable from within Magisk Manager?
Thanks.
If you can enable MagiskHide after booting up, that means you have logging enabled already. On some devices, it's just a bit slower to start...
Don't worry though, it's likely been fixed and should be in the next release (that @topjohnwu is working non-stop on getting out there). Relevant commit, if anyone's interested:
https://github.com/topjohnwu/Magisk/commit/5be035fd44eb6fd5e4e51b53d6105fdad0ef6491
Shouldn't be any worries downgrading. And if you do experience issues, it's just to do a clean install instead...
*XDA self-double-post*
I never manually enabled that logd though. I just got the tablet a few days ago and straight up installed Magisk 16.2. How would I go about enabling/disabling logd though?
The rest of the features of Magisk seem to work, the hidelist file has 666 permissions and seems to save correctly, but I have to manually disable/enable magisk hide after each bootup. I'd really like to solve this...
You don't have to enable logging, it's on by default.
The issue has already been fixed, just not yet released. If you really can't wait, use one of the unofficial snapshots.
I see, do you know what the issue is about? I've read topics about this where people didnt have the hidelist file or it had wrong permissions but mine is there with 666 and seems to save fine. If it's a widespread issue, shouldn't it affect everyone? Some of those users seem to have fixed it.
Other posts discussed magisk not mounting right with an unsupported filesystem but the rest of the features work fine for me.
I've also read about needing kernel >3.8 but mine is 3.18 so that should be fine.
My device is an Alldocube Iplay10 on android 6.0.
I'm not sure what is causing it if I indeed have logd enabled.
But you are confident the next stable release will fix it? Or the next beta release? Does he have a rough timeframe of when it's coming?
Thanks for the help by the way.

Script to enable/disable modules

Hi! Is there a way to enable/disable a Magisk Module with a script?
I'm using a Xiaomi Mi A1 and I would like to use Measure App. It works only the first time (or so) I disable/enable the module to change device fingerprint. Is it possible to run a script that disables and re-enables the module at boot? Thanks.
Disabling and then enabling a module takes a reboot between every action. It can't be done in one boot...
But, I suspect that this might not actually be the solution you're looking for. Provide more details, please. What module are you talking about? What functionality is it that you're after? What is it that doesn't work? Logs. Etc...
Didgeridoohan said:
Disabling and then enabling a module takes a reboot between every action. It can't be done in one boot...
But, I suspect that this might not actually be the solution you're looking for. Provide more details, please. What module are you talking about? What functionality is it that you're after? What is it that doesn't work? Logs. Etc...
Click to expand...
Click to collapse
Thanks for your quick reply.
I'm using a module that changes device fingerprint to Pixel2 to be able to use Measure app. Measure works properly only one or two times after enabling the module. Then it stops finding available surfaces until I disable, re-enable module and reboot. The same problem occurs if I use your MagiskHide Props Config (great work btw). After disabling-enabling-rebooting Measure works properly again. If I simply reboot without touching the module Measure app starts but it can't find any suitable surface.
Here's a logcat, hope it helps.
Do I understand you correctly? You're talking about disabling/enabling the module in the Magisk Manager, right? And disabling and then enabling right after, with no reboot in-between? If so, that makes no sense, because the only thing disabling the module does is to create a file in the module folder named "disable". On the next boot, Magisk will detect this file and won't load the module. Enabling the module simply deletes the file again, and on the next boot the module will load (since there's no "disable" file)..
I really do believe there's something else going on...
Didgeridoohan said:
Do I understand you correctly? You're talking about disabling/enabling the module in the Magisk Manager, right? And disabling and then enabling right after, with no reboot in-between? If so, that makes no sense, because the only thing disabling the module does is to create a file in the module folder named "disable". On the next boot, Magisk will detect this file and won't load the module. Enabling the module simply deletes the file again, and on the next boot the module will load (since there's no "disable" file)..
I really do believe there's something else going on...
Click to expand...
Click to collapse
I know it makes no sense but it works that way for me and for other people with the same phone/module. I was trying to find a way to automate this process at every boot so that at least the first time (after every boot) I'll use Measure it will work well. Otherwise log keep saying "Received image measurement before corresponding IMU measurement" then app crashes.
I'm 100% sure that it's got nothing to do with creating and deleting a file named "disable" in the module directory... There's something else going on, it's just that noone's figured out what.
Didgeridoohan said:
I'm 100% sure that it's got nothing to do with creating and deleting a file named "disable" in the module directory... There's something else going on, it's just that noone's figured out what.
Click to expand...
Click to collapse
I really don't know but I can reproduce this bug every time. How can I create and delete this file? Is there a path where I can put this file or magisk.img can be mounted? Sorry if it sounds ridiculous, I am not a developer...
If you really want to try you can just place a boot script in post-fs-data.d that creates and deletes the file in the module directory. Something like:
Code:
#!/system/bin/sh
touch <path_to_module>/disable
rm -f <path_to_module>/disable
The path to the module depends on what version of Magisk you're using (although there's backwards compatibility symlinks in place). In the current stable release the modules are in /sbin/.magisk/img, but the current code (in the Canary builds and in future releases) have moved this to /data/adb/modules.
Perfectly working, thanks. I used macrodroid to run the scripts you gave me after every boot.

Best SELinux mode changer module? (or why were they all removed from Magisk repo?)

Hey all, I use SELinuxModeChanger apk to set Permissive mode when my device (Xperia Z5Compact) starts.
I would like to use a Magisk module to do it instead. What is the best module (simple, light on resources) to do so?
I just need the device to start in Permissive mode and that's pretty much it.
I notice all the modules that do this were removed from Magisk repo.. why is that, stability issues?
Thanks.
Because it just takes a very simple boot script, something that a Magisk module is a bit of overkill for. To keep the Magisk repo somewhat uncluttered (it's still quite messy), the decision was made to remove all modules that were just too simple.
Why do you want to change to a Magisk module? It'll do the exact same thing as your app... If you really want to skip the app, just put the following inside a file (you can name it whatever, say "selinux", doesn't even need an extension), place it in /data/adb/service.d, give it execution permission and that's it:
Code:
#!/system/bin/sh
setenforce 0
That'll change to permissive at each boot. You could do the same with an app like Tasker, etc...
Very helpful if I need to do it manually, thank you very much!
I just found this module : https://forum.xda-developers.com/apps/magisk/selinux-mode-inverter-t3775271
which I think will do the trick nicely (I like to be able to enable or disable the feature easily from within Magisk).
Didgeridoohan said:
Because it just takes a very simple boot script, something that a Magisk module is a bit of overkill for. To keep the Magisk repo somewhat uncluttered (it's still quite messy), the decision was made to remove all modules that were just too simple.
Why do you want to change to a Magisk module? It'll do the exact same thing as your app... If you really want to skip the app, just put the following inside a file (you can name it whatever, say "selinux", doesn't even need an extension), place it in /data/adb/service.d, give it execution permission and that's it:
That'll change to permissive at each boot. You could do the same with an app like Tasker, etc...
Click to expand...
Click to collapse
Nice idea, I'm using it and loving it, thanks for the info.
Thanks for the ROM. Its very stable and smooth. But i faced with one issue after last update
Any gcam is crashing except for the stock(6.2) on Pixel Experience ROM (last update10.0)I tried different cases like clean cache, removed Google photo, install other gcam mods, change SElinux. Nothing helped me. Has anyone encountered anything like this? Any solution?

[Request] OxygenOS Swap Disabler

I was noticing some weird slowdowns on my OnePlus 6 and with a little research I found out that in the last 6 months of releases, OxygenOS keeps a ~2GB swap file and actively uses it. Even if the Smart Boost option is off! More info here: https://forums.androidcentral.com/oneplus-6-6t/949148-open-betas-14-6-oneplus-6-6t.html
Basically in order to de-activate swap we need to add two lines to build.prop. This works successfully on my OnePlus 6, the swap file disappeared and the slowdowns are gone; but I cannot make a module because my only PC has blown it's PSU
persist.vendor.sys.memplus.enable=false
ro.vendor.qti.config.swap=false
Click to expand...
Click to collapse
There's absolutely no need to make a module for something that simple. A couple of options:
Make a boot script (in /data/adb/service.d or /data/adb/post-fs-data.d, start with service.d and if that doesn't work try post-fs-data.d) that uses the resetprop tool. Should look something like this:
Code:
#!/system/bin/sh
resetprop persist.vendor.sys.memplus.enable false
resetprop ro.vendor.qti.config.swap false
Don't forget to make the file executable.
Or, you can use MagiskHide Props Config (shameless plug disclaimer).
Thank you, added the script in service.d, put execute permissions and it works perfectly. I totally forgot Magisk could use bootscripts
Instantly noticed how the interface is way smoother without swap.
I tried MagiskHidePropsConfig before but even after installing everything it needed it still didn't work ("those props don't exist" or something along those lines). Probably too specialized for me to understand.
Glad you got things working. And thank you for the feedback...
That message in the module ui is simply information (if a prop does exist it'll show the current prop value). If you had entered the new value it would have updated the module scripts with your new prop and prompted you to reboot. I'll make sure to make that clearer for the next release...

Categories

Resources