[Magisk] bnsmb:
Hi

I found another solution that seems to work (at least in my tests until now ....):

- unpack the necessary scripts and executables from the magisk app to a temporary directory

- install Magisk into the boot partition using these scripts and executables

- create the directory /data/adb/magisk and copy the scripts and executables to that directory

and correct the SELinux context for the files in /data/adb/magisk:

echo "Copying the Magisk binaries from \"${MAGISK_BIN_DIR}\" to \"${DEFAULT_MAGISK_BIN_DIR}\" ..."
adb ${ADB_OPTIONS} shell "mkdir -p ${DEFAULT_MAGISK_BIN_DIR} &&
chmod 755 ${DEFAULT_MAGISK_BIN_DIR} &&
cp -af ${MAGISK_BIN_DIR}/* ${DEFAULT_MAGISK_BIN_DIR} &&
chcon -v r:magisk_file:s0 ${DEFAULT_MAGISK_BIN_DIR} &&
chcon -v u:object_r:magisk_file:s0 ${DEFAULT_MAGISK_BIN_DIR}/*"
if [ $? -ne 0 ] ; then

MAGISK_BIN_DIR is the temporary directory and DEFAULT_MAGISK_BIN_DIR is /data/adb/magisk.

- reboot the phone

That works , example :

After installing Magisk into the boot partition using my script but before rebooting:

ASUS_I006D:/ # ls -ldZ $( find /data/adb )
drwxrwxrwx 3 root root u:object_r:system_data_root_file:s0 3452 2022-10-27 07:05 /data/adb
drwxr-xr-x 2 root root r:magisk_file:s0 3452 2022-10-27 07:05 /data/adb/magisk
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 3530 2022-10-27 07:05 /data/adb/magisk/addon.d.sh
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 5987 2022-10-27 07:05 /data/adb/magisk/boot_patch.sh
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 2107848 2022-10-27 07:05 /data/adb/magisk/busybox
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 548140 2022-10-27 07:05 /data/adb/magisk/futility
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 42025472 2022-10-27 07:05 /data/adb/magisk/kernel
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 1208 2022-10-27 07:05 /data/adb/magisk/kernel.keyblock
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 1199 2022-10-27 07:05 /data/adb/magisk/kernel_data_key.vbprivk
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 247168 2022-10-27 07:05 /data/adb/magisk/magisk64
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 631848 2022-10-27 07:05 /data/adb/magisk/magiskboot
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 479592 2022-10-27 07:05 /data/adb/magisk/magiskinit
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 328240 2022-10-27 07:05 /data/adb/magisk/magiskpolicy
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 86425560 2022-10-27 07:05 /data/adb/magisk/ramdisk.cpio
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 100663296 2022-10-27 07:05 /data/adb/magisk/stock_boot.img
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 23888 2022-10-27 07:05 /data/adb/magisk/util_functions.sh
ASUS_I006D:/ #

After the reboot:

ASUS_I006D:/ # ls -ldZ $( find /data/adb )
drwx------ 6 root root u:object_r:adb_data_file:s0 3452 1970-02-01 01:36 /data/adb
drwxr-xr-x 2 root root u:object_r:magisk_file:s0 3452 2022-10-27 09:44 /data/adb/magisk
-rw------- 1 root root u:object_r:adb_data_file:s0 40960 2022-10-27 09:44 /data/adb/magisk.db
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 3530 2022-10-27 09:33 /data/adb/magisk/addon.d.sh
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 5987 2022-10-27 09:33 /data/adb/magisk/boot_patch.sh
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 2107848 2022-10-27 09:33 /data/adb/magisk/busybox
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 548140 2022-10-27 09:33 /data/adb/magisk/futility
-rw-r--r-- 1 root root u:object_r:magisk_file:s0 42025472 2022-10-27 09:33 /data/adb/magisk/kernel
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 1208 2022-10-27 09:33 /data/adb/magisk/kernel.keyblock
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 1199 2022-10-27 09:33 /data/adb/magisk/kernel_data_key.vbprivk
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 247168 2022-10-27 09:33 /data/adb/magisk/magisk64
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 631848 2022-10-27 09:33 /data/adb/magisk/magiskboot
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 479592 2022-10-27 09:33 /data/adb/magisk/magiskinit
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 328240 2022-10-27 09:33 /data/adb/magisk/magiskpolicy
-rw-r--r-- 1 root root u:object_r:magisk_file:s0 86425560 2022-10-27 09:33 /data/adb/magisk/ramdisk.cpio
-rwxr-xr-x 1 root root u:object_r:magisk_file:s0 23888 2022-10-27 09:33 /data/adb/magisk/util_functions.sh
drwxr-xr-x 2 root root u:object_r:system_file:s0 3452 1970-02-01 01:36 /data/adb/modules
drwxr-xr-x 2 root root u:object_r:adb_data_file:s0 3452 1970-02-01 01:36 /data/adb/post-fs-data.d
drwxr-xr-x 2 root root u:object_r:adb_data_file:s0 3452 1970-02-01 01:36 /data/adb/service.d
ASUS_I006D:/ #

Magisk works and the Magisk App is also happy again

Bernd