Ways to dynamically skip loading modules? - Magisk

Is there a way to run modules dynamically from SD? In doing so, you have a way to easily disable them by removing the SD card.
Alternatively, is there a way to choose on boot to run Magisk in "safe mode", skipping some or all modules?
Maybe Volume Key Selector could fit the bill, but anything internal to Magisk?

You've got two Magisk built-in options to disable/remove modules already:
https://topjohnwu.github.io/Magisk/faq.html#q-i-installed-a-module-and-it-bootlooped-my-device-help
Other than that you could always setup your own way of disabling modules in a post-fs-data.d script (which loads before the modules are mounted).
Regarding your SD-card question, I guess you could run some elaborate bind mount thing, but that hardly sounds worth the effort...

Related

Magisk is being super weird, and another couple questions.

Whenever i use Magisk and i try safetynet test (I have francokernel so it shouldnt be an issue) and i have no modules installed it fails, with a CTS Profile Mismatch.... But if i tick core only mode and restart it passes safetynet..., i thought having no modules is the same as core only? but i need modules for Viper4Android to work... because somewhere down the line of the intense pain, i've made my device go through lol, it has practically muddled up the vendor partition, so i have to have viper installed for my audio to work properly... plus is there anyway to make the "/" part of the system stock again thanks.
You can actually modify certain parts of the system partition without tripping safetynet. Since safetynet was updated, I've decided to manually install any Magisk modules directly as /system modifications (mostly build.prop edits and a few new and modified system apps). Afterwards, turning on "core only mode" allows me to pass safetynet while continuing to keep my past modifications. The only problem with this setup is that I'll have to reflash all my modifications every time I dirty flash my ROM, whereas before Magisk would mount the mods automatically.

Idea: MagiskHibernate

Hi,
I have this idea and I like to know your opinion:
- At time the MagiskHide is a good method for use some Apps (wallet?) when you run in Core mode. This is a great function and really works (I hope for a long time). However, when you aren't running in Core mode, for example when Xposed is enabled, if you run one of such Apps it detects the presence of the su/root. So my idea is adding to Magisk the option to "hibernate" the Apps inside the list of MagiskHide when is not running in Core mode. And when the Core mode is on, then automatically "re-enable" the App.
The objective is quite simple: Block the execution of any "sensible" Apps when the detection can be done.
What you think?
If MagiskHide doesn't work on your device unless you activate Core Only Mode there's something wrong. It might be that that's how your device works, or there might be something else...
MagiskHide works perfectly fine, when when not in Core Only Mode.
Xposed though, that's a whole different matter. There's currently no way to hide Xposed, so it is very likely that what happens when you enable Core Only Mode is that the Xposed module gets deactivated and whatever app was triggering no longer do so (since you've deactivated Xposed).
Didgeridoohan said:
If MagiskHide doesn't work on your device unless you activate Core Only Mode there's something wrong. It might be that that's how your device works, or there might be something else...
Xposed though, that's a whole different matter. There's currently no way to hide Xposed, so it is very likely that what happens when you enable Core Only Mode is that the Xposed module gets deactivated and whatever app was triggering no longer do so (since you've deactivated Xposed).
Click to expand...
Click to collapse
Hi @Didgeridoohan,
Thank you for your comment!
However, I feel you misunderstood my suggestion. Let me explain more:
In my phone (at time, with Stock ROM and a Custom kernel), I can run Magisk in both modes: CORE and FULL. Both work like a charm! However, the SafetyNET check only pass in CORE mode (with MagiskHide enabled), not in FULL mode. Obviously, this is because in the FULL mode I run Xposed and the MagiskHide doesn't work.
So, when I like to run some wallet or banking App, I need to boot in CORE mode. This is mandatory!
And when I don't like to use such Apps, then I can boot in FULL mode.
Where is the problem? When running in FULL mode all Apps that can detect su/root are "active". You can use some Xposed modules (like BootManager) for not launching them at boot. However, if the App isn't "hibernated" it can be executed at any moment. And when it's executed, at this moment it detects the root... and fails. Moreover, it not only fails, but it can send a message to the App's provider... and insert you in a blacklist. So a full blocking of the App when running in Magisk FULL mode is necessary.
My idea is a simple "auto-hibernating" of the Apps in the MagiskHide list when running in non CORE mode.
You understand now what, when and why?
manos78 said:
So, when I like to run some wallet or banking App, I need to boot in CORE mode. This is mandatory!
Click to expand...
Click to collapse
Well... Core mode isn't necessary. You should be able to simply deactivate the Xposed module.
But yeah, I get your idea. Can't say much about it though...
Didgeridoohan said:
Well... Core mode isn't necessary. You should be able to simply deactivate the Xposed module.
Click to expand...
Click to collapse
If you want to be completly sure that SafetyNET is OK, then you really need to boot in CORE mode.
So, my idea at time is:
- Include the function "reboot in Core mode" inside the Magisk Tool. The concept is simple: one flag (for example one file like /magisk/.boot_one_shot_in_core) that forces Magisk to boot in Core mode... but only one time (the file is automatically removed after the boot).
- Create a Magisk Module that "hides Apps in the MagiskHide list". This module is as well very simple: it replaces the apks of the Apps in the list by a dummy file. So, when Magisk boots in FULL (normal) mode then the module "hides" the Apps, and you can't use them. However, when Magisk boots in CORE mode, the module is overpassed and the Apps be there (not hidden).
So, the idea is quite simple: the regular boot is booting with Magisk enabled (FULL mode); and when you like to boot in CORE mode it's only one-time... so in the next reboot. And when reboot again you return to the FULL mode.
I found this is the best and simple solution to execute/hide sensible Apps that really need to have SafetyNET enabled.
What you think?
Hi,
Regarding this idea: Create a Magisk Module that "hides Apps in the MagiskHide list. Anyone interested on work on it?
The concept is quite simple: If the module is active, it hides (aka mount fake .apk) all Apps in the MagiskHide list (or in a internal list).
You like this idea?

Script to enable/disable modules

Hi! Is there a way to enable/disable a Magisk Module with a script?
I'm using a Xiaomi Mi A1 and I would like to use Measure App. It works only the first time (or so) I disable/enable the module to change device fingerprint. Is it possible to run a script that disables and re-enables the module at boot? Thanks.
Disabling and then enabling a module takes a reboot between every action. It can't be done in one boot...
But, I suspect that this might not actually be the solution you're looking for. Provide more details, please. What module are you talking about? What functionality is it that you're after? What is it that doesn't work? Logs. Etc...
Didgeridoohan said:
Disabling and then enabling a module takes a reboot between every action. It can't be done in one boot...
But, I suspect that this might not actually be the solution you're looking for. Provide more details, please. What module are you talking about? What functionality is it that you're after? What is it that doesn't work? Logs. Etc...
Click to expand...
Click to collapse
Thanks for your quick reply.
I'm using a module that changes device fingerprint to Pixel2 to be able to use Measure app. Measure works properly only one or two times after enabling the module. Then it stops finding available surfaces until I disable, re-enable module and reboot. The same problem occurs if I use your MagiskHide Props Config (great work btw). After disabling-enabling-rebooting Measure works properly again. If I simply reboot without touching the module Measure app starts but it can't find any suitable surface.
Here's a logcat, hope it helps.
Do I understand you correctly? You're talking about disabling/enabling the module in the Magisk Manager, right? And disabling and then enabling right after, with no reboot in-between? If so, that makes no sense, because the only thing disabling the module does is to create a file in the module folder named "disable". On the next boot, Magisk will detect this file and won't load the module. Enabling the module simply deletes the file again, and on the next boot the module will load (since there's no "disable" file)..
I really do believe there's something else going on...
Didgeridoohan said:
Do I understand you correctly? You're talking about disabling/enabling the module in the Magisk Manager, right? And disabling and then enabling right after, with no reboot in-between? If so, that makes no sense, because the only thing disabling the module does is to create a file in the module folder named "disable". On the next boot, Magisk will detect this file and won't load the module. Enabling the module simply deletes the file again, and on the next boot the module will load (since there's no "disable" file)..
I really do believe there's something else going on...
Click to expand...
Click to collapse
I know it makes no sense but it works that way for me and for other people with the same phone/module. I was trying to find a way to automate this process at every boot so that at least the first time (after every boot) I'll use Measure it will work well. Otherwise log keep saying "Received image measurement before corresponding IMU measurement" then app crashes.
I'm 100% sure that it's got nothing to do with creating and deleting a file named "disable" in the module directory... There's something else going on, it's just that noone's figured out what.
Didgeridoohan said:
I'm 100% sure that it's got nothing to do with creating and deleting a file named "disable" in the module directory... There's something else going on, it's just that noone's figured out what.
Click to expand...
Click to collapse
I really don't know but I can reproduce this bug every time. How can I create and delete this file? Is there a path where I can put this file or magisk.img can be mounted? Sorry if it sounds ridiculous, I am not a developer...
If you really want to try you can just place a boot script in post-fs-data.d that creates and deletes the file in the module directory. Something like:
Code:
#!/system/bin/sh
touch <path_to_module>/disable
rm -f <path_to_module>/disable
The path to the module depends on what version of Magisk you're using (although there's backwards compatibility symlinks in place). In the current stable release the modules are in /sbin/.magisk/img, but the current code (in the Canary builds and in future releases) have moved this to /data/adb/modules.
Perfectly working, thanks. I used macrodroid to run the scripts you gave me after every boot.

Custom volume and brightness for every app

I would like to implement in Magisk possibility of setting custom volume and brightness of every app, but I completely don't know where should I start my education about android system. Is it possible to reach?
Best regards, your M16aV
Or a Module to disable the Sound in an APP.
That's a mod more suited for Xposed, not Magisk. Magisk does not alter running code like Xposed does, it simply injects new files to /system and /vendor, and runs a few scripts. All at boot.

[Guide][SM-T500/T505] Galaxy Tab A7 10.4 - Link to root, App2sd, SafetyNet Pass including cts profile

1. Root using magisk - Please refer to this excellent guide by @DJBhardwaj Click here for thread
2. App2sd pro by Vicky Bonick This is the playstore link
a. After activating root install busybox using any of the busybox apps on the play store. I used Busybox for android by jrummy (I know busybox is an older version in this app)
b. Format your SD card using MiniTool Partition Wizard (its a free app, just google and download) you can also use the internal tool on add2sd but they are unreliable and sometimes need a soft reboot to mount.
b1. For this to work we will first delete all partitions using MiniTool Partition Wizard or use the internal partition tool in the app2sd app.
b2. Then we will create our first partition, this is a fat32 partition (this will be a primary partition)
b2a. The fat32 partition should be larger than the ext2 partition as this is where most files are stored. An 80:20 ratio will work.
b3. Next we will create our second partition, this is a ext2 partition (this will also be a primary partition)
b4. Click apply and wait for this to complete
c. Insert the SD card into the tablet and restart
d. Once it has restarted open App2sd.
d1. On the main page click settings
d2. Click on Set su.d/post-fs-data here enter the value /data/adb/ (this will give it the directory for magisk)
d3. Check ignore systemless root
d4. Check Use pre installed busybox bianary
e. Now go pack to the app home and click on link apps to SD card
e1. Click on the three lines to open the menu
e2. Delete mount script
e3. Recreate mount script
e4. Select option ext4 (yes i know the sd card is formatted in ext2, ext2 option in app2sd has compatibility issues so for mount use ext4 option but the sd card format remains in ext2)
e5. Select I have su.d support/magisk is installed
e6. Create the script
f. Everything should now work, unfortunately the partition does not auto mount so every time you restart, you need to open app2sd and select remount 2nd partition (this is found in the three line menu in the link apps to sd card option. (if any one figures out how to get the auto mount working let me know and I will update the guide)
g. Now just link the apps and you are set
Edit 1 - Three very important notes
1. Do not click the fix SD card button. It will destroy everything on the SD card this only applies for when MiniTool Partition Wizard is used.
2. Always Link external data folder to 2nd partition, the first partition is having trouble relinking the data, which you need to do after every reboot. Short-cut to do this is by going into Link apps to SD card, Clicking on the three lines on the top left for the menu, Click on relink library file, then click on relink dalvik-cache files, rebind external folders
3. To preserve folders we need to link everything in the app2sd linking except for the APK.
How to pass the safety net check in magisk including cts profile
1. Open Magisk - open settings by clicking on the gear in the top right corner
2. Click on the toggle to enable MagiskHide
3. Click on systemless hosts
4. Download the latest zip of Universal Safetynet-fix from Github here
5. Click on the module icon (puzzle icon) in magisk
6. Click on install from storage and install the Safetynet-fix file you just downloaded
7. Install from the module list
7a. liboemcrypto disabler
7b. MagiskHide Props config (needed if safety checks are not passing after all previous steps : only use if you know what you are doing)
8. Now reboot your device all safetynet checks will pass, netflix and banking apps should work
Special Note how to retain L1 for netflix on rooted tab - After flashing the rooted OS, do not delete the system app of netflix, update it via an APK download with whatever the latest APK is; not from the play store. I repeat do not delete the system app of netflix that is pre installed.
Special Note 2 To make flow and other samsung apps work that give you the rooted error add them to the magisk hide option in the magisk app, this is in the second option (the shield). This will make flow etc work. You must also add the samsung core services apk to the magisk hide option. Samsung pay and pass will still not work.
Reserved
Did it like that and lost Widevine L1!! Didn't delete the Netflix app but updated it with a apk! Is there anything I can do?
Edit:
I do not need "liboemcrypto disabler" for SafetyNet pass! And with this module deactivated DRM Info as well as Netflix shows Widevine L1 but I'm not sure if it is FullHD when playing Video, is there any option to show the actual playback resolution?
Best Regards
glockmane88 said:
Did it like that and lost Widevine L1!! Didn't delete the Netflix app but updated it with a apk! Is there anything I can do?
Edit:
I do not need "liboemcrypto disabler" for SafetyNet pass! And with this module deactivated DRM Info as well as Netflix shows Widevine L1 but I'm not sure if it is FullHD when playing Video, is there any option to show the actual playback resolution?
Best Regards
Click to expand...
Click to collapse
Yes there is an option in the netflix settings that show if FullHD is available.
To Root the Tab A7 T-500 is the simplke thing to do : you need only Magisk, after you did flash the original AP - (and unlock Bootloader first) you will stuck twice : 1) push on/off button to pass first message - (you will never get rid of the messages - but it doesnt matter) than you will get to chosse Country & Language - this is the point were it will restart and you will stuck!! just go to accessibility and jump "back & forth" a few times - now you passed without restart! IMPORTANT - if your Tab will stop during Odin already : YOUJ MUST EXTRACT THE PIT FILE from CSC or one of those 3 files you got - then enter PIT on Odin, then it will repartition automatically (you will see, it does it byself) there you go!!!! the rest ist just updating Magisk App...... You did it! Have funView attachment 5379399View attachment 5379401
xthakila said:
1. Root using magisk - Please refer to this excellent guide by @DJBhardwaj Click here for thread
2. App2sd pro by Vicky Bonick This is the playstore link
a. After activating root install busybox using any of the busybox apps on the play store. I used Busybox for android by jrummy (I know busybox is an older version in this app)
b. Format your SD card using MiniTool Partition Wizard (its a free app, just google and download) you can also use the internal tool on add2sd but they are unreliable and sometimes need a soft reboot to mount.
b1. For this to work we will first delete all partitions using MiniTool Partition Wizard or use the internal partition tool in the app2sd app.
b2. Then we will create our first partition, this is a fat32 partition (this will be a primary partition)
b2a. The fat32 partition should be larger than the ext2 partition as this is where most files are stored. An 80:20 ratio will work.
b3. Next we will create our second partition, this is a ext2 partition (this will also be a primary partition)
b4. Click apply and wait for this to complete
c. Insert the SD card into the tablet and restart
d. Once it has restarted open App2sd.
d1. On the main page click settings
d2. Click on Set su.d/post-fs-data here enter the value /data/adb/ (this will give it the directory for magisk)
d3. Check ignore systemless root
d4. Check Use pre installed busybox bianary
e. Now go pack to the app home and click on link apps to SD card
e1. Click on the three lines to open the menu
e2. Delete mount script
e3. Recreate mount script
e4. Select option ext4 (yes i know the sd card is formatted in ext2, ext2 option in app2sd has compatibility issues so for mount use ext4 option but the sd card format remains in ext2)
e5. Select I have su.d support/magisk is installed
e6. Create the script
f. Everything should now work, unfortunately the partition does not auto mount so every time you restart, you need to open app2sd and select remount 2nd partition (this is found in the three line menu in the link apps to sd card option. (if any one figures out how to get the auto mount working let me know and I will update the guide)
g. Now just link the apps and you are set
Edit 1 - Three very important notes
1. Do not click the fix SD card button. It will destroy everything on the SD card this only applies for when MiniTool Partition Wizard is used.
2. Always Link external data folder to 2nd partition, the first partition is having trouble relinking the data, which you need to do after every reboot. Short-cut to do this is by going into Link apps to SD card, Clicking on the three lines on the top left for the menu, Click on relink library file, then click on relink dalvik-cache files, rebind external folders
3. To preserve folders we need to link everything in the app2sd linking except for the APK.
How to pass the safety net check in magisk including cts profile
1. Open Magisk - open settings by clicking on the gear in the top right corner
2. Click on the toggle to enable MagiskHide
3. Click on systemless hosts
4. Download the latest zip of Universal Safetynet-fix from Github here
5. Click on the module icon (puzzle icon) in magisk
6. Click on install from storage and install the Safetynet-fix file you just downloaded
7. Install from the module list
7a. liboemcrypto disabler
7b. MagiskHide Props config (needed if safety checks are not passing after all previous steps : only use if you know what you are doing)
8. Now reboot your device all safetynet checks will pass, netflix and banking apps should work
Special Note how to retain L1 for netflix on rooted tab - After flashing the rooted OS, do not delete the system app of netflix, update it via an APK download with whatever the latest APK is; not from the play store. I repeat do not delete the system app of netflix that is pre installed.
Special Note 2 To make flow and other samsung apps work that give you the rooted error add them to the magisk hide option in the magisk app, this is in the second option (the shield). This will make flow etc work. You must also add the samsung core services apk to the magisk hide option. Samsung pay and pass will still not work.
Click to expand...
Click to collapse
Far too much action, just to get Root! Just read what I was posting and save your precious time!
nobasband said:
Far too much action, just to get Root! Just read what I was posting and save your precious time!
Click to expand...
Click to collapse
If you read the post its not to get root! its so that you can use the memory card as an extended memory.
xthakila said:
If you read the post its not to get root! its so that you can use the memory card as an extended memory.
Click to expand...
Click to collapse
So what about a Magisk Module? There is a bunch of links on I.e. Google, to find
xthakila said:
If you read the post its not to get root! its so that you can use the memory card as an extended memory.
Click to expand...
Click to collapse
It is all about 2use external SD as an internal ? That’s simple, too
nobasband said:
It is all about 2use external SD as an internal ? That’s simple, too
Click to expand...
Click to collapse
I've owned several different Samsung tablets and it seems this discussion comes up over and over again. The answer is always the same. Nobody has solved it because the people who have the ability to do so, all consider it a bad idea. The external SD card is MUCH to slow to use to run apps. And if you move data storage, particular any 4k video files, to the external, then you shouldn't ever need more than 32gb of internal. The ONLY exception to this I've heard comes from people trying to run massive games that want to save the games on internal. And, IMO, buying tablets in this price range, to play these games, just doesn't cut it.
lewmur said:
I've owned several different Samsung tablets and it seems this discussion comes up over and over again. The answer is always the same. Nobody has solved it because the people who have the ability to do so, all consider it a bad idea. The external SD card is MUCH to slow to use to run apps. And if you move data storage, particular any 4k video files, to the external, then you shouldn't ever need more than 32gb of internal. The ONLY exception to this I've heard comes from people trying to run massive games that want to save the games on internal. And, IMO, buying tablets in this price range, to play these games, just doesn't cut it.
Click to expand...
Click to collapse
I was wondering too, why someone would want to use the slower SD for memory reasons....but it seems, that they all already know how to root the TabA7 T-500!
@xthakila 2nd partition mount on boot no problem for me, what i did differently is that i used integrated app2sd partition tool and made 1st partiton in exfat and 2nd partition in f2fs and in the Set su.d/post-fs-data option i put
Code:
/data/adb/post-fs-data.d
And didn't allow app2sd to change the system directly but tell it no if ask me if i want app2sd to write on system directly
Also changing mountspace mode in magisk to global might help too

Categories

Resources