yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] osm0sis:
That's super weird. I have no such issues on my devices. 😕
[Android Software/Hacking General [Developers Only]] zputnyq:
Yup that's it. Anything else I could provide (boot.img probably), since the boot log won't help much, I had taken it many times & the result was the same as I posted here ?
[Android Software/Hacking General [Developers Only]] osm0sis:
Well arguably it's something related to a change in Magisk on your device, rather than my module or my installer, since the symlinks should be the same regardless since they're in xbin. 🤔

Can you give me the output of `su -c magisk --path` on 20.4 plus the list of symlinks in the busybox module, and then the same on 22.0?
[Android Software/Hacking General [Developers Only]] zputnyq:
Magisk path is the same for both, they're in /sbin. Differences are in /sbin/.magisk/mirror, on v20.4 it has folders named system, data & vendor while on v22.0 it adds / includes folders cache, persist & sepolicy.rules. For sepolicy.rules folder I saw it linked to modules folder.

My apology I don't really get what you mean by "symlink in the busybox module". On magisk v22.0 I use nolinks since if I install it directly / without nolinks command it will bootloop my device, inside busybox module folder only busybox file no symlinked applets.

I attached magisk log for symlinked files on magisk v22.0 & 20.4
[Android Software/Hacking General [Developers Only]] osm0sis:
Yeah I want you to install it without nolinks and tell me what's in there before you reboot and loop yourself.
[Android Software/Hacking General [Developers Only]] zputnyq:
I had compared both magisk v20.4 & v22.0, what should be symlinked is the same after busybox module flashing (before reboot), including inside magisk modules & modules_update folder.

Nevermind I'm gonna stick with magisk v 20.4, v 22.0 gives me more issues.

Thank you very much, I really appreciate it.
[Android Software/Hacking General [Developers Only]] osm0sis:
If you could test which Magisk Canary was the first to exhibit this issue it would be helpful. I'm reporting the issue to topjohnwu.
[Android Software/Hacking General [Developers Only]] HippoMan:
Does anyone know of a utility which can run on android phones (or at least *some* android phones) which could extract the current ROM into a flashable zip file? I'm not talking about a restorable nandroid backup, but rather, a zip file that can be flashed onto the phone via "Install" from Recovery, in order to install the OS.

Or perhaps is there a utility which can convert a nandroid backup into a flashable zip for installing the OS?
[Android Software/Hacking General [Developers Only]] levone1:
Question for anyone... I have used fastboot - ADV module on my Xperia X Compact many times to flash custom ROMs to other phones, (stock Oreo based rom). Now I am using XA2 with custom AOSP based rom, (Android 10). I installed Magisk and flashed the module, and everything functions fine in the terminal, but I cant get the other phone into fastboot mode or flash mode. All that happens every time I connect the cable is that the phone powers on, no matter which buttons I hold. Same thing with every USB mode, and same in recovery. ..

Is this an issue with Android 10, or with the XA2, or with AOSP, or...?

Thanks
[Android Software/Hacking General [Developers Only]] segfault_bilibili:
I got Segmentation fault with busybox-arm64-selinux while executing "netstat -l" on Lenovo ZUK Z2 Plus, LineageOS 17 (Android 10). Only a few lines were printed out.
[Android Software/Hacking General [Developers Only]] osm0sis:
Hmm can't reproduce that on my 8T with OOS11. Only thing I see is that it requires you being at a root prompt first or permission is denied.
[Android Software/Hacking General [Developers Only]] segfault_bilibili:
I ran "busybox netstat -l" with root. It doesn't seem to be related to permissions, after all I have flashed magisk module.
[Android Software/Hacking General [Developers Only]] segfault_bilibili:
Without the "-l" (or "-a") option, netstat seemed to be normal. It only produces segfault if I try to list listen ports.
[Android Software/Hacking General [Developers Only]] segfault_bilibili:
Since you can't reproduce it on your device, I'll try to figure this out by putting some debugger onto my device...
[Android Software/Hacking General [Developers Only]] segfault_bilibili:
Ah, next time maybe you should provide unstripped binaries as well.
[Android Software/Hacking General [Developers Only]] segfault_bilibili:
I retried netstat -tln with your non-selinux build, this time there's no segfault.

I tried with my non-selinux build, too, can't reproduce this segfault either.

Maybe it's related to selinux support, however currently I don't know how to build a selinux-supported one.
[Android Software/Hacking General [Developers Only]] osm0sis:
Weird. My output is from the SELinux build though, so still something device/setup-related going on.
[Android Software/Hacking General [Developers Only]] DiamondJohn:
I thought I would run it out of interest. I have a Pixel 4a running the latest March A11, rooted with Magisk v22, running Busybox, SELinux enforcing. I dont need or wish to run it, but I gave it a go, and here is the output

sunfish:/ # busybox netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
Segmentation fault
139|sunfish:/ #

I was on 5G WiFI with a large hostfile (>700k of blocked hosts)

I also ran a logcat, and I didnt see anything in there regarding a crash.
[Android Software/Hacking General [Developers Only]] mrrocketdog:
havent tried myself , but i found this ;

https://xdaforums.com/t/convert-nandroid-backup-to-flashable-zip.2209590/

maybe what ur looking for.
[Android Software/Hacking General [Developers Only]] HippoMan:
Thank you!

This looks promising indeed! However, sadly, I don't have an easily accessible Windows machine. I run linux. But this nandroid-to-flashable-ROM work isn't something that I would want to do very often, so I guess I can get by with my not-so-frequent Windows access.

I can try running the utility under wine, as well.

I should be able to report my findings within a week or so.
[Android Software/Hacking General [Developers Only]] HippoMan:
PS: but then again, I just saw this in the page that this link points to:

This is doable under linux, and it looks even more promising!

PPS: Well, it's not so easy, after all. I now realize that most modern zip files look like this ... a few smaller entries and a huge payload blob:

# unzip -l typical-zipfile.zip
Archive: typical-zipfile.zip
signed by SignApk
Length Date Time Name
--------- ---------- ----- ----
873 2009-01-01 00:00 META-INF/com/android/metadata
1001 2009-01-01 00:00 care_map.pb
8118 2009-01-01 00:00 compatibility.zip
2295695219 2009-01-01 00:00 payload.bin
156 2009-01-01 00:00 payload_properties.txt
1411 2009-01-01 00:00 META-INF/com/android/otacert
--------- -------
2295706778 6 files

Everything is packed in payload.bin, and there is no explicit /system entry in the zip file. I'd have to figure out how to unpack payload.bin and then hope I could find /system and replace it, after which I could hopefully repack payload.bin and replace it in the zip file. I'll investigate.
[Android Software/Hacking General [Developers Only]] segfault_bilibili:
As for me, I don't edit hosts.
[Android Software/Hacking General [Developers Only]] ipdev:
@segfault_bilibili

@DiamondJohn

Started as a quick check that turned into a bit more. :D

Can you give Magisk canary a test.

busybox netstat -l works with canary 22006.

Failed with canary 22005.

A bit of my testing..

Pixel 3aXL, custom rom (abc 11).

[GitHub] - Link

Pixel 4a, stock Google.

[Factory image (sunfish)] - Link

bonito:/ # netstat --version
toybox 0.8.3-android

sunfish:/ # netstat --version
toybox 0.8.3-android

bonito:/ # busybox netstat --version
busybox: unrecognized option `--version'
BusyBox v1.31.1-osm0sis (2020-05-06 20:45:25 ADT) multi-call binary.

sunfish:/ # busybox netstat --version
busybox: unrecognized option `--version'
BusyBox v1.31.1-osm0sis (2020-05-06 20:45:25 ADT) multi-call binary.

Sunfish was on Magisk 22006 and busybox netstat -l worked.

Bonito was on Magisk 22005, busybox netstat -l failed.

After a bit of testing (more than I expected).

Updating Bonito to 22006 was all it took to make busybox netstat -l to work.

Cheers all. :cowboy:

EDIT:

@segfault_bilibili

@DiamondJohn

Just checked after another two reboots busybox netstat -l fails on Bonito again. :(
[Android Software/Hacking General [Developers Only]] segfault_bilibili:
I wonder how did you build selinux-enabled busybox? I tried to build libselinux, libsepol, pcre etc with android-ndk-r15c, all of them seemed to build successfully, however while I finally tried to build busybox, some weird linking errors appeared (undefined reference to stderr etc).
[Android Software/Hacking General [Developers Only]] DiamondJohn:
Sorry, but its my daily.
[Android Software/Hacking General [Developers Only]] osm0sis:
topjohnwu's ndk-box-kitchen for the SELinux ones.

I'm on 22006 by the way.
[Android Software/Hacking General [Developers Only]] HippoMan:
Forgive me if this is OT (and feel free to delete this post if it is). But since lots of helpful tools and utiltities are discussed in this thread, I'm guessing that perhaps someone here would be knowledgeable about my question:

I do a lot of testing of different ROMs on my OnePlus 7Pro. Once I get a new ROM set up, I go through a time-consuming and annoying procedure of resetting a lot of the basic Settings to values that I prefer. I'm wondering: is there a utility that will allow me to save a collection of Settings into some sort of file that I can push to my device with a newly flashed ROM, and another utility (or perhaps the same one with a different option) which I can use to install this group of saved settings onto the device, all at once?

Thank you in advance for any thoughts or suggestions.
[Android Software/Hacking General [Developers Only]] DiamondJohn:
I use to build and flash a LOT of custom ROMs for my previous phones. I found that a LOT (but not all) of the customisations were stored in the android settings. As such, I built the saving off of these settngs, and the generation of a script to reinstate them into my app TeMeFI. You can find these functions under Current State>Settings>* NB: All the script code is available from the app.

I generate a list once I have my set-up all done, save that off to my PC (a Generate Set All). Then, when I flash a new ROM, I generate its settings and save them off. Then compare the two and selectively re-instate the settings. If you repeatedly re-flash the same ROM, you can create a script file to reinstate as much as you can. But, different ROMs may have different settings, so you need to review the differences. A lot of ROMs kang the features off each other, so use the same setting.
[Android Software/Hacking General [Developers Only]] HippoMan:
Thank you! Once again, TeMeFI comes through.

From your code there, I now see that I can actually perform CRUD operations on settings with ...

...

... the settings command.

This makes my task simple.

Thank you again!
[Android Software/Hacking General [Developers Only]] DiamondJohn:
You could also go directly to the sqlite database with SQL, but the settings interface is much easier, and will exist the same across android versions, whereas the settings dB can change between ROMs and android versions. However, you may find some settings that are only stored / accessed by the user in shell commands through the dB (or at least I cant find another shell interface) eg, for my charging sound on a Havoc Oreo ROM (LOS based), I had to go to the database /data/user_de/0/org.lineageos.lineagesettings/databases/lineagesettings.db Again with TeMeFI, you can see a history/log of SQL commands the ROM has issued when you make a change, by using the Current State>Dumpsys>Dumpsys Service Calls>dbinfo Which is how I found how to correct my charging sound in a boot-script. However, NOW on my A11 Pixel 4a, its now a simple settings command.
[Android Software/Hacking General [Developers Only]] HippoMan:
Thank you. I'll use the settings command for this, and I'll only go to direct sqlite access for edge cases like you have described. And I see that Current State>Dumpsys>Dumpsys Service Calls>dbinfo will be very helpful in this instance.
[Android Software/Hacking General [Developers Only]] osm0sis:
Here's a fresh unstripped build in case it's still of use for debugging the issue you're seeing on your device. Let me know what you figure out! :)
[Android Software/Hacking General [Developers Only]] m0han:
excuse my lack of knowledge; is this good for 'magisk install'? i'm on your 'busybox for android ndk' 1.31.1(13123).
[Android Software/Hacking General [Developers Only]] osm0sis:
No, you should probably wait for me to push the stripped release builds to the Magisk module repo.

Not long now... 😎
[Android Software/Hacking General [Developers Only]] osm0sis:
Still got a few things to do before I update the rest of the thread here, but the Magisk Modules Repo has been updated with busybox 1.32.1. :)

In the meantime, here's another little one-off simple Magisk module, which I may or may not keep updated going forward. payload-dumper-go ported the original Python payload_dumper into Go, meaning it could now be cross-compiled, so we can now use it to extract payload.bin OTA zips on-device with no Termux/Python overhead! It took some cross-compile hacks and a wrapper to get it working smoothly on-device, but that's all good fun. :cowboy:

Cross-compile process notes and other builds in the official payload-dumper-go thread here: https://xdaforums.com/t/tool-a-quick-android-ota-payload-dumper.4173271/#post-84721689 (y)

Only issue I've seen so far is that on a HUGE payload.bin it can run out of memory and fail to extract the largest partitions, regardless of platform, so I believe that's more of an issue with payload-dumper-go itself than my compiles. It certainly works very well to get boot.img and recovery.img, etc. from a Full OTA quickly. Generally I've had best results extracting on my OnePlus 8T, which is a decently beefy device. 🤘

Edit

: Updated module to the v1.1.0 release which should resolve any out-of-memory issues, and now allows choosing which partition to extract, thanks to the excellent work of Lineage's @LuK1337 and @luca020400. 🙌

Edit 2

: Updated module to the v1.2.0 release which adds more command-line options, and fixes some edge cases for my wrapper script. 🐙

Edit 3

: Updated module to the latest v1.2.2 release.

Edit 4

: Updated module with an arm64 binary for arm64-only devices.
[Android Software/Hacking General [Developers Only]] HippoMan:
Thank you for this!

Given that it's written in Go, I'm wondering: can I also compile and run it on my linux desktop?
[Android Software/Hacking General [Developers Only]] osm0sis:
Follow the link, it already is. ;)

Oh yeah, and I forget who it was asking for busybox LFS (large file support) at one point, but I just double-checked and the existing experimental patch for it does still merge cleanly, but it still seems like a pretty big can of worms I don't want to get into, so whoever wants to try it can try building with it and report back and/or PR fixes, but I don't plan to maintain that one myself: https://github.com/osm0sis/android-...ental/0001-add-LFS-support-EXPERIMENTAL.patch
[Android Software/Hacking General [Developers Only]] osm0sis:
Finally figured out the right method for keeping SafetyNet passing even though the new Virtual A/B slot Incremental Google OTA process needs the updated slot to stay unrooted to pass the post-reboot checks:

(Note: A prerequisite is you must have Developer options > Automatic system updates turned off. I do this as soon as I set up any rooted device on stock ROM.)

Attempt to Download & Install update via the dialog, it will fail due to the rooted current slot. This is fine and what we want just to have it downloaded first.

Unroot current slot WITHOUT rebooting by restoring the stock boot/recovery images (and vendor_boot image if your device has one and a custom kernel may have changed it).

Download & Install update again, which will work now, but DO NOT reboot after. Note WiFi must be/stay enabled for this step.

Dump the updated slot's boot/recovery (and maybe vendor_boot) images, then root patch the image needed for your device using the Magisk app, and copy the new magisk_patched.img to your PC.

Re-root the current slot using the Magisk app Direct Install, so in case the update somehow fails you'll be back where you started (rooted on the current slot).

Turn on Airplane Mode, then reboot from the update dialog.

Let OTA finish after reboot, leaving Airplane Mode on, make sure you're on the updated slot, then reboot to fastboot.

fastboot flash the magisk_patched.img to the appropriate partition, then boot the device.

Make sure you're rooted again and still on the updated slot, optionally reboot again if you're using any Magisk modules with overlays which need to become active again, then finally, turn off Airplane Mode.

Ta-da! SafetyNet never caught that you were unlocked and unrooted, continues to pass, and Play Store's still Certified and Google Pay still passes Contactless setup checks.
[Android Software/Hacking General [Developers Only]] nowster:
Or (for Google devices) grab both the full OTA and the Factory images. Set airplane mode. Reboot to recovery. Adb sideload the OTA. (If you have a modified kernel you may need to restore the original boot image for signatures to match.) Allow the update to boot. Extract boot.img from the factory image and patch it in the phone using Magisk. When the OTA updates have completed, flash the modified boot.img in the bootloader. Boot up and disable airplane mode.

The key thing is not allowing the phone any access to the net whilst it's modified and unrooted.
[Android Software/Hacking General [Developers Only]] osm0sis:
Yes, that's basically the old method before Magisk app's post-OTA install feature, but often OTAs don't have the corresponding factory image out at the same time, and/or don't have Full OTAs at all, which is why I specifically said my instructions were important for Virtual A/B Incremental OTAs mediated by Google Play services.

Most of these Virtual A/B devices also don't have custom recoveries yet since they launched with Android 11, and I know for a fact Virtual A/B support hasn't been added to TWRP yet. 😉
[Android Software/Hacking General [Developers Only]] zputnyq:
@osm0sis fyi, the busybox issue I experienced, when I Installed your busybox, its applets couldn't symlink & caused bootloop had been fixed with canary 22103
[Android Software/Hacking General [Developers Only]] osm0sis:
🤯

Must have been one of the fixes to module setup logic from yesterday: https://github.com/topjohnwu/Magisk/commits/master 🎉
[Android Software/Hacking General [Developers Only]] tres_linguas:
I have an issue with the 999-flashafterupdate script. It does run after an update but it does not flash the zip I want it to.

The zip as such is fine - I can flash it manually and it works.

Here is the output of the script that I stored in the log file as suggested:

FlashAfterUpdate by osm0sis @ xda-developers

--- Flashing '/sdcard/FlashAfterUpdate/fp2sleep_gary.zip'...

...Failed! Exit code: 139

--- Flashing '/data/flashafterupdate/*.zip'...

...Failed! Exit code: 127

What do these error codes mean?

Thx for any help
[Android Software/Hacking General [Developers Only]] osm0sis:
They're just whatever the zip reported when it failed. It shouldn't attempt to flash "*.zip" though, that's weird. I've never seen that before.

Can you show me the contents of the directory? And the zip? You should try enabling verbose and logging to see what's going on with the flashing as well, and show me that.
[Android Software/Hacking General [Developers Only]] tres_linguas:
I attached both.

Its gettin strange: I deleted the FlashAfterUpdate folder in main storage so only the one in /data remained. Flashed the Rom again, but this time manually (not through updater app). Now it worked. Dont know what caused this.

What is also strange:

- the deleted folder was automatically restored

- in both folders a 'disabled' folder was created automatically (see screenshot)

[EDIT I just had a closer look at the script and realized the Behavior of the two points above is intentional]

- although I have a verbose file, too, no output of the zip can be found in it (still empty file) [EDIT I'm attaching the relevant part of orange fox recovery log file so you can also see the output of the zip]

Well, in spite of the stuff I don't understand, seems that it works now. Thanks for your answer, anyways 🙂👌🏻
[Android Software/Hacking General [Developers Only]] janres155:
I checked "/sys/block/*/queue/read_ahead_kb" the default values are 1024. Should I left the scripts at 512 or should I change it to 1024?

Btw, so far I haven't encountered a problem. :)
[Android Software/Hacking General [Developers Only]] osm0sis:
Your ROM or kernel must have set that default. Up to you what you want to do. Benchmark and see what works better on your scheduler and device.
[Android Software/Hacking General [Developers Only]] taadow1030:
Does the SD card fix script work for TWRP as well?

Edit: disregard
[Android Software/Hacking General [Developers Only]] :
/storage/emulated/0/

Hi, I have problems writing internal memory on samsung galaxy s4 mini

no rw permissions on /storage/emulated/0/ when I try to download something or installing apps

can I replace /data/media/0 with /storage/emulated/0/ ???

what You think? :)

[MENTION=4544860]osm0sis[/MENTION]

I already tried the platform.xml solution

<permission name="android.permission.WRITE_MEDIA_STORAGE">

<group gid="media_rw"/>

</permission>

factory reset and /data/media wipe

but nothing :)
[Android Software/Hacking General [Developers Only]] osm0sis:
/storage/emulated is the symlink fusefs location. Look for your sdcard while booted to recovery with AROMA Filemanager. Don't use /sdcard though, it's just a mount and you want the real deal. It might even still be /data/media ;)

Anyway, sdcard permissions fix might do the trick.
[Android Software/Hacking General [Developers Only]] :
Everything works now.. Without any edits to your script..only the web browser is still saying he don't have permissions to write on internal memory when I download a file

Bah XD

XD i'm a nexus user, never had these problema lol

:)