Background threads created by supersu (until phone stops working) - SuperSU

I'm running Supersu with one app that requires root access , everything works but I've detected that supersu creates background processes that keep running forever and hogging memory and resources. After about 12 hours the phone's memory is depleted and hangs . I've got to reboot it or create a periodic task that kills processes like this one:
app_process /system/bin/com.android.commands.am.Am broadcast --user 0 -a eu.chainfire.supersu.NativeAccess -es su_appname net.zhdev.whatstasker -ei su_fromuid 10123 -eu su_access 1 -ei su_access 1 -ei su_touid 0 --es su_cmd INTERACTIVE --ei su_code 825807 -ei su_uid_mismatch 0 -n eu.chainfire.supersu/.NativeAccessReceiver --receiver-replace-pending --include-stopped-packages
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
This happens in Android 5.0 and Android 7.1.2.
When the phone hangs there are about 200 threads like this.
Could someone help me to fix it?
Thank you.

It means, there's something wrong with either your superuser permissions or SuperSU app itself.
Such broadcast messages occur, when some app tries to get superuser permissions, fails to and tries again and again. Every broadcast message like that eats a significant amount of memory (~6.8 MiB in my case). That's why, the system quickly slows down. I'm not 100% sure, but it looks like this broadcast messages don't die after reboot...
I can't provide you with reliable solution to the problem, but It would be reasonable to do the following:
Open SuperSU, Settings and try to play with Security settings like "Mount namespace separation".
Clean the memory from any broadcast messages. Use this script for that. BusyBox must be installed. To call the script, type in the root shell:
Code:
sh /path/to/the/script/clean_memory_from_supersu_objects
Reinstall SuperSU app. To do that, open SuperSU, go to Settings -> CleanUp -> Full unroot. Then, go to the custom recovery and reflash SuperSU binary again.
If the problem still persists, the only solution I see is to call the script I provided every minute or so using any automation app (I use this one for that). Or, you can change the script, if you wish. To add an infinite loop, you can wrap the script code with something like that:
Code:
while true
do
# Put entire code of the script here
sleep 60
done
Then, copy modified script into /etc/init.d and set "execute" permission to it:
Code:
cd /etc/init.d
chmod 555 clean_memory_from_supersu_objects

Related

Two Magisk Manager Apps in system tray. One force closes, the other does not.

I'm having an issue where Magisk Manager (among other applications) have two icons in the app drawer. I think this is due to one of them being a "system app" and the other just being a normal application.
The issue I am having is that the normal Magisk application force closes upon launching, while the system app is able to open, but does not have any options for installing zips from repos.
I am using a Moto Z Play on 8.0. I've tried completely uninstalling Magisk and reinstalling but did not have luck with this. I'm not sure what I can do to fix this issue?
Thank you for any help!
Here are some screenshots showing this.
The system tray showing both apps:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
The app details for the system app (I noticed this app details is not substratum themed):
The app details for the normal app (I noticed this app details is substratum themed):
The system application showing that Magisk is installed:
But the system application showing no option to install from repos:
Uninstall both apps and reinstall with the apk from the release thread, and you should be good to go.
Thank you for the reply.
I have uninstalled both installations, and installed the v5.7.0 from the release thread. Unfortunately the application force closes upon launching. I actually started this uninstall/reinstall process due to this initial issue of the Magisk Manager force closing upon launch. From my searches this is usually fixed by clearing the applications data and cache and a reboot. However, for me those steps did not work.
One thing I find odd is that it says it "keeps stopping" but the application does launch just fine...
EDIT: Let me post back with some logcat details, once I figure out how to get those
Here is a link to the logs that I got via running ./adb logcat -v long > magisk.txt and then immediatly launching the application. I hope it is helpful: https://paste.ee/p/sJfvb
MrTissues said:
Here is a link to the logs that I got via running ./adb logcat -v long > magisk.txt and then immediatly launching the application. I hope it is helpful: https://paste.ee/p/sJfvb
Click to expand...
Click to collapse
There's this in there:
Code:
[ 07-06 16:34:52.493 29515:29536 E/AndroidRuntime ]
FATAL EXCEPTION: Thread-2 Process: com.topjohnwu.magisk, PID: 29515
java.lang.StringIndexOutOfBoundsException: length=441; index=-1
at java.lang.String.charAt(Native Method)
at com.topjohnwu.superuser.internal.StreamGobbler.run(Unknown Source:52)
Doesn't look too good...
I would be interested in seeing your Magisk debug log. If you're not already on Magisk v16.4 beta, please install that and provide the debug log that you'll find in /data/adb. It'd probably also be a good idea to run the uninstaller first and do a clean install (from which it would be interesting to see the install log).
Thanks!
Here are the logs for uninstalling Magisk, installing Magisk 16.4 beta, and then installing f2loopback fix (necessary for Moto Z): https://paste.ee/p/A9ZXz
Here are logs from Magisk itself: https://paste.ee/p/P5iyO
The need for f2loopback is maybe troubling, though I can confirm that this did work. I know Magisk is properly doing its thing b/c I am able to get root access (confirmation dialog appears) in apps like Solid Explorer so that I can provide these logs. Its just the Manager itself that has crash issues.
I see that a new version v5.8.0 was released of the Manager. Unfortunately the problem remains.
The beta version of Magisk v16.6 does not work on my phone, it causes boot loops. Maybe the f2loopback patch needs to be updated for it.
MrTissues said:
I see that a new version v5.8.0 was released of the Manager. Unfortunately the problem remains.
Click to expand...
Click to collapse
Could you provide a logcat from v5.8.0 crashing? Just to make sure that all the information collected is relevant?
The beta version of Magisk v16.6 does not work on my phone, it causes boot loops. Maybe the f2loopback patch needs to be updated for it.
Click to expand...
Click to collapse
You could test by going without the f2loopback module. It wouldn't be necessary for basic Magisk functionality, and then we'd knew if it was caused by the module or not.
Based on the orange icons, you have some things installed under your work profile as well. That's why there's 2.
I've had problems Magisk disappearing on my OnePlus 5T. I've run the Uninstaller in TWRP followed by 18.1. Now have two Magisks in the add drawer: one labelled 'Magisk Manager' which says the phone is rooted and all is well; the other (same icon) is labelled simply 'Manager' and says that Magisk isn't installed! As things stand, it's just a nuisance. Everything seems to work fine with the Magisk. I'm reluctant to uninstall the 'Manager' in case in brings down the other one, but I'd love to tidy it up.
Running OOS 9.3.
@chriscross
https://www.didgeridoohan.com/magisk/Magisk#hn_There_are_two_Magisk_Managers

[script&magisk][root]Disable analytics, app measurement, campaign tracking, etc

Attached is a reasonably simple script which disables (or enables) a number of services for application analytics, application measurement, facebook ads, firebase performance monitoring and a few more. The amount of services disabled depends on the applications which you have installed. In my case 430+ services were disabled when running the script. This will increase security and possibly improve battery life a bit.
You must be rooted to use the script. The script code is pretty simple, have a look.
Download the attached file, rename and remove the ".txt" extension.
Instructions to install/use:
Code:
# push the script to your phone using adb
> adb push dss /sdcard/
# go onto your phone
> adb shell
# switch to root
% su
# mount /system as read-write
% mount -o remount,rw /system
# copy the script to the /system/bin/ directory
% cp /sdcard/script /system/bin/
# make sure it is executable
% chmod 755 /system/bin/dss
# execute the script
% dss disable
# output printed to the screen
% reboot
To enable the services again just run the script with argument "enable".
Alternatively, flash the attached magisk module from within the Magisk app. It will achieve the same effect.
Note that the magisk module will run for quite some time in the background whilst your phone is already fully booted.
To check what the module is doing, do:
Code:
> adb shell
% su
% tail -f /data/adb/modules/dss/log
When it has finished you will see "-- done" in the log.
Welkom :good:
I suggest to make a magisk module of this script to make it user friendly.
Keep up the good work old friend
Great to see you again, good idea to make it into a module. Will look at it tomorrow.
Good to see! Look forward to the module, Cheers
Can't you just run the script using EXKM?
For the ones who want to see if you have any of those apps (basically see if you need it/ if the custom kernel or Magisk module already hasn't disabled them).
Run this in Minimal ADB or whichever ADB tool you prefer:
Bash:
- adb shell
- su
- PLIST=`/system/bin/cmd package list packages | grep -v Swift | sort | sed 's/package://g'`
for i in $PLIST; do
echo "$i"
done
This will list all packages you've installed, see if it has any of the packages mentioned above.
OK, I looked into making this a magisk module ...
Problem is that you only have to run the script once (with disable).
So it is not really something which needs to run upon every boot.
Therefore, a magisk module is a bit pointless IMHO.
Anyway, the magisk module is attached if you want to try it.
@foobar66
Is this safe to try on the 6T?
..Cory.. said:
@foobar66
Is this safe to try on the 6T?
Click to expand...
Click to collapse
Yes, no problem.
foobar66 said:
Yes, no problem.
Click to expand...
Click to collapse
Thanks brother, will try shortly!
can anyone report their findings on this? does it improve things?
best way to know is try it make backup to feel safe
So I just need to flash magisk module, reboot so it will be activated and then I can remove it?
I do not know if it improve anything but i had to reboot twice. After the first reboot nothing worked as expected. Now it seems to work normal
Updated OP with the magisk module.
Thanks a LOT - very good addition to AFWall
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
---------- Post added at 20:38 ---------- Previous post was at 20:29 ----------
foobar66 said:
OK, I looked into making this a magisk module ...
Problem is that you only have to run the script once (with disable).
So it is not really something which needs to run upon every boot.
Therefore, a magisk module is a bit pointless IMHO.
Anyway, the magisk module is attached if you want to try it.
Click to expand...
Click to collapse
Well, can I just delete the Magisk module after running it once?
---------- Post added at 20:56 ---------- Previous post was at 20:38 ----------
ATTENTION ANDROID 10 Users: not working on Q-Beta 4
does this play nice if I have oxytweaker module which already disables some of the logging and analytic stuff?
Thanks. Look forward to trying this. If we want to reverse the module do we just delete it from Magisk? Thanks
carro_d said:
does this play nice if I have oxytweaker module which already disables some of the logging and analytic stuff?
Click to expand...
Click to collapse
i would say it does the same, its just another approach
and oxytweaker also changes some build prop stuff, so this is like the "light" version, thats focussed on the analytic stuff
Would this break safety net? Thanks!

Google Account - Googlefier

So I have discovered something small but which might help others smarter than me.
I have the international version which of course - fails to install GMS with Googlefier.
Mostly i`ve seen that after adding the account, it disappears after i uninstall MicroG which is com.google.android.gms .
The app when uninstalled it removes the accounts as well.
So.
I have managed to install it and still have the google account, i did the following.
When I reache the step to uninstall Microg :
1)Enable developer options and allow usb debuging.
2)Downloaded Platfoorm tools and seved them to c drive.
3)Opened CMD - navigated to Platfomr tools forlder via cd c:\Platform-tools\
4)typed adb devices - which should return a value for example :
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
5)Disabled com.google.android.gms ( MIcro G) with the following command
adb shell pm disable-user --user 0 com.google.android.gms
Now the app is diabled.
You can check if the app is disabled by typing :
adb shell pm list packages -d
Which will return vales only for the disabled apps:
So after disabling the app - you can uninstall it and still have the google account on your phone.
Hope this helps somehow.
But how did you installed GMS ??
ic3cub3 said:
So I have discovered something small but which might help others smarter than me.
I have the international version which of course - fails to install GMS with Googlefier.
Mostly i`ve seen that after adding the account, it disappears after i uninstall MicroG which is com.google.android.gms .
The app when uninstalled it removes the accounts as well.
So.
I have managed to install it and still have the google account, i did the following.
When I reache the step to uninstall Microg :
1)Enable developer options and allow usb debuging.
2)Downloaded Platfoorm tools and seved them to c drive.
3)Opened CMD - navigated to Platfomr tools forlder via cd c:\Platform-tools\
4)typed adb devices - which should return a value for example :
View attachment 5151189
5)Disabled com.google.android.gms ( MIcro G) with the following command
adb shell pm disable-user --user 0 com.google.android.gms
View attachment 5151193
Now the app is diabled.
You can check if the app is disabled by typing :
adb shell pm list packages -d
Which will return vales only for the disabled apps:
View attachment 5151195
So after disabling the app - you can uninstall it and still have the google account on your phone.
Hope this helps somehow.
Click to expand...
Click to collapse
Excellent! But would you describe step by step how you installed Google? Explaining in detail what you close, what you open, what you save, what you delete - the whole process. Please!
Shymmy said:
But how did you installed GMS ??
Click to expand...
Click to collapse
GMS is installed but not working.
I uses GoogleFier to install GMS - at the step where i have to uninstall MicroG i did what i said above.
They do not work due to com.lzplay.helper not working with emui 11.
r_crusoe said:
Excellent! But would you describe step by step how you installed Google? Explaining in detail what you close, what you open, what you save, what you delete - the whole process. Please!
Click to expand...
Click to collapse
I used GoogleFier.apk to do it.Followed the steps in the app but what ever i tried.GMS does not work.
For the moment lzplay which is an api for gms does not work with emui 11 , and without it , even with GMS installed they do not work.
For example I had everything installed, Play Store, Youtube etc - the apps open but do not load.
They hang forever in loading.I tried all versions of GMS services, older, newer with the same result .Apps just hang and do not oped.
The only thing which for the moment is a positive result is to have Google Accounts under Settings - Accounts.
I will keep digging and if I have anything promising I will inform everyone here.
Thanks
Installed and unusable we also tried ...
I thought you had it usable.
I never said GMS works. I only made it possible to have the Google Account which previously wasn't possible - at least on my device.
Sorry if I wasn't clear enough.
how can install it
I have tried to install it, but allways give me an error because de back up/restore app

Unable to Install Modules

Rooted my phone (Galaxy S21 Ultra) recently, used Magisk, it seems to be working ok (ver. 25.1), although initially it seemed I couldn't install Modules from outside the app. I am unable to pass SafetyNet. Super User authorizations working fine.
After some helping from others and plenty of research, I installed Fox MMM and was able to install two modules. Now it seems I can't install modules from storage because the files themselves aren't being recognized as proper modules.
As you can see in this image, the icon itself is different from the ones recognized although they are all *.zip files. Safetynet and Shamiko are greyed out, while MagiskHide and Liboencrypt aren't - these two I can and did install.
Initially I thought it could be something to do with names, as the latter have underscores instead of dashes, but renaming them didn't work.
Neither Magisk nor Fox MMM recognize these files as modules, and they were all downloaded from GitHub.
I'm really stumped by this.
What could I do?
-- This is the image in the link, for easier access:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
If the modules are correct then you can try this:
adb shell > su
magisk --install-module module.zip
If this returns error then post screenshot here.
NextGenMagisk said:
If the modules are correct then you can try this:
adb shell > su
magisk --install-module module.zip
If this returns error then post screenshot here.
Click to expand...
Click to collapse
Where do I type this?
wbane said:
Where do I type this?
Click to expand...
Click to collapse
Any terminal emulator (to skip using the adb shell command), like Termux, OR via ADB on a PC
If someone in the future finds this thread, I've got this solution:
Have you tried using Samsung's file manager? On the top left of your screenshot press the sandwich menu icon and select Samsung's file manager and try to select the module from there.​​I tried the above and it worked!​
NextGenMagisk said:
If the modules are correct then you can try this:
adb shell > su
magisk --install-module module.zip
If this returns error then post screenshot here.
Click to expand...
Click to collapse
I was stuck on Android 13 having "installation failed" message, but running this from the shell worked.
It seems like you're encountering issues with installing modules on your rooted Galaxy S21 Ultra using Magisk. Despite successfully rooting your phone and having Super User authorizations working fine, you're unable to pass SafetyNet. Additionally, you've tried installing modules from storage, but they aren't being recognized as proper modules.

fastboot devices problem

Hello everyone, I had a problem with the command fastboot devices, didnt display the serial nimber of the device, but adb devices works fine. where is the problem please
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
hamza19r said:
Hello everyone, I had a problem with the command fastboot devices, didnt display the serial nimber of the device, but adb devices works fine. where is the problem please View attachment 5874893
Click to expand...
Click to collapse
You have to boot to bootloader to use fastboot commands.
xunholyx said:
You have to boot to bootloader to use fastboot commands.
Click to expand...
Click to collapse
Thanks a lot for your help, I have boot it to bootloader the fastboot works fine now and I could transfer the patched image but the smartphonne not rooted yet after checking with root checker app. I have used the latest image redfine. What should I do?
Thanks a lot
hamza19r said:
Thanks a lot for your help, I have boot it to bootloader the fastboot works fine now and I could transfer the patched image but the smartphonne not rooted yet after checking with root checker app. I have used the latest image redfine. What should I do?
Thanks a lot
Click to expand...
Click to collapse
When you open the Magisk app, does it show up like this?
Installed 25.2 (25200)
Zygisk Yes
Ramdisk Yes
If so, then your phone is definitely rooted. At the bottom of the app, go to the "Superuser" tab with the shield icon. Make sure that the app you want to grant superuser has the slider set to the 'on' position.
swangjang said:
When you open the Magisk app, does it show up like this?
Installed 25.2 (25200)
Zygisk Yes
Ramdisk Yes
If so, then your phone is definitely rooted. At the bottom of the app, go to the "Superuser" tab with the shield icon. Make sure that the app you want to grant superuser has the slider set to the 'on' position.
Click to expand...
Click to collapse
Zygisk No, what should I do please
hamza19r said:
Zygisk No, what should I do please
Click to expand...
Click to collapse
Actually, if it just says "Installed 25.2 (25200)", your device should be rooted.
Zygisk can be turned on or off in the settings (top right gear icon from the home screen).
One thing you can do to really check root access is:
Download Termux and open the app. At the bottom, you will see a $ dollar sign on the left.
Type in:
su
then press the enter key
There will be a popup asking if you grant superuser access to Termux. Tap yes.
The $ sign will change to
:/data/data/com.termux/files/home #
If this happens, you definitely have root.
If this doesn't happen, open the Magisk app, go to the Superuser tab at the bottom, find Termux and turn the slider to the "on" position and try again at step 2.
swangjang said:
Actually, if it just says "Installed 25.2 (25200)", your device should be rooted.
Zygisk can be turned on or off in the settings (top right gear icon from the home screen).
One thing you can do to really check root access is:
Download Termux and open the app. At the bottom, you will see a $ dollar sign on the left.
Type in:
su
then press the enter key
There will be a popup asking if you grant superuser access to Termux. Tap yes.
The $ sign will change to
:/data/data/com.termux/files/home #
If this happens, you definitely have root.
If this doesn't happen, open the Magisk app, go to the Superuser tab at the bottom, find Termux and turn the slider to the "on" position and try again at step 2.
Click to expand...
Click to collapse
I have rooted it, thanks a lot

Categories

Resources