yashsingh1/xdaforums huggingface dataset:
[Magisk] pndwal:
Wilhout analysing your various results much, I think SYSTEM_ROOT flag (incidentally changes to its behaviour were what partly broke 25209; 25210 fixed that) is a red herring... I have put some info. on RANDOMSEED commits at the end however...

You may have missed the implications of

(26.0, 26.1 release notes)

Not only will "installation of Magisk v26+ using custom recovery... be incomplete" and '"a subsequent re-installation through the Magisk app after booting up [be] required", but solutions like your PF are expectedly affected for the same reason; the "brand new pre-init partition detection mechanism" needs booted system to operate and set up the directories (in a partition that mounts properly) for the needed selinux/module rules when patching...

This means that patched image binaries will now differ but the system will still be rooted (not "fully") and functional; The difference will be that for PF, custom recovery.zip installation or patch_boot.sh script off-device patching this will be only partially functioning root!... It is enough to allow for Magisk reinstallation via Direct install, and this will fix root environment (absent selinux/module rules) in these scenarios...

This may be the way forward for PF also... Nb. Official instructions have been updated for .zip package/custom recovery users to indicate this requirement already... In any case, if you had opened Magisk App with such an image flashed you should have been greeted with the 'reinstall' dialogue... 😬 Nb.2. For some devices (Huawei etc), initial in-App patching (or a 'mini PF' .apk for Android ??) may be the the only option as boot.img can be patched but not flashed from system... See notes below...

... At least the change should fix modules that provide custom SELinux patches by including the file sepolicy.rule. 🙃

-----​

I put info on the need to reinstall Magisk w/ system booted back here... Notice the *** Important Note *** included re. patching boot images on a different device... :

and more recently:

-----​

Re RANDOMSEED

This commit:

Use stable random seed #6767

was merged from vv's 'seed' branch 2 weeks ago, combining:

- Use stable random seed

- Get random separately

- Make base as template argument for optimization

(This:

- Use stable random seed #6476

was made but not merged in Dec.)

Nb. It's still a WIP:

Make build reproducible #6675 ...

[x] Set stable random seed - [ ] enable configuration cache

👀 PW
[Magisk] pndwal:
Yup, I've made assumptions re. PF... Never used and may have forgotten what I did know of its workings... Assumed it patched on PC... I'll go read up on it soon...

Anyway, nothing to do with PF using recovery, just that as with recovery .zip installation you'd get differing binaries and partially working root if patching was done off device (but my bad as seems it's done on device)... 😬 PW
[Magisk] pndwal:
Moved here cos OT in USNF thread...

Suggest waiting for Magisk 27.0+... PW
[Magisk] martyfender:
I emailed the author of TB Checker through a link on the Playstore. He asked me to send a logcat.

As of yet, I have not had a response from him, or a new working update.

I did try older versions through apkpure. However, you have to download their app and non of those old versions work as it is a special installer that only installs in the apkpure app.

Do not install the apkpure app. It is either malware or at the very least very, very undesirable adware. After uninstalling it I kept getting random ad popups out of the blue. It took me a while to get rid of it's remnants.

Does anyone have any older, arm 8A versions of the apk installer. If you have an older version they can be saved with an apk extractor.

Thanks
[Magisk] a9381:
Compile failed.

Win11

Android Studio Electric Eel | 2022.1.1 Patch 2

Build #AI-221.6008.13.2211.9619390, built on February 17, 2023

Runtime version: 11.0.15+0-b2043.56-9505619 amd64

VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.

JDK 20

python 3.11.3
[Magisk] gallegonovato:
Good afternoon @ipdev @topjohnwu @zgfg

I don't know if this is the right place to ask this doubt. But I didn't know where to ask it.

After upgrading Magisk to version 26.1 from the previous stable version. From inside Magisk I always do the updates from the stable channel.

I look at the main screen of Magisk and I see that where it says App. In last it says not available. And it does not come out install as the previous version. When in the previous version if it came out. I have tested in the beta and stable channel. And still the same.

I attach a screenshot: https://ibb.co/kh4s3yg

I do not know if everything is correct or something went wrong in the installation. But I think that if I remove and reinstall Magisk the root of the device is screwed.

I use lineageos.

Thanks for your time and help.

Pd: and a question, what is the stub-release.apk for?
[Magisk] zgfg:
How is your Magisk app / Settings /Update channel set - is it on Stable?

Make sure you are online and if still not working, disable AdAway, reboot and try again (maybe one of your [many] hosts sources block)

Make sure you don't block eg:

topjohnwu.github.io
[Magisk] martyfender:
From the author:

“Yeah is just google library crash on android 9 i just wait update from the google to patch it”

Pada tanggal Sen, 17 Apr 2023 00.00,
[Magisk] ipdev:
OpenJDK failed for me a while back on Linux (fedora).

I do not remember the Magisk build script update but, something was missing from the newer OpenJDK.

I run magisk builds from command line.​

I ended up downloading and manually setting up Java from Oracle instead.

Java Downloads - [website] - [oracle.com] - Link

Hope it helps more than confuse. 🙃

Cheers. :cowboy:
[Magisk] rogers11:
Good morning,

just for the records: after today's LineageOS update, the Magisk app did not offer me the possibility of a direct installation. I could only patch a boot image.

I then tried it from the recovery (with *.zip) and Magisk was fully installed (this was not possible with 26.0).

Galaxy Tab S5e - LOS 20.0

Have a nice day.
[Magisk] ctcx:
@badabing2003 :

Finally I just did some test with version 25200 (the apk version 25.2 which is at Github releases downloads). Testing on Moto ocean device with LOS 20.0.

Coming from a previous post of yours:

https://xdaforums.com/t/magisk-general-support-discussion.3432382/page-2765#post-88387697

I finally managed to run the script so to make a patch identical (with SHA-256) to the one made with app UI.

Answering those previous doubts of mine:

---Yes, needed to include magisk32 as well even on arm64; for some reason Magisk does include it by default

---Not all stuff inside assets/ is needed, only the stuff needed by boot_patch.sh, documented at the beginning of the script itself

---For my case only flags KEEPVERITY, KEEPFORCEENCRYPT were needed. Seems that Magisk UI adds them by default as well without telling...

Talking about flags, reading your tests with Magisk 26.1, I saw that SYSTEM_ROOT flag is actually NOT even defined nor used in the boot_patch.sh script in Magisk 25.2 !! Probably this is why you got the same results with or without it.

Now a few doubts, if I may:

---I noticed that unzip command is available without the need of busybox. Is there a reason you use busybox one to unpack the apk?

---From your post

https://xdaforums.com/t/magisk-general-support-discussion.3432382/page-2772#post-88418707

how do you get the complete path of Magisk apk, called "base.apk", without root?

Thanks again.
[Magisk] IamRage7:
After direct flashing method, my device is running into bootloop and the ramdisk's status is also disabled. Facing this bug from v26.

Current Magisk version: 26.1

Device: K20 Pro running on custom rom based Android v13
[Magisk] pndwal:
At this point seems you had 26.1(?)... But perhaps not installed initially from .zip/recovery... Only .zip initially installed Magisk will offer addon.d Magisk survival for custom ROMs, otherwise root is lost w/ ROM update and Direct install requires root...

addon.d survival was broken in 25207 as I mentioned here:

https://xdaforums.com/t/magisk-general-support-discussion.3432382/post-88389541

and not discovered in time for 26.0 Beta... @osm0sis's Fix scripts PR was merged pre 26.1 however:

https://xdaforums.com/t/magisk-general-support-discussion.3432382/post-88392259

so Magisk should survive LOS updates again going forward as before. 🙂

... Not sure if .zip installing Magisk was actually broken in 26.0, but from that version (and in future) it would/will only achieve partially installed root due to major new selinux/module rule setup mechanism... Users are now prompted to reinstall Magisk using Direct Install (ie. patch with booted system) on opening Magisk App... This new implementation may have been improved since 26.0 however as there were several fixes added.

👀 PW
[Magisk] rogers11:
Ah OK, I had 26.1 installed via direct install.

That's great news.

Thanks again for your help.
[Magisk] a9381:
Yes, that's where I downloaded JDK 20 yesterday.

Need to download 17?

(OpenJDK - this is how it is in Android Studio, but I also installed JDK 20)
[Magisk] pndwal:
@osm0sis may correct me but I believe only initial install (.zip/recovery installation required) determines whether addon.d is set up, and it should remain after that...

Direct install is only an update installation and should have preserved working addon.d if your initial Magisk setup (26.0?, ie. after root was lost) was done using .zip/custom recovery... PW
[Magisk] badabing2003:
(y)

Makes sense, thanks for pointing out, didn't even think that it wasn't available in 25.2.

PF is used by many systems, and unzip is not necessarily available on all phones, you have it and good for you.

pm path <package name>

If Magisk is not hidden:

pm path com.topjohnwu.magisk
[Magisk] ctcx:
Thanks very much again.

After reading your answers, as well as more about PF code, I came with few additional doubts (sorry again...)

---In PF, there's this line

cp -f /data/local/tmp/pf/assets/stock_boot.img /data/adb/magisk/stock_boot.img

in case we're rooted, in order for Magisk to be able to restore stock in case of using the uninstall option.

However, by using UI, I found no such thing inside /data/adb/magisk... At most I found a "stock_boot.img" inside /data/user_de/0/com.topjohnwu.magisk/install, with some weird user:group ownerships, and a path as well only accessible with root.

Though this path also figures in boot_patch.sh script output

Also, maybe I didn't check correctly, but there were no /data/magisk_backup_* stuff neither?

---IIRC, the way to patch with root available was simply running

adb shell /data/adb/magisk/boot_patch.sh /sdcard/Download/boot.img

Does running like this do all of the other additional needed stuff like running cleanup beforehand and setting the correct flags?

---Is <package name> "base.apk"? And shat's "Magisk hiding", or where can I read about this?

Thanks again.
[Magisk] badabing2003:
This only applies to the following scenario:

The device is rooted, and root access is granted to adb shell (applies to PF, as it executes everything through shell)

The installed Magisk app version is newer than the running root core in /data/adb/magisk

In this scenario, PF uses the newer app and creates a patch using that, with the thought being that if the user has installed a newer Magisk, they most likely would want to use that Magisk to create a patch.

If the versions are the same, and root is available, PF will always use /data/adb/magisk/patch_boot.sh to create the patch and not unpack the app.

When the system is not rooted, there is no other choice but to unpack the app into /data/local/tmp and run it from there, when not running as root, the user does not have access to /data/adb/magisk, and because applications are sandboxed, the user can't write to the Magisk application's path either, of course the Magisk UI can, because it owns it.

Hence this copying is not performed.

When the system is rooted, but PF uses the app to create a patch (because it is a newer version) it can still make the copy, hence it does,

PF then initiates (triggers) a backup

The only scenario a backup is not made is when patch is created through unpacked Magisk and the system is not rooted (basically the very first time, or root is intentionally not granted)

However PF also has a Magisk Backup Management feature which allows you to manage the backups and even add or automatically make if one is missing (assuming that root permissions is granted)

No,

You need to do as follows.

adb shell "su -c 'export KEEPVERITY=true; export KEEPFORCEENCRYPT=true; export SYSTEM_ROOT=true; cd /data/adb/magisk; ./magiskboot cleanup; ./boot_patch.sh /sdcard/Download/boot_img; mv new-boot.img /sdcard/Download/magisk_patched_img'

I'm not sure I understand this question.
[Magisk] ctcx:
^ Sorry, I meant that.

And question apart was what "Magisk hiding" was, because I still don't understand it well. Or, where can I read about this

Finally, is /data/magisk_backup_* still where Magisk UI stores the restorable backups of the stock boot.img?
[Magisk] badabing2003:
Magisk hiding is done to avoid root detection by some apps, in which case Magisk would just be stub and running under a different package name..

There are many thread about root hiding if you're interested, but Magisk hiding is only a small aspect of that, It's a cat and mouse game,

Yes /data/magisk_backup_* are where Magisk backups are stored.
[Magisk] ctcx:
@badabing2003 , @zgfg :

Thanks very much for your explanations. Now everything until now is clear.

If anything, my only worry would be if eventually "banking apps" -in general- are able to bypass/destroy Zygisk/DenyList and SafetyNetFix, and we'd be forced to hide Magisk again in some convoluted ways...

Thanks again.
[Magisk] Uluru25:
... very helpful your summary! Thx!
[Magisk] badabing2003:
All of the root detection hiding will eventually be moot once Applications start checking for strong integrity provided by Google Play Integrity APIs, unlocked bootloader will not pass Strong Integrity, until then it's still cat an mouse game.
[Magisk] zgfg:
Yes, and since then (and due to the fact that Basic and Device Integrity can be mocked), developers of those 'banking' apps always need to re-invent the wheel by looking for Zygisk, for su in the path, for LSPosed hooks, for Magisk (and LSposed modules) app(s) (by package and/or by app names), for TWRP folder, for OEM unlocking or USB Debugging enabled, etc

That is, Google itself let you pass Device is certified by passing only Basic and Device Integrity (not asking for un-breakable Strong Integrity), and hence the other apps (their owners/devolopers) also do, and therefore they look for all those other ways to find if you're cheating (you have the 'root' but hiding it - 'root' meaning here that you're no more running the original, stock, unmodified and certified ROM: ie no custom ROM or custom Kernel, no custom Recovery, no Magisk, etc - not anything that requires flashing and hence first and foremost the unlocked Bootloader)

As simple as that. Or not - Google apparently still has some (technical) reasons and/or (not-technical) regrets for not going for Strong Integrity (even in the Wallet app), and not even on the new devices with new Android versions and hardware that requires proper Trusted Execution Environment implementation. Till then, the others also wait for the green light
[Magisk] HippoMan:
I would agree, as long as the word "always" in the above phrase, "always need to re-invent the wheel", actually means something like the following: "as long as Google continues to refrain from going all out for Strong Integrity in all cases".

I am not optimistic about their refraining forever.
[Magisk] FreSchDude:
Hi guys, was referred here by someone else and told to share my issues about some apps still detecting root.

I have Shamiko, Universal SafetyNet Fix and zygisk installed and enabled, and I've used various apps to test detection.

Basic and Device Play integrity tests pass, and all the tests for the "root test" on TB Checker pass as well. Still, some apps detect root unless I boot my android into normal non-root mode. (I've got magisk in recovery)

other thread I came from:

https://xdaforums.com/t/magisk-in-recovery-unable-to-reboot-to-unrooted-mode.4576493/#post-88426965
[Magisk] ipdev:
Magisk was bumped from Java 11 to Java 17 the end of Feburary,

Upgrade gradle - [github] - commit

I updated to 17 so I could continue running Magisk builds.

[ip@lost ~]$ java --version
java 17.0.6 2023-01-17 LTS
Java(TM) SE Runtime Environment (build 17.0.6+9-LTS-190)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.6+9-LTS-190, mixed mode, sharing)
[ip@lost ~]$

Cheers. :cowboy:
[Magisk] pndwal:
From powered off state you should be able to boot to unrooted system (this should simply bypass magiskinit in recovery ramdisk) by normal power-on... Not sure why you seem to have difficulty with this... Maybe boot.img got messed up? (Booting w/ Magisk bypasses boot init at magiskinit is in recovery, but did you ever patch AP w/o recovery mode selected, or applied some boot (or kernel) patch? 🤔

Re detections, I assume USNF is latest @Displax modded build, not official...

There are many ways banks detect root/modified environment now... Folders like TWRP, applist detection, memory leaks from Zygisk, Developer Options items etc...

I'd search / try Hide My Applist LSPosed module next. Ensure have 'parasitic' manager for LSPosed... Configure a template with all root related/associated (not just root) apps incl. hidden Magisk stub app and apply that to detecting bank apps...

In case of Injection detection, I'd wait for Magisk 27.0 which should have (WIP) Native bridge (hideable memory, like Riru had) Zygisk loading... Banks are detecting this ATM...

There are some more options, some recently discovered also, but try these first and report...

🙂 PW
[Magisk] FreSchDude:
I don't have ramdisk so recovery mode patch is required. I'm also damn confused why I have to boot into download to be able to boot to normal mode.

Yup, the modded one since original is outdated right?

Tbh I think this is a little too much trouble for me, I'd prefer booting between root and nonroot modes. Iirc last time I also gave up trying to hide magisk (back when magisk hide was a thing) so as of now I am just trying to figure out why normal boot throws me into magisk recovery mode. Really weird. Iirc also ADB reboot command boots into recovery.
[Magisk] pndwal:
Well you do... Magisk is always installed in ramdisk... Yours is just in ramdisk in recovery...

You just don't have OEM supplied ramdisk in boot partition... Even where Magisk adds a working ramdisk in boot, Magisk continues to report Ramdisk = No to indicate no OEM supplied ramdisk exists in boot partition (that's what Magisk indicates) despite now including generic ramdisk... In fact there are various other ramdisks in boot images also...

Well it's broken... Forked build has fixes... Older @Displax builds still work better for some devices too...

Ok...

Assuming you have stock ROM, could try patching stock AP again ensuring recovery mode is set, then apply all 4 binaries with Odin (use HOME_CSC to dirty flash / avoid data wipe) in case your boot.img got messed up somehow as I mentioned... Or are you on custom ROM? PW
[Magisk] FreSchDude:
I am running stock ROM and I recently patched AP to update my OS to the newest security patch.

Just to confirm - there is the difference between patching in root and nonroot mode in magisk?
[Magisk] J.Michael:
@FreSchDude Did you ever identify your device?

When I installed Magisk on a Samsung SM-T290 three years ago, the instructions warned me that I would have to do the dance to boot to Magisk every time I booted, or I would get Android without Magisk.

When I actually installed Magisk, after finally managing the dance to get Magisk to take control, I found that when I shut down and then reboot, I get Magisk. No dancing.

When I screwed up a module I was able to boot without Magisk. I remember it was easy. I do not remember what I did. It might have been as easy as holding the Power button to get the menu, and selecting "Reboot" rather than "Shut down".

As for booting to Recovery, it should be easy: Just keep holding the buttons until it comes up in recovery. The challenge for me was letting go of the buttons at that special spot where it was going to boot recovery, but Magisk had not already decided that I really wanted recovery. Hold the buttons too long and you get recovery -- no challenge.

What do you mean by "patching in root and nonroot mode in magisk"?
[Magisk] pndwal:
🤔 - guess by root mode you may mean Direct install as it's not available w/o root?... Nonroot mode being patch only?...

But the only mode I mentioned was recovery mode which, in the case of Sammy devices, directs Magisk to patch recovery.img instead of boot.img in the AP binary file... W/o this selected you get boot mode and Magisk patches boot.img... PW
[Magisk] FreSchDude:
My device is a note 10+, SM-N975F.

I know how to boot to recovery, it requires a pc connection or a headphone connector plugged in. Problem for me is booting to normal mode. No matter what I do it seems to reboot to recovery (rooted mode).
[Magisk] FreSchDude:
When I patch AP or update magisk in-app I only have the recovery option, no other option. From what the magisk site says, I must do magisk-in-recovery because something about ramdisk not being available.
[Magisk] pndwal:
Well you therefore have two options; boot-mode (standard) Magisk installation (with Recovery mode unchecked) and recovery-mode (with Recovery mode checked). 🙃

We don't know what you meant by 'root mode'... 🥴

And yes, you need recovery mode unless your bootloader has been updated at some point to become compatible with generic ramdisk in boot partition... In that case you could use Magisk in boot mode like Xiaomi devices where this works despite Magisk still reporting Ramdisk = No

If you only ever patched AP with recovery mode selected the patch should be good... As long as you followed other institutions, eg to flash all 4 binaries (not just AP) and to transfer files using ADB pull (not MTP)... PW
[Magisk] FreSchDude:
Sorry about that boss, I'm not very good with words. Root mode is recovery mode lol

Huh. From reading the guide, it said that as long as I got "Ramdisk - No" I must have recovery mode checked. Tbh, I think it's for the best to have it in recovery mode because it's convenient to swap between the two.

That is exactly what I did, I patched AP in magisk, pulled it via adb to my pc, then flashed the update. Did that yesterday to update my OS security patch. My phone still somehow boots to recovery from power off, so I'm not sure how I could debug this.
[Magisk] pndwal:
Lol

Not quite... The guide mentions exceptions like most Xiaomi A-only legacy SAR devices... There are Sammy exceptions too... The only way to know if it works (ie. if you have a compatible bootloader) is to try boot mode patching... May work; likely won't...

That's the strange thing and why I'm wondering what is actually patched... Standard power up should only give you system with Magisk if a) you patched AP in boot mode (unchecked recovery mode) and b) if bootloader is actually compatible with ramdisk in boot partition... As I said, Magisk will always manually add a generic basic ramdisk when patching boot if OEM ramdisk is not provided just in case (as with Xiaomi devices as a rule) boot mode can work... It'll work but still say Ramdisk = No in such cases...

If boot is not patched (as you say) I guess you must really be booting to system via recovery... I just don't know how this could work; guess Magisk could somehow be rebooting via recovery after a standard boot.img init is called... I'm unaware of such a change in Magisk changelogs or being documented elsewhere however...

Is there any real indication you actually booted rooted system via recovery?... PW
[Magisk] zgfg:
Strong Integrity can be requested selectively - for those devices where it applies. Not for old ones and not for models with broken keymaster or where keys were revoked...

In some countries/markets, those will be a majority or a significant portion of (Android) mobile phone users, hence eg banks there can do