Disable loading any installed modules
HarryWindsor opened this issue · 2 comments
Device: Pixel 5
Android version: 13
Magisk version name:
Magisk version code: 25203
Currently, I have the problem that I always bootloop, and I have no way to disable loading the modules.
Is it possible to compile magisk myself without loading any modules? There must be a point in boot process where magisk is looking for installed modules.
I have already discussed this on XDA https://forum.xda-developers.com/t/magisk-general-support-discussion.3432382/post-87516189.
Thank you
index 7a269336e..998fad6a5 100644
--- a/native/src/core/module.cpp
+++ b/native/src/core/module.cpp
@@ -587,6 +587,7 @@ void magic_mount() {
char buf[4096];
LOGI("* Loading modules\n");
+ /*
for (const auto &m : *module_list) {
const char *module = m.name.data();
char *b = buf + sprintf(buf, "%s/" MODULEMNT "/%s/", MAGISKTMP.data(), module);
@@ -614,6 +615,7 @@ void magic_mount() {
system->collect_files(module, fd);
close(fd);
}
+ */
if (MAGISKTMP != "/sbin") {
// Need to inject our binaries into /system/bin
inject_magisk_bins(system);
diff --git a/native/src/zygisk/main.cpp b/native/src/zygisk/main.cpp
index 58200df3f..9398bf493 100644
--- a/native/src/zygisk/main.cpp
+++ b/native/src/zygisk/main.cpp
@@ -123,6 +123,7 @@ static void zygiskd(int socket) {
// Load modules
using comp_entry = void(*)(int);
vector<comp_entry> modules;
+ /*
{
vector<int> module_fds = recv_fds(socket);
for (int fd : module_fds) {
@@ -139,10 +140,11 @@ static void zygiskd(int socket) {
LOGW("Failed to dlopen zygisk module: %s\n", dlerror());
}
}
- modules.push_back(entry);
+ // modules.push_back(entry);
close(fd);
}
}
+ */
// ack
write_int(socket, 0);
Well done Harry... Saw this yesterday, but great to see your own innovative solution...
Seems you were right re. modules being the root issue (no pun intended)...
You code may be a useful alternative for others w/ module incompatibility... Good stuff, n thanks for including solution before closing issue...
Nb @huskydg has Magisk Bootloop Protector which I use:
https://github.com/Magisk-Modules-Alt-Repo/HuskyDG_BootloopSaver
I love your build-core-only-mode-magisk concept as a possible solution for others...
Simply adding an option in Magisk App to Magisk-patch a boot image with module loading parts disabled for emergency use seems to be a concept that may have legs and be useful for many especially when other methods to disable modules fail as in your case. (Users can remove modules and flash full Magisk after that)...