From 5d575d4e4313ffa2911d3b3abddda1677d9c762e Mon Sep 17 00:00:00 2001 From: Rikka Date: Sat, 21 Nov 2026 22:20:19 +0800 Subject: [PATCH] Fix Magisk manager signature validation in ReDroid Package the matching stub APK so the bootless daemon can read the manager signing certificate. Query the installed manager package before attempting a boot-time install. --- stuff/magisk.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/stuff/magisk.py b/stuff/magisk.py index e98052f..da25985 100644 --- a/stuff/magisk.py +++ b/stuff/magisk.py @@ -40,7 +40,7 @@ on property:vold.decrypt=trigger_restart_framework on property:sys.boot_completed=1 mkdir /data/adb/magisk 755 exec u:r:su:s0 root root -- {MAGISKTMP}/magisk --auto-selinux --boot-complete - exec -- /system/bin/sh -c "if [ ! -e /data/data/io.github.huskydg.magisk ] ; then pm install /system/etc/init/magisk/magisk.apk ; fi" + exec -- /system/bin/sh -c "if ! pm path --user 0 com.topjohnwu.magisk >/dev/null; then pm install {MAGISKSYSTEMDIR}/magisk.apk; fi" on property:init.svc.zygote=restarting exec u:r:su:s0 root root -- {MAGISKTMP}/magisk --auto-selinux --zygote-restart @@ -80,6 +80,15 @@ on property:init.svc.zygote=stopped run(["chmod", "+x", n_path]) shutil.copyfile(self.dl_file_name, os.path.join(self.magisk_dir,"magisk.apk") ) + # Bootless setup copies this stub into Magisk's runtime directory. At + # post-fs-data the daemon reads its trusted manager certificate from + # the stub's APK signature. Use the stub from the same APK as the + # manager so the daemon can authenticate the app when it first opens. + shutil.copyfile( + os.path.join(self.extract_to, "assets", "stub.apk"), + os.path.join(self.magisk_dir, "stub.apk"), + ) + # Updating Magisk from Magisk manager will modify bootanim.rc, # So it is necessary to backup the original bootanim.rc. bootanim_path = os.path.join(self.copy_dir, "system", "etc", "init", "bootanim.rc")