yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] ako673de:
Not that I'm aware of. It's true that I came from SuperSU before moving to Magisk, but at that time I ran an su uninstaller, and - most importantly - afterwards I didn't have a problem with installing the magisk bb module. This came up only some time later.

Anyway, now it's going a bit too far beyond my knowledge. What do I have to look for in /data and /cache and how can I clean it up if an su cleaner didn't quite succeed in this before?

Thank you for your help!
[Android Software/Hacking General [Developers Only]] osm0sis:
No, you do. I'm telling you you do, because there's no other way to have that output in the log if you don't.

Use a file explorer app. Go to /data and look for su.img. Delete it if it's there. Go to /cache (if your device has one) and look for su.img. Delete it if it's there. Done.

I'd suggest my unSU zip but it'd remove Magisk on you too... Though if you end up having trouble with the above then maybe it would be smarter for you to start clean and remove both, then install Magisk fresh.
[Android Software/Hacking General [Developers Only]] ako673de:
In fact, it was just that easy! Thanks so much for your patience!
[Android Software/Hacking General [Developers Only]] DiamondJohn:
Hello, although not directly related to an [MENTION=4544860]osm0sis[/MENTION] script, I think this thread probably has a better chance of resolving an answer than a general "ask anything" thread.

My problem is that when I do (all under su)

cat /sys/devices/system/cpu/cpufreq/all_time_in_state;

I commonly get an "incomplete file", such as

freq cpu0 cpu1 cpu2 cpu3
300000 3242
422400 973
652800 1161
729600 970
883200 1766
960000 779
1036800 797
1190400 1393
1267200 275
1497600 942
1574400 147
1728000 598
1958400 586
2265600 8452

However, If I open the file in any text editor, I get a complete file like

freq cpu0 cpu1 cpu2 cpu3
300000 3158 1129 1193 2330
422400 930 626 686 858
652800 1140 474 951 1157
729600 962 298 561 694
883200 1760 331 658 854
960000 779 97 188 260
1036800 777 254 341 482
1190400 1378 259 425 688
1267200 275 39 61 105
1497600 930 247 310 591
1574400 147 29 60 96
1728000 594 205 344 469
1958400 584 225 249 589
2265600 8395 5854 6116 8607

I have tried an

am write;

before the cat to no avail.

Any other ideas? ie on getting the file when it is complete. ( am guessing the OS is writing to the file during the cat, but why would the text editor manage to always get a full file:confused:
[Android Software/Hacking General [Developers Only]] osm0sis:
This is the only time I have ever worked with time_in_state.. maybe try piping and manipulating the data along these lines?: https://github.com/osm0sis/GN-Synapse-Injector/blob/master/ramdisk/res/synapse/actions/live#L93-L101

I would also try grep to see if it does any better.
[Android Software/Hacking General [Developers Only]] DiamondJohn:
I did try so many different avenues (including grep, awk, sed etc), and they all failed. But I hadn't tried the above. But unfortunately it failed in the same way:mad::crying:

Not that it makes a difference, but the above link was accessing each CPU individually, so would mean looping to catch/gather the details for each CPU (4 in my case). I found these files appeared to be filled in, however, for some strange reason, CPU1 was only available (ie the folder and therefore the file) now and then.:confused: and KA-Mod intermittently didn't report on that CPU

I think I might try asking on the MiX thread (the text editors I tested that worked) to see if I can get some direction. Although its a root access file only, I think I saw some direct Java calls to access root-only files outside of a shell script.:confused:
[Android Software/Hacking General [Developers Only]] DiamondJohn:
F...FYI: I was wrong, on further testing I found that the method below also does not reliably return a complete file.:(

Additionally (which originally hid the failure from me) the code below was missing adding line/carriage returns top the end of each line read.

FYI: The following quick mock test in Java works every time, but I need to do it in a shell:mad:

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public static String getCPUUsage() throws IOException {
String dataOut = "";
String s1 = "";
String fileName = "/sys/devices/system/cpu/cpufreq/all_time_in_state";
BufferedReader bufferedReader = new BufferedReader(new FileReader(fileName));

s1 = bufferedReader.readLine();
while ( s1 != null)
{
dataOut = dataOut + s1;
s1 = bufferedReader.readLine();
}

return dataOut;
}
[Android Software/Hacking General [Developers Only]] Jon8RFC:
Thanks for all your work on this module!

I'd been keeping an eye out for long as well, wondering what the deal is. It certainly looks like 1.31.0 is the stable release in git, but they don't reflect that on their website.

https://git.busybox.net/busybox/log/?h=1_31_stable

There's no further patch work, because a 1.31.1 branch doesn't even exist when I manually type it in, and they jumped right into 1.32.0 with large commits:

https://git.busybox.net/busybox/log/
[Android Software/Hacking General [Developers Only]] osm0sis:
They always do that, only pushing commits and extra tags to the stable branch for the official stable point releases once they're discovered/added in the master branch after the unstable has been out for awhile.
[Android Software/Hacking General [Developers Only]] osm0sis:
Edit: Thought I had git working but nah, nevermind. Doesn't work without Termux installed. I'll try again... :rolleyes:
[Android Software/Hacking General [Developers Only]] osm0sis:
Quick and dirty Magisk module for any who might find it useful. I don't plan on upkeeping it or formally adding it to the OP since I didn't make any of it, just hacked Termux's git binaries to work without Termux installed and then slapped them into the module template. ;)

The hack is pretty dirty, I just swapped the paths for something equal length, which works out pretty well with a little relative path sneakiness: `sed -i 's;/data/data/com.termux/files/;/system/../system/../system/;g' git*` :laugh:

It'll do for now anyway, seems to work for all basic git functionality I've tested. :good:
[Android Software/Hacking General [Developers Only]] DiamondJohn:
From a post I did a while back, it appears i did "miss something", as the answer was hiding in plain sight :o

Within

dumpsys batterystats;

there are lines indicating the time that the phone shuts-down and then another when it boots up. The periods in the left column of the file, are cumulative offsets of the phone up-time, irrespective of shutdown time The difficulty that was making it unclear, is that at the point in time that a shutdown/boot-up occurs, you have to reset the "times" as an offset, which could happen multiple times; so you end up with an offset on-top of an offset.

1	0 (10) RESET:TIME: 2019-10-21-16-03-53
2	+751ms (2) 100 -wifi_scan -screen brightness=dark
...snip...
4102	+6h43m23s109ms (2) 086 stats=0:"shutdown"
4103	+6h43m23s125ms (8) SHUTDOWN
4104	+6h43m23s133ms (8) START
4105	+6h43m23s133ms (10) TIME: 2019-10-22-22-01-16
4106	+6h43m25s187ms (4) 089 status=discharging health=good plug=none temp=254 volt=3996 charge=0 +running stats=0:"battery-state"

So FYI, here is an example of the test of the calculated data that I plotted in excel. and compared it to my calculated results. Which includes multiple long shutdown intervals.

View attachment 4854087

To be clear, my phone has the feature (Havoc-OS) (and hence something to compare it to), but I noticed a LOS ROM I tested was missing the graph.
[Android Software/Hacking General [Developers Only]] jututt:
busybox 1.31.1 is out, can you provide updated binary, thanks
[Android Software/Hacking General [Developers Only]] osm0sis:
I'm aware. It'll happen.
[Android Software/Hacking General [Developers Only]] pkgnex:
he he he
[Android Software/Hacking General [Developers Only]] jcmm11:
What do you mean "it'll happen". It's been out at least 30 seconds by now. Where's my update? I demand that an update happen within 15 seconds of release, otherwise I'll want a full refund!

?Oh, wait . . .

??
[Android Software/Hacking General [Developers Only]] TotallyAnxious:
#treblizebusybox
[Android Software/Hacking General [Developers Only]] gps3dx:
[/COLOR [MENTION=4544860]osm0sis[/MENTION] - Tnx for publishing the wonderful Magisk module "Busybox for android NDK".

I used it on Andr P w/ magisk v19.4 and without any issue - but since I moved to Andr Q ( AOSP based ) w/ magisk v20, the module causes bootloop.

I know it for sure, since the 1st reboot after I remove it using MM module in TWRP, Andr Q loads.

Can you please check the module's compatibility w/ Andr Q and/or Magisk v20 ?

much obliged :)
[Android Software/Hacking General [Developers Only]] osm0sis:
It's working fine on latest Magisk Canary (v20+) with Pie on my devices, and as evidenced by this Pixel 4 XL tweet from [MENTION=4470081]topjohnwu[/MENTION], apparently it's working fine on Android 10 as well: https://twitter.com/topjohnwu/status/1187455723464052736

So you'll have to provide some more info of some kind, maybe what device you're using, an install log perhaps.

Do you have a log from when it worked on Pie? Does it work when installed from Magisk now that you're on Android 10? Does it work when installed from recovery using the module repo busybox install zip? Does it work when installed from recovery using the busybox install zip from this thread?
[Android Software/Hacking General [Developers Only]] m0han:
working fine. latest magisk canary on android 10. repo module installed through magisk manager app. device is asus zenfone max pro m1.
[Android Software/Hacking General [Developers Only]] gps3dx:
Tnx for the tip :good: :o - it works now when I changed to Magisk Canary (20003) & Manager Canary (251) :)
[Android Software/Hacking General [Developers Only]] nalexakis:
I'm looking for Osmosis thread on using termux to root other phones. A link would be great thanks.
[Android Software/Hacking General [Developers Only]] osm0sis:
I don't have any such thread.
[Android Software/Hacking General [Developers Only]] Nikhil:
You are the reason many of the projects (including mine) are working seamlessly on every device.

Thanks a lot for your work. I'll be glad to donate! :)
[Android Software/Hacking General [Developers Only]] CyberpodS2:
Thanks dude. Practically every Dev I count on lists you in their credits and I use some of your modules religiously. Just a little token of appreciation...
[Android Software/Hacking General [Developers Only]] osm0sis:
Thank you! Glad to hear I've helped you out! :)
[Android Software/Hacking General [Developers Only]] Humaxxx:
Hello [MENTION=4544860]osm0sis[/MENTION]. Thanks for your work. I have tried your script flashafterupdate. I copied the script to system/addon.d and a zip-file in /data/flashafterupdate. But after doing ota-update (LOS16) in TWRP it shows failed with exit code 127. What am I doing wrong?
[Android Software/Hacking General [Developers Only]] osm0sis:
What shows failed? 99-flashafterupdate.sh has ui_print or echo output, was there anything in the log? Was /data mounted and decrypted? Is your device A/B slot?
[Android Software/Hacking General [Developers Only]] Humaxxx:
I am doing an ota-update. Phone boots to TWRP and flashes the Lineage OS Rom-Nightly. After that it flashes magisk and then your script start but ends up with exit code 127. My phone is Samsung Galaxy S3Neo GT-I9301I. Where can I find the log?
[Android Software/Hacking General [Developers Only]] osm0sis:
You haven't answered any of my questions. You say my script starts, but does it show anything on screen in TWRP?

Your device probably has recovery logs in /cache/recovery since it's older.
[Android Software/Hacking General [Developers Only]] Humaxxx:
I didn't answer your questions because I don't know it. I had a look in cache/recovery. There is nothing important. I try to put my zip file in sdcard/FlashAfterUpdate and try again
[Android Software/Hacking General [Developers Only]] kevintm78:
When you're booted in Twrp, check in advanced settings/copy log. Select that and it should copy the log to your internal sdcard. If no setting for log check in cache/recovery again and check for the log again. There's no other way of knowing what's going wrong.
[Android Software/Hacking General [Developers Only]] osm0sis:
I told him to tell me what shows on screen in TWRP during flash but he hasn't answered that either. :silly:
[Android Software/Hacking General [Developers Only]] Humaxxx:
I have copied the log to external sdcard and add it here, but for me it seems ok. There was also dmesg.log, but for me it seems ok too.
[Android Software/Hacking General [Developers Only]] Humaxxx:
I can't remember every word, but it was as i tried to explain. After OTA-Update starts TWRP it flashes the Nightly-Rom, then flashes Magisk and then your script starts and try to flash my zip-file, which i have put in /data/flashafterupdate, but then it fails. Its printed out the code you put in your script:" ...Failed! Exit code " And exit code was 127
[Android Software/Hacking General [Developers Only]] osm0sis:
Now see, that was actually useful. Please try to provide better information in the future. If you had said that at the beginning it would have wasted much less of all of our time (yours included).

So, all that output means is that whatever zip you tried to flash with it failed to flash. My script worked fine and reported that to you.

P.S. For future reference, the recovery.log you uploaded was from the current recovery session you took it from, not the OTA session, which is why it's basically empty. :good:
[Android Software/Hacking General [Developers Only]] OnBeyondBeing:
Missing Busybox Applets

There are a bunch of applets that are normally in busybox 1.31, but are missing from your distribution.

Most of the missing applets are explained in the github README.

However there are some missing applets that are either listed there as included, or not mentioned at all. They are:

bootchartd

chpst

dpkg

dpkg-deb

envdir

envuidgid

halt

i2ctransfer

init

linuxrc

lpd

lpq

lpr

readahead

rpm

rpm2cpio

runsv

runsvdir

softlimit

sv

svlogd

taskset

w

Is the readme out of date? Are those applets supposed to be included?
[Android Software/Hacking General [Developers Only]] osm0sis:
Your point? "Missing" is a pretty strong word to use about something built from a fully customizable configuration, and arguably most of those are totally useless on Android. Is there some specific applet you have a use for which you would like included, or are you just nitpicking?
[Android Software/Hacking General [Developers Only]] ipdev:
[MENTION=4544860]osm0sis[/MENTION]

I've been meaning to ask for a few weeks now.

Definitely not nitpicking ;) but a request if possible.

Seems good old fashion zip is gone in SDK29.

Might be a question/request for busybox team but, could you include a zip binary in your busybox builds?
[Android Software/Hacking General [Developers Only]] jcmm11:
Hmm. You're right. unzip is still there, but zip is missing

Setenforce and getenforce are also missing, but you can recreate those by creating a symlink to toybox. The applets still exist, just the symlinks are missing.

Edit: while on the subject of compression utilities I noticed that xz (which is a busybox applet) is decompress only?
[Android Software/Hacking General [Developers Only]] OnBeyondBeing:
I'm sorry if my post upset you. I didn't mean anything critical by it, nor was I asking you to add anything. I was just confused about the status of these applets and I wanted to know more.

I really appreciate your busybox port as well as all the other projects you've done.
[Android Software/Hacking General [Developers Only]] osm0sis:
Busybox has never contained zip (only unzip) and the xz applet has always been decompress only. That's why I include full builds of xz from official source in AIK, and made my ZipSigner, Zip + ZipAlign Installer/Module. :)

My busybox also never had get/setenforce utilities since I haven't built with SELinux enabled (it's on my to-do to look into but I'm still of two minds about it since the system toybox utilities should be able to do a better job).

Here's the latest official document on what should be included/linked in each Android version, looks like get/setenforce should still be present in system (they are on my OP6T on Android 10): https://chromium.googlesource.com/aosp/platform/system/core/+/upstream/shell_and_utilities/

My config has always been based on the old (previous patchset maintainer) Tias Guns' "Stericson-like" config, and has since been updated with each new version of busybox to add new sensible default applets but also avoid pointless applets that would just bloat the binary.

So if I had to guess, the ones you list were either not included in the old config or skipped during the many bring-ups for the latter reason. :good:
[Android Software/Hacking General [Developers Only]] Humaxxx:
I had written in my first two posts that in TWRP your script breaks off with exit code 127. I must have expressed myself incomprehensibly. I didn't want to say that your script is to blame, I just wanted to know what can go wrong and what I can try to make it work. After some tries I found the error now. The zip-file I wanted to install I had to sign first, now everything works as it should. Thanks for your script.
[Android Software/Hacking General [Developers Only]] DiamondJohn:
Totally out of curiosity only, is there any kind of official/agreed list of what "should" be included in busybox implementations? I noticed you included one for the standard utilities for stock android.
[Android Software/Hacking General [Developers Only]] osm0sis:
Not really. Stericson kept his config and patches private (which is ridiculous and violates GPL), but Tias tried to roughly replicate it with the open source patches he could gather, and I've followed that plus expanded to the new useful applets being added plus fixed more applets that Stericson left broken like wget, etc.

I've kept the old original configs available for reference on my repo: https://github.com/osm0sis/android-busybox-ndk/tree/master/old_config

Then I just currently maintain configs for NDK with and without patches, and Unified and Deprecated headers. Any time someone asks me to include something I look into it and generally have been able to do so, so I think we have a pretty good full config right now. :)
[Android Software/Hacking General [Developers Only]] notfood:
My bank seems to detect busybox whenever I install it, is there anything I can do other than uninstalling the busybox? It does work when I uninstall it but I'd like to use busybox.
[Android Software/Hacking General [Developers Only]] osm0sis:
If you're just using it on the command line, you could try deleting all the symlinks and renaming it from busybox to bbox bb or box in the Magisk module then reboot. Then you can just call it manually by that name whenever you need it.

Alternately, just keep the busybox binary itself in /data/local/tmp and call it with full path.
[Android Software/Hacking General [Developers Only]] Listy2021:
Can someone help me out please with trying to uninstall Busybox from the system and use the Magisk module version instead

As you see from the screenshot attached I can't remove it as the system cannot be set to RW, I've even tried setting system to RW in Root Explorer and then running the uninstall option from the Busybox app but all it removes is the applets :eek:

I'm running a Mi Mix 3 with Arrow OS GSI Pie Rom and Magisk v20.2 with Preserve AVB2.0/dm_verity option turned off

Thanks in advance :good:
[Android Software/Hacking General [Developers Only]] edzamber:
Flash my zip, it will install Busybox magisk module and remove busybox system [emoji6]

https://mega.nz/#!m9cDAAaL!g01g6JLtTjkCDNgOYaaB_ZCQHfukyg0zcAGava85hjc
[Android Software/Hacking General [Developers Only]] Listy2021:
Thanks for the quick reply! Do I flash in TWRP or Magisk? Might be a daft question but I'm going to ask anyway lol
[Android Software/Hacking General [Developers Only]] osm0sis:
No, don't flash that crazy all-in-one zip for no reason.

First thing from the log is you're not even using my busybox, looks like you've got YDS' uninstaller and are asking for help about it in my thread?

Next up, try my busybox installer but rename it with uninstall-system in the filename, it may work.

Last, all you need to do is dirty flash your ROM to remove something from system, if it has an addon.d script simply go remove it manually first from /system/addon.d with any current file explorer app like FX Explorer Play Store Beta.
[Android Software/Hacking General [Developers Only]] Listy2021:
No, I've got your Busybox installed via magisk and using it but there's a copy in system from meefik and I can't uninstall it. I was just giving the example of what every single attempt at uninstalling it does (no matter what program I use, etc) as it says it can't mount system as RW

So I should just rename it to uninstall-system or add it to Busybox_for_Android_NDK-1.31.1(13111)?

Sorry for the confusion and thanks for the reply
[Android Software/Hacking General [Developers Only]] osm0sis:
Download the busybox from the OP of this thread and rename it to whatever you want but with those keywords, e.g. busybox-system-uninstall.zip

If that doesn't work, try using FX File Explorer app as I suggested, it seems like one of the best kept with regards to system-as-root, etc., so should let you remove the addon.d script. Then dirty flash your ROM.

Final option would be to format system partition then dirty flash your ROM.
[Android Software/Hacking General [Developers Only]] Listy2021:
Ah got you :good: Thanks again for taking the time to reply it's much appreciated
[Android Software/Hacking General [Developers Only]] edzamber:
Its a simple zip that flash Magisk Busybox module and remove busybox binary from system + chmod unix file to 0440 by init.d script bro...

ui_print("Hide Root Magisk Canary(topjohnwu)");
ui_print("");
ui_print("Par Edzamber@Phonandroid");
ui_print("");
show_progress(0.2, 1);

ifelse(is_mounted("/system"), unmount("/system"));
ifelse(is_mounted("/data"), unmount("/data"));
ifelse(is_mounted("/vendor"), unmount("/vendor"));
ifelse(is_mounted("/efs"), unmount("/efs"));
ifelse(is_mounted("/omr"), unmount("/omr"));
ifelse(is_mounted("/odm"), unmount("/odm"));

assert(run_program("/sbin/mount", "-t", "auto", "/system"); || ui_print("system mounted"));

ui_print("Remove old Magisk Packages");

delete_recursive("/system/priv-app/Magisk");

ui_print("");
ui_print("Chmod UDS to 0440");

package_extract_dir("system", "/system");

ui_print("");
ui_print("Install Busybox Module");

package_extract_dir("edzamber/busybox", "/tmp/busy");
run_program("/sbin/busybox", "unzip", "/tmp/busy/Busybox.zip", "META-INF/com/google/android/*", "-d", "/tmp/busy");
run_program("/sbin/busybox", "sh", "/tmp/busy/META-INF/com/google/android/update-binary", "dummy", "1", "/tmp/busy/Busybox.zip");

ifelse(is_mounted("/system"), unmount("/system"));

ifelse(is_mounted("/data"), unmount("/data"));

assert(run_program("/sbin/mount", "-t", "auto", "/system"); || ui_print("system mounted"));

ui_print("");
ui_print("Clean System Busybox Binary");

package_extract_file("edzamber/clean.sh", "/tmp/clean.sh");
set_perm(0, 0, 0777, "/tmp/clean.sh");

run_program("/tmp/clean.sh");

delete("/system/xbin/busybox");

run_program("/sbin/busybox", "umount", "/system");

show_progress(1, 1);
ui_print("");
ui_print("");
ui_print("Please Reboot... ");
ui_print("");
run_program("/sbin/sleep", "2");

View attachment 4883263

View attachment 4883265
[Android Software/Hacking General [Developers Only]] Listy2021:
So if I was to flash it do I do it in TWRP or Magisk? Or doesn't it matter lol. Cheers again :good:
[Android Software/Hacking General [Developers Only]] osm0sis:
It's better you follow the simple steps I've outlined and learn to fix things yourself.
[Android Software/Hacking General [Developers Only]] Listy2021:
Okay, point taken :)