yashsingh1/xdaforums huggingface dataset:
[Magisk] zgfg:
CLI works only if Magisk is installed (ie booted with the patched IMG)

In that case Magisk app can uninstalled and you can execute CLI commands like

magisk

magisk -v

magisk --denylist

magisk --sqlite

Etc.

You can eg add/remove modules, manage DenyList, and by use of sqlite manage root grants

But again, Magisk (mask/service) must be active

Uninstalling Magisk app does not affect /data/adb where Magisk keeps its database, etc

And all that mngmt can be performed through the APK (UI/mngr) and/or through CLI commands
[Magisk] m0han:
which is what i'm keen to know more about. will be on the lookout for further info.
[Magisk] badabing2003:
The tool is mainly a UI layer on top of adb / fastboot commands, hence many of its features work on most phones,

If there are any questions or features that can extend its use beyond what it is today, I'll be happy to help out the best way I can.

We can discuss Magisk related stuff in here, but anything outside that I prefer either through DM or PixelFlasher thread (I tend to prefer threads over DMs mainly because it provides a wider exposure to people who want to contribute or benefit from the discussions, but am open to DMs)

@bnsmb this offer is open to anyone.
[Magisk] bnsmb:
Hi

>>@bnsmb this offer is open to anyone.

Thanks, I will definetly take a look at your tool but most probably not this week due to other open task that I must finish

regards

Bernd
[Magisk] bnsmb:
Hi

fyi:

The Magisk App is neccessary to grant root access :

-> Magisk installed into the boot partition and rebooted; Magisk App is not installed

in an adb shell:

1|ASUS_I006D:/ $ su -
Permission denied
13|ASUS_I006D:/ $

and on the phone:

regards

Bernd
[Magisk] badabing2003:
I believe the issue is with granting permissions to applications to be root.

In the first case the adb shell needs to be granted root permissions, and that part is managed by the UI

I never looked if we can grant permissions from CLI

How did you get the second one? doing what? or the it pop-ed up by itself when the system started?
[Magisk] bnsmb:
How did you get the second one? doing what? or the it pop-ed up by itself when the system started?

You mean the error message in the screen shot? If yes: This popup message opens after executing the "su -" in the adb shell. So that

is correct I think

and for the records:

After installing the Magisk App every things works

regards

Bernd
[Magisk] badabing2003:
right, it's trying to open the UI to ask you for the permission and it's not able to find the app.

I wonder (I doubt) if there is a way to grant permissions through CLI or editing db, although without root rights, one wouldn't be able to edit the db.
[Magisk] bnsmb:
I did that and in principle it works:

- install the Magisk App via pm command in an adb shell while the phone is booted

- boot into the TWRP image

- extract the script boot_patch.sh and all required binaries from the installed Magisk apk file into a temporary directory:

130|ASUS_I006D:/ # ls -l /data/MagiskInst/bin
total 228244
-rwxr-xr-x 1 root root 3530 2022-10-26 13:34 addon.d.sh
-rwxr-xr-x 1 root root 5954 2022-10-26 13:34 boot_patch.sh
-rwxr-xr-x 1 root root 2107848 2022-10-26 13:34 busybox
-rwxr-xr-x 1 root root 548140 2022-10-26 13:34 futility
-rwxr-xr-x 1 root root 42025472 2022-10-26 18:00 kernel
-rwxr-xr-x 1 root root 1208 2022-10-26 13:34 kernel.keyblock
-rwxr-xr-x 1 root root 1199 2022-10-26 13:34 kernel_data_key.vbprivk
-rwxr-xr-x 1 root root 234272 2022-10-26 13:34 magisk64
-rwxr-xr-x 1 root root 616408 2022-10-26 13:34 magiskboot
-rwxr-xr-x 1 root root 491528 2022-10-26 13:34 magiskinit
-rwxr-xr-x 1 root root 304248 2022-10-26 13:34 magiskpolicy
-rwxr-xr-x 1 root root 86433168 2022-10-26 18:00 ramdisk.cpio
-rwxr-xr-x 1 root root 100663296 2022-10-26 18:00 stock_boot.img
-rwxr-xr-x 1 root root 23888 2022-10-26 13:34 util_functions.sh
ASUS_I006D:/ #

- execute the script boot_patch.sh from the temporary directory to install Magisk into the boot partition

- reboot

Now I can open an adb shell and become root user via "su -" . Perfect

But if I open the Magisk App I get a Warning Message (see screen shot below) about an incomplete installation

And checking the directories in /data/adb it looks like this (only dirs; no files except the file magisk.db):

ASUS_I006D:/ # ls -ld $( find /data/adb )
drwx------ 6 root root 3452 1970-01-31 10:14 /data/adb
drwxr-xr-x 2 root root 3452 2022-10-26 18:22 /data/adb/magisk
-rw------- 1 root root 40960 2022-10-26 18:14 /data/adb/magisk.db
drwxr-xr-x 2 root root 3452 1970-01-31 10:14 /data/adb/modules
drwxr-xr-x 2 root root 3452 1970-01-31 10:14 /data/adb/post-fs-data.d
drwxr-xr-x 2 root root 3452 1970-01-31 10:14 /data/adb/service.d
ASUS_I006D:/ #

Pressing the "OK" button in the dialog the phone will be rebooted and after the reboot the missing files in /data/adb are created.

Any clue what is missing here?

regards

Bernd
[Magisk] zgfg:
You could use the following approach instead

- patch the boot.img and save to PC (your tool works through ADB)

- create a zip file for TWRP/custom recovery, that will flash the patched boot img (you mentioned that you have TWRP available for your device), see eg this zip file:

File on MEGA

mega.nz

- sideload the zip file to TWRP (custom recovery)

While rebooting, Magisk will properly create the /data/adb structure to finish its installation

The sideloading zip idea was from @badabing2003, discussed through PM and successfully tested on my two phones

Of course, do not use that same zip for your phone - it would flash the boot img that is not for your phone, causing the (soft) brick

PS: Edited the link, to point to the correct zip

When unzipped, pay attention to the (patched boot) img file and to:

META-INF/com/google/android/updater-script
[Magisk] bnsmb:
thanks .. but that is a very big hammer for a small nail ... I'll see if I can not find a smaller hammer
[Magisk] zgfg:
You could simply use MiXPlorer to edit the magisk.db - see my screenshots

Policies flags define root grants (Superuser tab in Magisk app)

UID for the particular app

Policy = 2 when root is granted, 1 when denied

Similarly, denylist flags correspond to DenyList and settings define if Zygisk is enabled (1) or not
[Magisk] badabing2003:
Thanks,

but don't we have a chicken and egg situation?

How do you grant MiXplorer root privileges with the Magisk UI?

Bookmarked, as the details are very handy to keep, thanks
[Magisk] zgfg:
Yeah, of course, for accessing /data/adb you need root (otherwise, you could eg replace magisk.db via TWRP)

It was only about how to make changes by using alternative methods, instead of by the friendly Magisk app (= UI mngr)

Btw, magisk.db can be also edited by:

magisk --sqlite

See eg:

Feature request: Extend CLI to show Zygisk status · Issue #6064 · topjohnwu/Magisk

CLI supports a lot, eg (partially) managing modules and DenyList but seems that even Zygisk status Yes or No cannot be checked through CLI Even better, it would be good to additionally have the opt...

github.com
[Magisk] bnsmb:
Thanks ; saved the post for later tests (the magisk.db internals are still on my list of open issues)

My goal is to install and configure Magisk completely without any user intervention via scripts so this method does not help .

I need the installation and configuration via script because I do a lot of installations from scratch of my develop phone with various OS and I do not want to install and configure the used tools on the phone manually every time.

regards

Bernd
[Magisk] badabing2003:
Considering that you're automating it through scripts, @zgfg 's idea here doesn't look like a big hammer (the script will take care of it)

By the way, are you intentionally using an older version of Magisk?
[Magisk] bnsmb:
I use Magisk-25.1_25100.apk - should be the current version
[Magisk] zgfg:
The latest Stable is v25.2
[Magisk] zgfg:
The following script (must be executed with su) will list all packages with the root granted

#!/system/bin/sh

GRANTED=$(magisk --sqlite "SELECT uid FROM policies WHERE policy = '2';")

echo 'Packages with root granted:'$'\n'

for UID in $GRANTED
do
UID=$(echo $UID | sed 's!^uid=!!g')
pm list packages --uid $UID
done
[Magisk] 73sydney:
@bnsmb

is it too late to ask what youre trying to do with this

i usually avoid trying to make things harder for myself, or risk bootlooping a device, but thats just me...
[Magisk] bnsmb:
nice ...

there's a typo in the script:

127|ASUS_I006D:/ # sh -x -n /data/list_magisk_root_permissions.sh
/data/list_magisk_root_permissions.sh[13]: no closing quote
1|ASUS_I006D:/ #

To fix it add the missing quote:

echo 'Packages with root granted:'$'\n'

or change the line to

echo 'Packages with root granted:'

regards

Bernd
[Magisk] bnsmb:
Hi

Why?

My goal is to install and configure the OS and all apps required on the phone via script without user intervention

Bernd
[Magisk] J0kker:
I've been looking for a link like this for almost an hour, every time it redirected to a invalid attachment (as it has been updated to v86.6) but this one works, a big thank to you, now it's time to try to make some magic and get POGO work again on my gf phone lol.
[Magisk] sim4000:
Hi everyone!

Safetynet updated too for me...

After flash a new rom, pogo and safetynet work few day.

But this morning, pogo and safetynet failed (red screen)

Is there any solution for the moment?
[Magisk] Triviox:
Check in attachment files in OP http://xdaforums.com/apps/supersu/suhide-t3450396/
[Magisk] Captain_Throwback:
Uninstall Magisk and use the SuperSU+suhide+RootSwitch combo with xsetprop binary in /su/xbin and post-fs-data.sh in /su/su.d.

This method isn't working on my HTC 10, though (well, xsetprop isn't working, and I refuse to use RootSwitch). But people on other devices report success.
[Magisk] andrew2432:
This method only works on marshmallow right? Su + Su hide is NOT for lollipop?
[Magisk] Captain_Throwback:
You don't need Magisk to use xSetProp. I only packaged it as a Magisk module because it was easy. The binary itself can be called and used however you want.
[Magisk] Captain_Throwback:
As far as I know, SuperSU only works in systemless mode on 6.0+. However, someone pointed this out in the latest SuperSU changelog:

(italics mine)

So perhaps it's possible with some unspecified 3rd party script? You'll have to inquire in the SuperSU Beta thread about it, I guess.
[Magisk] andrew2432:
Well there goes my productivity for the day! That just the official 2.78 thread?
[Magisk] mathy007:
The latest beta 2.78 sr2 can be install systemlessly on lollipop just add the command echo SYSTEMLESS=true>>/data/.supersu before you flash the zip tested by me for Su hide I don't know for now
[Magisk] grep_i:
If you need Magisk only for xsetprop than it is unnecessary.

You don't need Magisk to set this property and I guess the app or binary is also not only Magisk enabled, I guess they only made a Magisk module for your convenience and it will also work without it.

---------- Post added at 03:24 PM ---------- Previous post was at 03:16 PM ----------

As far as I know systemless is an option only available on Android 6+ so echoing that line would not install it systemless.

It will install though because it's disregarded and normal installation will continue.
[Magisk] mathy007:
Check the changelog on the latest Su beta zip you'll know what am talking about before now if set echo SYSTEMLESS true it'll disregard it but now it installed systemlessly
[Magisk] grep_i:
Checked changelog and saw this

- ZIP: Support systemless on 5.0 (requires 3rd party patches)

Don't know what those 3rd party patches are but I guess Magisk and only echoing SYSTEMLESS = true would not be sufficient to flash superSU systemless.
[Magisk] Captain_Throwback:
What makes you say that? Magisk is a 3rd party patch...;)
[Magisk] topjohnwu:
Hmm..... Actually not that hard ;)
[Magisk] grep_i:
3rd party in the eyes of the bespoken superSU
[Magisk] Captain_Throwback:
Yes....:confused:
[Magisk] alexpower:
When it's implement in new magisk version?

Gesendet von meinem HTC 10 mit Tapatalk
[Magisk] LaughingWaffles:
Hello, Pokemon go suddenly gives me the unsupported device error. It worked perfectly only 2 days ago and I haven't changed a single thing since then. Magisk hide is on and xposed status is off but it doesn't seem to work
[Magisk] alexpower:
Read last posts and you will know

Gesendet von meinem HTC 10 mit Tapatalk
[Magisk] 73sydney:
Okay, but as an end user, i personally wouldnt find that desirable for several reasons, and heres my main one:

Trust - youre seeking to, as part of the process - if im understanding it (please correct me if im misreading things), automatically root a phone in the background without user intervention and transparency.

I admire that your intentions may be good, but to me that would be a massive non-starter on any device i owned. Ever wonder why even Cyanogen Mod, now LineageOS has never distributed a pre-rooted ROM?

There are ROMs that have/do include Magisk as an option via something like aroma, and to be honest ive avoided ever using those options, and always done it post ROM install

Hell i have an AIO zip (installs TWRP, stops stock recovery being rewritten on 1st boot and decrypts data) file that i flash via ODIN with (stock) Samsung ROM, and the original creator of the method distributed it with magisk zip for auto install, and when i updated it and created a newer version, i purposely left magisk out of it because a) i was going to re-distribute it, and b) i wouldnt even use an automated TWRP magisk install on my own device.

Maybe thats just me being overly cautious though

We'd need to be related for me to use what youre trying to achieve, and even then id want a blood test first to make sure :)
[Magisk] bnsmb:
Hi

Well, yes but IMHO the "transparency" is better then doing all this manually because (a) I only use scripts that I've written myself or that I fully understand and (b) all scripts write log files so that I knew what went wrong in case of an error.

But, more important:

I do not do this on my phone for daily use -- I need this only for reinstalling my develop phone.

While developing and testing my scripts and tools it's necessary to reinstall the phone very often to get a well defined environment (sometimes 10 or more times a day ) And I really do not want to do the installation and configuration tasks manually each time.

And a nice side effect is that I learn a lot about Android, Magisk, TWRP, etc. while developing the scripts.

regards

Bernd
[Magisk] 73sydney:
Okay, so youre only doing this for your own phone. Perhaps i misinterpreted and thought you were proposing to do this on other peoples devices...maybe i misunderstood when you said "without user intervention"...you meant without intervention on your own device?

Apologies if i spannered that
[Magisk] bnsmb:
I develop the scripts and tools for myself first, but I think that they can also be useful for other users. Therefor I publish them.

Yep, start the script, drink coffee, and a little later the phone is reinstalled in a defined state.

Bernd
[Magisk] bnsmb:
HI

fyi:

I uplodaed the new version of my script to install Magisk into the boot parttion:

http://bnsmb.de/files/public/Android/install_magisk_via_twrp.sh

(The script should also be attached to the post in the XDA forum but I don't see it in the post)

The documentation is here

https://xdaforums.com/t/how-to-install-magisk-into-the-boot-partition-using-a-script.4456621/

and here

My_Howtos_for_Android
[Magisk] VStephen:
Magisk installed to recovery img how do I access phone Infinix hot 8 x650b
[Magisk] pndwal:
This:

https://topjohnwu.github.io/Magisk/install.html#magisk-in-recovery

Presumably you know key combo / key timing to enter Recovery on your device... It's just a matter of releasing all buttons at the correct instant to boot into system with Magisk... 👀 PW
[Magisk] VStephen:
Not working my device just boot into recovery normally.. does it have anything to do with flashing vbmeta
[Magisk] pndwal:
Not sure...

Please say device and OS...

Did you restore stock (unpatched) images first, especially if you tried patching boot.img previously?... Next, simply patch recovery.img w/ recovery mode selected and flash to recovery partition using fastboot? PW
[Magisk] 73sydney:
There are offsite references to TWRP for this device, and a matter of flashing Magisk zip and letting it do the work (as i still do on my S20+)

Im just trying to find an onsite one preferably to link....

yeah, theres a lot of "flash at own risk" disclaimers on shared TWRPs from 2 years ago, so im not even going to link...

The only suggestion i can see that is less than risky is to grab the boot.img via SP Flash Tool and patch the image

It looks like a real lot of faffing about (and ive done some faffing in my days) - id almost save up and get a different device

Backup/dump kernel image (and full ROM) without root for Mediatek Devices

I would like to pull the boot image of my device Pipo N7. I don't have root. I found the following link: Backup/dump kernel image without root or twrp/cwm` But when I try to find /dev -name 'by-n...

android.stackexchange.com
[Magisk] pndwal:
Further, this guide:

https://xdaforums.com/t/infinix-hot-8-x650c-root-twrp-un-bricking-custom-rom.3986799/post-80598837

indicates bootloader in Infinix Hot 8 can accept Magisk in boot ramdisk despite (OEM) Ramdisk = No...

It looks like many extra steps were previously needed, but there have also been many fixes in Magisk for MediaTek and legacy SAR devices in general since then...

I'd be trying to install Magisk per normal instructions for Magisk in boot; ignore Ramdisk = No and un-check Recovery mode before patching boot.img in Magisk App and flashing w/ fastboot per the advice I gave you yesterday:

https://xdaforums.com/t/discussion-magisk-the-age-of-zygisk.4393877/post-87640987

if you haven't already...

Restore images to unpatched/stock first... Can simply dirty flash a full ROM... this should fix any booting issues also...

if this doesn't now work out of the box for you, you may need to pursue special steps specific to your device mentioned in the guide linked above or elsewhere... 👍 PW
[Magisk] tosonny:
Hello folks! I'm having an issue with an app that suddenly recognizes Magisk and won't start. The app "Marriott Bonvoy" (a simple, stupid hotel app that I need in this case) is on the denial list. Hide Magisk App is enabled. Nevertheless, the app recognizes Magisk. What can I do?

Magisk 25.2

Edit: for all that have this problem, I think I could solve it by doing this:

- delete dates & cache in the app

- delete it from hiding list

- reboot

- delete dates & cache in the app again

- put it on the hiding list

- reboot
[Magisk] 73sydney:
First, thats one big ass apk....

Second, it did detect before being hidden

But upon force closing and clearing data...hey presto

Always try the basics before posting folks...................aka force close and clear data before trying to run again
[Magisk] 73sydney:
- install

- put it on the hiding list

- (if already run BEFORE hiding) delete data & cache

- test app

no reboot needed

if still failing, install Shamiko from halfway down this page, and make sure Enforce Deny List ISNT enabled in Magisk Settings and reboot and try again
[Magisk] ipdev:
For the record. ;)

CyanogenMod (along with other custom roms) did include a root daemon years ago.

I have not used this script in years.. 😛

unSU Script zip -- Unroot with ease!

[BETA][2017.10.01] SuperSU v2.82 SR5 - [xda thread] - Post #2,434​

Eventually root was removed from the CM build(s) and instead offered as an optional recovery flashable zip.

Around the time the "Systemless" idea started. :unsure:

The switch to LineageOS, still offered an optional recovery flashable root zip.

LineageOS Downloads - [WebSite] - Extras

LineageOS official builds are "user-debug" and include adbd.

The option to give adb root access.

Cheers. :cowboy:

PS.

If I remember correctly, some of the last CM and first LineageOS builds still included root depending on the device.

Might have only been unofficial builds. :unsure:
[Magisk] 73sydney:
I stand corrected! :) It was so long ago that i ran LineageOS etc

Comment withdrawn unreservedly :)
[Magisk] J.Michael:
If you have installed Magisk in recovery, it can be miserably hard to "boot to Magisk". If you use the buttons to boot to recovery, and you end up in recovery, you did not let go of the buttons fast enough.

Some people say they need a cable connected to the phone. Sometimes nothing on the other end. Sometimes connected to a computer. There might be an adb command that will boot to recovery -- since you are not holding down buttons, there is no issue of letting go soon enough.

Mostly, read a substantial fraction of the posts in this and in device-specific threads.
[Magisk] VStephen:
I really need help am planning on flashing twrp and using magisk zip
[Magisk] J.Michael:
That's two layers of complexity. And since TWRP becomes your new recovery, if you install Magisk into recovery you will have to patch the TWRP image. (I think I've seen some people do that, it might count as a third level of complexity.)

If you are just flashing TWRP as a means to install Magisk, I think you would be better off just installing Magisk.

Of course, if you want TWRP for TWRP's sake, carry on, as you were, best of luck...
[Magisk] bnsmb:
Neither the Binary for Ubuntu nor the binary for Kali works in Fedora 36 (both stop with error messages regarding missing library files) . I also did not yet get the source code compiled due to various errors: Missing pyhton modules, incompatible Python version (3.10), etc. ...

Python is a interpreted language so why not distribute a non-compiled version of the tool ?

regards

Bernd
[Magisk] m0han:
starting to get 'really' complex ;)

👍
[Magisk] badabing2003:
WxPython (the GUI layer) is the main issue, if you can find a wheel for your platform or mange to build it, the rest is trivial.

Unfortunately the packaged WxPython has some dependencies on GTK that seem to be missing / incompatible on some Linux flavors.
[Magisk] bnsmb:
OK, I finally got it compiled and started on Fedora 36 - first feature request submitted in github

(The used fonts and the font size should be configurable)

regards

Bernd
[Magisk] rodken:
Ah - the good old days...
[Magisk] J.Michael:
Is "WxPython" a "package" that cam be installed with something like "apt"?
[Magisk] bnsmb:
Not in Fedora ... and probably also not in other distributions . Use google to search for the installlation instructions for your distribution .
[Magisk] badabing2003:
The wheel can be installed from here

Index of /wxPython4/extras/linux/gtk3/fedora-36
[Magisk] pndwal:
On many A only legacy SAR devices (always Ramdisk = No) there is no option other than Magisk in recovery mode. In this case TWRP cannot be used "as a means to install Magisk" anyway; .zip installer will only patch boot.img so in-App patching with Recovery mode selected must be used!

And you are right; if Recovery mode Magisk is needed, keeping and patching recovery.img from ROM and living without TWRP is far less fraught, easier to upgrade etc. etc. However there are good device-specific instructions in official TeamWin RP (TWRP) site re. how to Magisk-patch twrp.img for many devices requiring Recovery mode. These are found in the per-device instructions written by that TWRP variant's maintainer.

What is not evident is whether this device actually requires Recovery mode... Many devices defy the assumption that ramdisk in boot cannot work where OEM never implemented one (ie. Ramdisk = No) simply because the bootloader itself, for whatever reason, actually supports ramdisk in boot and Magisk always 'manually' adds basic ramdisk if it's missing when patching images. Moreover, the fact that the old XDA thread for a regional variant of the same device indicated installation via .zip installer using TWRP is possible suggestions that Recovery mode is not required for this device...

Please say what ROM you are using; We don't know Android version, or if it's a custom ROM. Also, what version of TWRP...

Before using TWRP (may introduce several incompatibilities), did you try / consider these suggestions? 🤔 :

Re. your initial Recovery mode installation:

Re. Boot mode installation:

🙃 PW