Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magisk support #207

Closed
assiless opened this issue Aug 3, 2022 · 50 comments
Closed

Magisk support #207

assiless opened this issue Aug 3, 2022 · 50 comments

Comments

@assiless
Copy link

assiless commented Aug 3, 2022

see this

@zhouziyang
Copy link
Member

several guys requested the Magisk support. And I will look into this feature request. Stay tune~~

BTW, SELinux is ignored in redroid; thus the policy related ops are not needed here.

@zhouziyang zhouziyang self-assigned this Aug 4, 2022
@zhouziyang zhouziyang added the enhancement New feature or request label Aug 4, 2022
@zhouziyang zhouziyang changed the title my attempt integrating magisk Magisk support Aug 8, 2022
@zhouziyang
Copy link
Member

zhouziyang commented Aug 8, 2022

image

## manually get a working Magisk on redroid12
## kind busy these days. will add magisk support in redroid building process later.

# add /sbin
/sbin/
├── magisk
└── stub.apk

# add busybox
/data/adb/
├── magisk
│   └── busybox

# add su (override `/system/xbin/su`)
/product/bin/
└── su -> /sbin/magisk

# add init.rc
cat /vendor/etc/init/redroid.magisk.rc
service magisk-d /sbin/magisk --daemon
    user root
    oneshot

on boot
    start magisk-d

on post-fs-data
    start logd
    rm /dev/.magisk-unblock
    start s1
    wait /dev/.magisk-unblock 5
    rm /dev/.magisk-unblock

service s1 /sbin/magisk --post-fs-data
    user root
    oneshot

service s2 /sbin/magisk --service
    class late_start
    user root
    oneshot

on property:sys.boot_completed=1
    exec /sbin/magisk --boot-complete

on property:init.svc.zygote=restarting
    exec /sbin/magisk --zygote-restart

on property:init.svc.zygote=stopped
    exec /sbin/magisk --zygote-restart

This was referenced Aug 8, 2022
@zhouziyang
Copy link
Member

This is a quick setup (possible not elegant, try refine by yourself)

please i need some info

#add /sbin

do find /sbin -exec ls -dlh {} \;
many busybox symlinks under .magisk directory (magisk automatically setup). ignored here

#add busybox

do find /data/adb -exec ls -dlh {} \;

drwx------ 6 root root 4.0K 2022-08-08 03:42 /data/adb
drwxr-xr-x 2 root root 4.0K 2022-08-05 12:16 /data/adb/service.d
-rw------- 1 root root 40K 2022-08-05 12:16 /data/adb/magisk.db
drwxr-xr-x 2 root root 4.0K 2022-08-05 12:16 /data/adb/modules
drwxr-xr-x 2 root root 4.0K 2022-08-05 12:16 /data/adb/post-fs-data.d
drwxr-xr-x 2 root root 4.0K 2022-08-08 03:37 /data/adb/magisk
-rwxr-xr-x 1 root root 2.0M 2022-08-08 03:37 /data/adb/magisk/busybox

#add su (override /system/xbin/su)

do ls -lh /system/xbin/su do which su
/product/bin/su

#add init.rc

do ls -lh /vendor/etc/init/redroid.magisk.rc do cat /vendor/etc/init/redroid.magisk.rc
already pasted above

@zhouziyang
Copy link
Member

you can add stub.apk in docker image (will be there after each launch, and get removed after boot).

@zhouziyang
Copy link
Member

I use locally build magisk (open some debug logs).

check logcat --pid <pid of magiskd>
check logcat --pid <pid of magisk-app>

# enable magisk app shell verbose logs

diff --git a/app/src/main/java/com/topjohnwu/magisk/core/App.kt b/app/src/main/java/com/topjohnwu/magisk/core/App.kt
index 1c300b7c5..18ce93f1e 100644
--- a/app/src/main/java/com/topjohnwu/magisk/core/App.kt
+++ b/app/src/main/java/com/topjohnwu/magisk/core/App.kt
@@ -54,6 +54,7 @@ open class App() : Application() {
         ServiceLocator.context = base
         app.registerActivityLifecycleCallbacks(ActivityTracker)

+        Shell.enableVerboseLogging = true;
         Shell.setDefaultBuilder(Shell.Builder.create()
             .setFlags(Shell.FLAG_MOUNT_MASTER)
             .setInitializers(ShellInit::class.java)

@zhouziyang
Copy link
Member

try with adb shell; adb connect ... then adb -s xxx shell

@zhouziyang
Copy link
Member

adbd help to setup some environment variables (check /init.envrion.rc), while docker exec ... not.

@zhouziyang
Copy link
Member

you can create (mkdir) by your own.

@zhouziyang
Copy link
Member

I'm not provide you the complete solution to integrate Magisk here. Just a working PoC here. hopefully, you can follow this guide to enhance this solution.

For Magisk initial setup, possible to add a magisk-setup.rc and copy blobs to the desired folders.

redroid is very easy to customize, have fun~~

@assiless
Copy link
Author

Screenshot from 2022-08-11 23-11-42

@zhouziyang
Copy link
Member

close since resolved.

@809509941
Copy link

Note: these steps is similar to MagiskOnWSA

setup variables for commands

echo -e '\n
export image=redroid/redroid:11.0.0-amd64
export image_tar=redroid11amd64.tar' >> ${HOME}/.bashrc
source ${HOME}/.bashrc

download the clean image and make backup in ${HOME}/$image_tar

sudo docker pull $image
sudo docker save --output $image_tar $image

download required dependency

sudo apt-get update
sudo apt-get install patchelf

setting up

mkdir "${HOME}"/MagiskOnRedroid

config.json
file to download magisk

wget -qO- "https://github.com/LSPosed/MagiskOnWSA/archive/main.tar.gz" | sudo tar --wildcards -zxvf- -C ~ --strip-component=2 '*/linker/*'
python3 "${HOME}/MagiskOnRedroid/002Download Magisk.py"
sudo patchelf --replace-needed libc.so "${HOME}/libc.so" ./magiskpolicy || true
sudo patchelf --replace-needed libm.so "${HOME}/libm.so" ./magiskpolicy || true
sudo patchelf --replace-needed libdl.so "${HOME}/libdl.so" ./magiskpolicy || true
sudo patchelf --set-interpreter "${HOME}/linker64" ./magiskpolicy || true
chmod +x ./magiskpolicy

setting up END

integrate magisk

get where filesystem stored
seting up required folder&mount
integrate magisk
unmount

integrate magisk END

runit

runit
clear ; sudo docker exec -it a11 sh -c 'top -k PID -Hb'
clear; sudo docker exec -it a11 sh -c "logcat"

thought

it seem that the FAhW7H9G5sf service where to break

service FAhW7H9G5sf /dev/redroid-magisk/magisk --post-fs-data
  user root
  seclabel u:r:magisk:s0
  oneshot

i don't know what's going here

if i change it to this for exemple

service FAhW7H9G5sf /dev/redroid-magisk/magisk
  user root
  seclabel u:r:magisk:s0
  oneshot

android will boot but magisk not install even if you do sudo docker exec -it a11 sh -c "pm install /data/adb/magisk/magisk.apk the app will not recognize root

i'm posting this to you know how init.rc work

Can you come up with a method about the magisk.

@assiless
Copy link
Author

Can you come up with a method about the magisk.

MagiskOnRedroid

@XiaoYeah6
Copy link

Thanks for your method. But when I ran the command: "~/download-frozen-image-v2.sh "$image_tar" redroid/redroid:9.0.0-arm64", it showed: "error: "jq" not found!".
Could you please tell my how to resolve it?

@assiless
Copy link
Author

you can pull original image with docker pull

sudo docker pull redroid/redroid:x.x.x-xx # this actually download and install
sudo docker save --output redroidBak.tar redroid/redroid:x.x.x-xx

on backup use docker load

sudo docker load -i redroidBak.tar

@XiaoYeah6
Copy link

XiaoYeah6 commented Aug 27, 2022

OK. Thank you very much!
And then is the command "tar -cC "$image_tar" . | sudo docker load" should change to "tar -cC "redroidBak.tar" . | sudo docker load" ?
I think the folder has not the file: redroid:x.x.x-xx, and there are no command to get it.
Or it should change to other command, becase it will show Error if I input the command.

@assiless
Copy link
Author

update MagiskOnRedroid

redroid:x.x.x-xx

and do not just copy past , change what matter

@XiaoYeah6
Copy link

Thank you very much!

@zenzen52000
Copy link

请问是否有自带Magisk的镜像?

@zhouziyang
Copy link
Member

Just a POC here, not fully get Magisk supported.

@ayasa520
Copy link

image
image

Full magisk support (including zygisk) is available if using magisk delta.

I'm adapting waydroid_script(https://github.com/ayasa520/waydroid_script/blob/1.3/waydroid_extras.py#L447-L549) into a script for redroid

@ayasa520
Copy link

If anyone is interested in installing magisk delta on redroid, please check out https://github.com/ayasa520/redroid-script.

@Darkglassd3v
Copy link

Darkglassd3v commented Jan 20, 2023

 cat  /system/etc/init/bootanim.rc

service bootanim /system/bin/bootanimation
    class core animation
    user graphics
    group graphics audio
    disabled
    oneshot
    ioprio rt 0
    task_profiles MaxPerformance


on post-fs-data
    start logd
    exec u:r:su:s0 root root -- /system/etc/init/magisk/magisk64 --auto-selinux --setup-sbin /system/etc/init/magisk
    exec u:r:su:s0 root root -- /system/etc/init/magisk/magiskpolicy --live --magisk "allow * magisk_file lnk_file *"
    mkdir /sbin/.magisk 700
    mkdir /sbin/.magisk/mirror 700
    mkdir /sbin/.magisk/block 700
    copy /system/etc/init/magisk/config /sbin/.magisk/config
    rm /dev/.magisk_unblock
    start 7zKkuZ1ZhD
    wait /dev/.magisk_unblock 40
    rm /dev/.magisk_unblock

service 7zKkuZ1ZhD /sbin/magisk --auto-selinux --post-fs-data
    user root
    seclabel u:r:su:s0
    oneshot

service wHgGlkRCtMoIQw /sbin/magisk --auto-selinux --service
    class late_start
    user root
    seclabel u:r:su:s0
    oneshot

on property:sys.boot_completed=1
    mkdir /data/adb/magisk 755
    exec u:r:su:s0 root root -- /sbin/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"

on property:init.svc.zygote=restarting
    exec u:r:su:s0 root root -- /sbin/magisk --auto-selinux --zygote-restart

on property:init.svc.zygote=stopped
    exec u:r:su:s0 root root -- /sbin/magisk --auto-selinux --zygote-restart

but /sbin/ is empty

 cd /system/etc/init/magisk/
f95dde3494ef:/system/etc/init/magisk # ls -la
total 15324
drwxrwxr-x 2 root root     4096 2023-01-19 13:35 .
drwxrwxr-x 1 root root     4096 2023-01-19 13:35 ..
-rwxrwxr-x 1 root root  2265688 2023-01-19 15:22 busybox
-rw-rw-r-- 1 root root 11456564 2023-01-19 15:22 magisk.apk
-rwxrwxr-x 1 root root   313104 2023-01-19 15:22 magisk64
-rwxrwxr-x 1 root root   730656 2023-01-19 15:22 magiskboot
-rwxrwxr-x 1 root root   534624 2023-01-19 15:22 magiskinit
-rwxrwxr-x 1 root root   366168 2023-01-19 15:22 magiskpolicy

it's like If on post-fs-data are not being executed after boot

@Darkglassd3v
Copy link

Magisk wasn't installed, seems that i compiled right as size changed differently from redroid-12.0.0

redroid/redroid                                    12.0.0-latest         171e80b17d37   4 months ago        1.95GB
redroid/redroid                                    12.0.0-magisk         6c099cf5d811   About an hour ago   1.97GB

Started with
docker run -itd --privileged -v /home/user/redroid__magisk:/data -p 5555:5555 redroid/redroid:12.0.0-magisk

1|40e06be5bbbf:/ # logcat | grep magisk

empty log

Check if /sbin/magisk* and /system/etc/init/magisk exist, and if /system/etc/init/bootanim.rc contains https://github.com/ayasa520/redroid-script/blob/main/stuffs/magisk.py#L28-L53.

I think they are not being copied to the correct place

tried both with redroid-11, redroid-12, redroid-13 with no success, still /sbin/ empty

@Darkglassd3v
Copy link

nvm i gived root access to my app in another way

@tkkcc
Copy link

tkkcc commented Mar 17, 2023

@federicocossetta can you share your method

@baohavan
Copy link

baohavan commented Mar 31, 2023

Magisk wasn't installed, seems that i compiled right as size changed differently from redroid-12.0.0

redroid/redroid                                    12.0.0-latest         171e80b17d37   4 months ago        1.95GB
redroid/redroid                                    12.0.0-magisk         6c099cf5d811   About an hour ago   1.97GB

Started with
docker run -itd --privileged -v /home/user/redroid__magisk:/data -p 5555:5555 redroid/redroid:12.0.0-magisk

1|40e06be5bbbf:/ # logcat | grep magisk

empty log

Check if /sbin/magisk* and /system/etc/init/magisk exist, and if /system/etc/init/bootanim.rc contains https://github.com/ayasa520/redroid-script/blob/main/stuffs/magisk.py#L28-L53.
I think they are not being copied to the correct place

tried both with redroid-11, redroid-12, redroid-13 with no success, still /sbin/ empty

[9419311.477662] init: Unable to read config file '/system/etc/init/bootanim.rc': Skipping insecure file

It's can't run due to chmod value current is 664, android init only allow chmod value 644, you can apply this patch to ayasa520 script

diff --git a/stuffs/magisk.py b/stuffs/magisk.py
index 34a7d7c..073f818 100644
--- a/stuffs/magisk.py
+++ b/stuffs/magisk.py
@@ -32,7 +32,7 @@ on post-fs-data
     mkdir /sbin/.magisk 700
     mkdir /sbin/.magisk/mirror 700
     mkdir /sbin/.magisk/block 700
-    copy /system/etc/init/magisk/config /sbin/.magisk/config
+    touch /sbin/.magisk/config
     rm /dev/.magisk_unblock
     exec u:r:su:s0 root root -- /sbin/magisk --auto-selinux --post-fs-data
     wait /dev/.magisk_unblock 40
@@ -86,8 +86,10 @@ on property:init.svc.zygote=stopped
         gz_filename = os.path.join(bootanim_path)+".gz"
         with gzip.open(gz_filename,'wb') as f_gz:
             f_gz.write(self.oringinal_bootanim.encode('utf-8'))
+        run(["chmod", "644", gz_filename])
         with open(bootanim_path, "w") as initfile:
             initfile.write(self.oringinal_bootanim+self.bootanim_component)
+        run(["chmod", "644", bootanim_path])

@ilaipi
Copy link

ilaipi commented Jul 5, 2023

I had to install manually Magisk delta downloading from here. Wasn't installed

What is the output of adb logcat | grep magisk

adb logcat | grep magisk
07-04 13:44:43.857     0     0 I init    : starting service 'exec 163 (/sbin/magisk --auto-selinux --zygote-restart)'...
07-04 13:44:43.860     0     0 I init    : SVC_EXEC service 'exec 163 (/sbin/magisk --auto-selinux --zygote-restart)' pid 4944 (uid 0 gid 0+0 context u:r:su:s0) started; waiting...
07-04 13:44:43.874     0     0 I init    : Service 'exec 163 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 4944) exited with status 0 waiting took 0.014000 seconds
07-04 13:44:43.874     0     0 I init    : Sending signal 9 to service 'exec 163 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 4944) process group...
07-04 13:44:48.805     0     0 I init    : starting service 'exec 165 (/sbin/magisk --auto-selinux --zygote-restart)'...
07-04 13:44:48.809     0     0 I init    : SVC_EXEC service 'exec 165 (/sbin/magisk --auto-selinux --zygote-restart)' pid 5010 (uid 0 gid 0+0 context u:r:su:s0) started; waiting...
07-04 13:44:48.819     0     0 I init    : Service 'exec 165 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5010) exited with status 0 waiting took 0.011000 seconds
07-04 13:44:48.819     0     0 I init    : Sending signal 9 to service 'exec 165 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5010) process group...
07-04 13:44:53.778     0     0 I init    : starting service 'exec 167 (/sbin/magisk --auto-selinux --zygote-restart)'...
07-04 13:44:53.780     0     0 I init    : SVC_EXEC service 'exec 167 (/sbin/magisk --auto-selinux --zygote-restart)' pid 5076 (uid 0 gid 0+0 context u:r:su:s0) started; waiting...
07-04 13:44:53.792     0     0 I init    : Service 'exec 167 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5076) exited with status 0 waiting took 0.012000 seconds
07-04 13:44:53.792     0     0 I init    : Sending signal 9 to service 'exec 167 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5076) process group...
07-04 13:44:58.816     0     0 I init    : starting service 'exec 169 (/sbin/magisk --auto-selinux --zygote-restart)'...
07-04 13:44:58.818     0     0 I init    : SVC_EXEC service 'exec 169 (/sbin/magisk --auto-selinux --zygote-restart)' pid 5142 (uid 0 gid 0+0 context u:r:su:s0) started; waiting...
07-04 13:44:58.831     0     0 I init    : Service 'exec 169 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5142) exited with status 0 waiting took 0.013000 seconds
07-04 13:44:58.831     0     0 I init    : Sending signal 9 to service 'exec 169 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5142) process group...
07-04 13:45:03.780     0     0 I init    : starting service 'exec 171 (/sbin/magisk --auto-selinux --zygote-restart)'...
07-04 13:45:03.781     0     0 I init    : SVC_EXEC service 'exec 171 (/sbin/magisk --auto-selinux --zygote-restart)' pid 5209 (uid 0 gid 0+0 context u:r:su:s0) started; waiting...
07-04 13:45:03.792     0     0 I init    : Service 'exec 171 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5209) exited with status 0 waiting took 0.011000 seconds
07-04 13:45:03.792     0     0 I init    : Sending signal 9 to service 'exec 171 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5209) process group...
07-04 13:45:08.878     0     0 I init    : starting service 'exec 173 (/sbin/magisk --auto-selinux --zygote-restart)'...
07-04 13:45:08.880     0     0 I init    : SVC_EXEC service 'exec 173 (/sbin/magisk --auto-selinux --zygote-restart)' pid 5275 (uid 0 gid 0+0 context u:r:su:s0) started; waiting...
07-04 13:45:08.894     0     0 I init    : Service 'exec 173 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5275) exited with status 0 waiting took 0.014000 seconds
07-04 13:45:08.894     0     0 I init    : Sending signal 9 to service 'exec 173 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5275) process group...
07-04 13:45:13.877     0     0 I init    : starting service 'exec 175 (/sbin/magisk --auto-selinux --zygote-restart)'...
07-04 13:45:13.878     0     0 I init    : SVC_EXEC service 'exec 175 (/sbin/magisk --auto-selinux --zygote-restart)' pid 5342 (uid 0 gid 0+0 context u:r:su:s0) started; waiting...
07-04 13:45:13.889     0     0 I init    : Service 'exec 175 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5342) exited with status 0 waiting took 0.011000 seconds
07-04 13:45:13.889     0     0 I init    : Sending signal 9 to service 'exec 175 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5342) process group...
07-04 13:45:18.885     0     0 I init    : starting service 'exec 177 (/sbin/magisk --auto-selinux --zygote-restart)'...
07-04 13:45:18.890     0     0 I init    : SVC_EXEC service 'exec 177 (/sbin/magisk --auto-selinux --zygote-restart)' pid 5410 (uid 0 gid 0+0 context u:r:su:s0) started; waiting...
07-04 13:45:18.902     0     0 I init    : Service 'exec 177 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5410) exited with status 0 waiting took 0.013000 seconds
07-04 13:45:18.902     0     0 I init    : Sending signal 9 to service 'exec 177 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5410) process group...
07-04 13:45:23.880     0     0 I init    : starting service 'exec 179 (/sbin/magisk --auto-selinux --zygote-restart)'...
07-04 13:45:23.884     0     0 I init    : SVC_EXEC service 'exec 179 (/sbin/magisk --auto-selinux --zygote-restart)' pid 5476 (uid 0 gid 0+0 context u:r:su:s0) started; waiting...
07-04 13:45:23.896     0     0 I init    : Service 'exec 179 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5476) exited with status 0 waiting took 0.013000 seconds
07-04 13:45:23.896     0     0 I init    : Sending signal 9 to service 'exec 179 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5476) process group...
07-04 13:45:28.935     0     0 I init    : starting service 'exec 181 (/sbin/magisk --auto-selinux --zygote-restart)'...
07-04 13:45:28.937     0     0 I init    : SVC_EXEC service 'exec 181 (/sbin/magisk --auto-selinux --zygote-restart)' pid 5541 (uid 0 gid 0+0 context u:r:su:s0) started; waiting...
07-04 13:45:28.948     0     0 I init    : Service 'exec 181 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5541) exited with status 0 waiting took 0.011000 seconds
07-04 13:45:28.948     0     0 I init    : Sending signal 9 to service 'exec 181 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5541) process group...
07-04 13:45:33.815     0     0 I init    : starting service 'exec 183 (/sbin/magisk --auto-selinux --zygote-restart)'...
07-04 13:45:33.816     0     0 I init    : SVC_EXEC service 'exec 183 (/sbin/magisk --auto-selinux --zygote-restart)' pid 5602 (uid 0 gid 0+0 context u:r:su:s0) started; waiting...
07-04 13:45:33.827     0     0 I init    : Service 'exec 183 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5602) exited with status 0 waiting took 0.011000 seconds
07-04 13:45:33.827     0     0 I init    : Sending signal 9 to service 'exec 183 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5602) process group...
07-04 13:45:38.924     0     0 I init    : starting service 'exec 185 (/sbin/magisk --auto-selinux --zygote-restart)'...
07-04 13:45:38.926     0     0 I init    : SVC_EXEC service 'exec 185 (/sbin/magisk --auto-selinux --zygote-restart)' pid 5669 (uid 0 gid 0+0 context u:r:su:s0) started; waiting...
07-04 13:45:38.939     0     0 I init    : Service 'exec 185 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5669) exited with status 0 waiting took 0.013000 seconds
07-04 13:45:38.939     0     0 I init    : Sending signal 9 to service 'exec 185 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5669) process group...
07-04 13:45:43.973     0     0 I init    : starting service 'exec 187 (/sbin/magisk --auto-selinux --zygote-restart)'...
07-04 13:45:43.977     0     0 I init    : SVC_EXEC service 'exec 187 (/sbin/magisk --auto-selinux --zygote-restart)' pid 5736 (uid 0 gid 0+0 context u:r:su:s0) started; waiting...
07-04 13:45:43.989     0     0 I init    : Service 'exec 187 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5736) exited with status 0 waiting took 0.014000 seconds
07-04 13:45:43.989     0     0 I init    : Sending signal 9 to service 'exec 187 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5736) process group...
07-04 13:45:49.010     0     0 I init    : starting service 'exec 189 (/sbin/magisk --auto-selinux --zygote-restart)'...
07-04 13:45:49.012     0     0 I init    : SVC_EXEC service 'exec 189 (/sbin/magisk --auto-selinux --zygote-restart)' pid 5803 (uid 0 gid 0+0 context u:r:su:s0) started; waiting...
07-04 13:45:49.026     0     0 I init    : Service 'exec 189 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5803) exited with status 0 waiting took 0.014000 seconds
07-04 13:45:49.026     0     0 I init    : Sending signal 9 to service 'exec 189 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5803) process group...
07-04 13:45:54.043     0     0 I init    : starting service 'exec 191 (/sbin/magisk --auto-selinux --zygote-restart)'...
07-04 13:45:54.048     0     0 I init    : SVC_EXEC service 'exec 191 (/sbin/magisk --auto-selinux --zygote-restart)' pid 5870 (uid 0 gid 0+0 context u:r:su:s0) started; waiting...
07-04 13:45:54.060     0     0 I init    : Service 'exec 191 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5870) exited with status 0 waiting took 0.014000 seconds
07-04 13:45:54.060     0     0 I init    : Sending signal 9 to service 'exec 191 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5870) process group...
07-04 13:45:58.874     0     0 I init    : starting service 'exec 193 (/sbin/magisk --auto-selinux --zygote-restart)'...
07-04 13:45:58.876     0     0 I init    : SVC_EXEC service 'exec 193 (/sbin/magisk --auto-selinux --zygote-restart)' pid 5936 (uid 0 gid 0+0 context u:r:su:s0) started; waiting...
07-04 13:45:58.886     0     0 I init    : Service 'exec 193 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5936) exited with status 0 waiting took 0.010000 seconds
07-04 13:45:58.886     0     0 I init    : Sending signal 9 to service 'exec 193 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 5936) process group...
07-04 13:46:03.977     0     0 I init    : starting service 'exec 195 (/sbin/magisk --auto-selinux --zygote-restart)'...
07-04 13:46:03.979     0     0 I init    : SVC_EXEC service 'exec 195 (/sbin/magisk --auto-selinux --zygote-restart)' pid 6002 (uid 0 gid 0+0 context u:r:su:s0) started; waiting...
07-04 13:46:03.992     0     0 I init    : Service 'exec 195 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 6002) exited with status 0 waiting took 0.013000 seconds
07-04 13:46:03.992     0     0 I init    : Sending signal 9 to service 'exec 195 (/sbin/magisk --auto-selinux --zygote-restart)' (pid 6002) process group...
07-05 03:47:04.559    66    68 W Magisk  : pkg: cannot find io.github.huskydg.magisk for user=[0]
07-05 03:47:10.528   327   832 I ActivityManager:   ntv   ??    1893: magiskd (pid 66) native
07-05 03:47:12.027    66    68 W Magisk  : pkg: cannot find io.github.huskydg.magisk for user=[0]
07-05 03:47:13.586   327   434 I PackageDexOptimizer: Running dexopt (dexoptNeeded=1) on: /data/app/~~9wmoM_p0FTZrhd_OQSO8gA==/io.github.huskydg.magisk-y7jREcON1ZfU5gokCvsnJQ==/base.apk pkg=io.github.huskydg.magisk isa=arm dexoptFlags=boot_complete,profile_guided,public,enable_hidden_api_checks targetFilter=speed-profile oatDir=/data/app/~~9wmoM_p0FTZrhd_OQSO8gA==/io.github.huskydg.magisk-y7jREcON1ZfU5gokCvsnJQ==/oat classLoaderContext=PCL[]{}
07-05 03:47:13.587   141   389 V installd: DexInv: --- BEGIN '/data/app/~~9wmoM_p0FTZrhd_OQSO8gA==/io.github.huskydg.magisk-y7jREcON1ZfU5gokCvsnJQ==/base.apk' ---
07-05 03:47:13.587   141   389 V installd: Running /apex/com.android.art/bin/dex2oat32 in=base.apk out=/data/app/~~9wmoM_p0FTZrhd_OQSO8gA==/io.github.huskydg.magisk-y7jREcON1ZfU5gokCvsnJQ==/oat/arm/base.odex
07-05 03:47:13.635  1633  1633 I dex2oat32: /apex/com.android.art/bin/dex2oat32 --input-vdex-fd=-1 --output-vdex-fd=8 --classpath-dir=/data/app/~~9wmoM_p0FTZrhd_OQSO8gA==/io.github.huskydg.magisk-y7jREcON1ZfU5gokCvsnJQ== --class-loader-context=PCL[]{} --compact-dex-level=none --compiler-filter=speed-profile --compilation-reason=install --max-image-block-size=524288 --resolve-startup-const-strings=true --generate-mini-debug-info
07-05 03:47:13.953   141   389 V installd: DexInv: --- END '/data/app/~~9wmoM_p0FTZrhd_OQSO8gA==/io.github.huskydg.magisk-y7jREcON1ZfU5gokCvsnJQ==/base.apk' (success) ---
07-05 03:47:13.965   327   434 I PackageDexOptimizer: Running dexopt (dexoptNeeded=1) on: /data/app/~~9wmoM_p0FTZrhd_OQSO8gA==/io.github.huskydg.magisk-y7jREcON1ZfU5gokCvsnJQ==/base.apk pkg=io.github.huskydg.magisk isa=arm64 dexoptFlags=boot_complete,profile_guided,public,enable_hidden_api_checks targetFilter=speed-profile oatDir=/data/app/~~9wmoM_p0FTZrhd_OQSO8gA==/io.github.huskydg.magisk-y7jREcON1ZfU5gokCvsnJQ==/oat classLoaderContext=PCL[]{}
07-05 03:47:13.965   141   389 V installd: DexInv: --- BEGIN '/data/app/~~9wmoM_p0FTZrhd_OQSO8gA==/io.github.huskydg.magisk-y7jREcON1ZfU5gokCvsnJQ==/base.apk' ---
07-05 03:47:13.965   141   389 V installd: Running /apex/com.android.art/bin/dex2oat32 in=base.apk out=/data/app/~~9wmoM_p0FTZrhd_OQSO8gA==/io.github.huskydg.magisk-y7jREcON1ZfU5gokCvsnJQ==/oat/arm64/base.odex
07-05 03:47:13.986  1713  1713 I dex2oat32: /apex/com.android.art/bin/dex2oat32 --input-vdex-fd=-1 --output-vdex-fd=8 --classpath-dir=/data/app/~~9wmoM_p0FTZrhd_OQSO8gA==/io.github.huskydg.magisk-y7jREcON1ZfU5gokCvsnJQ== --class-loader-context=PCL[]{} --compact-dex-level=none --compiler-filter=speed-profile --compilation-reason=install --max-image-block-size=524288 --resolve-startup-const-strings=true --generate-mini-debug-info
07-05 03:47:14.276   141   389 V installd: DexInv: --- END '/data/app/~~9wmoM_p0FTZrhd_OQSO8gA==/io.github.huskydg.magisk-y7jREcON1ZfU5gokCvsnJQ==/base.apk' (success) ---
07-05 03:47:14.290   327   434 V BackupManagerService: [UserID:0] restoreAtInstall pkg=io.github.huskydg.magisk token=1 restoreSet=0
07-05 03:47:14.324   592   592 D MediaPlayerList: Name of package changed: io.github.huskydg.magisk
07-05 03:47:14.329  1247  1247 I MediaProvider: Invalidating LocalCallingIdentity cache for package io.github.huskydg.magisk. Reason: package android.intent.action.PACKAGE_ADDED
07-05 03:47:14.682   327   725 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:io.github.huskydg.magisk flg=0x4000010 (has extras) } to com.android.packageinstaller/.PackageInstalledReceiver
07-05 03:47:14.682   327   416 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:io.github.huskydg.magisk flg=0x4000010 (has extras) } to com.android.gallery3d/.app.PackagesMonitor
07-05 03:47:36.630   327  2093 I ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=io.github.huskydg.magisk/com.topjohnwu.magisk.ui.MainActivity bnds=[193,423][360,642]} from uid 10060
07-05 03:47:36.663   607   720 D StartingSurfaceDrawer: addSplashScreen io.github.huskydg.magisk theme=7f1401a5 task=11 suggestType=1
07-05 03:47:36.688   327   417 I ActivityManager: Start proc 2136:io.github.huskydg.magisk/u0a70 for pre-top-activity {io.github.huskydg.magisk/com.topjohnwu.magisk.ui.MainActivity}
07-05 03:47:36.733  2136  2136 V GraphicsEnvironment: ANGLE Developer option for 'io.github.huskydg.magisk' set to: 'default'
07-05 03:47:36.733  2136  2136 V GraphicsEnvironment: ANGLE GameManagerService for io.github.huskydg.magisk: false
07-05 03:47:36.845  2136  2166 D vulkan  : searching for layers in '/data/app/~~9wmoM_p0FTZrhd_OQSO8gA==/io.github.huskydg.magisk-y7jREcON1ZfU5gokCvsnJQ==/lib/arm64'
07-05 03:47:36.845  2136  2166 D vulkan  : searching for layers in '/data/app/~~9wmoM_p0FTZrhd_OQSO8gA==/io.github.huskydg.magisk-y7jREcON1ZfU5gokCvsnJQ==/base.apk!/lib/arm64-v8a'
07-05 03:47:36.916  2192  2192 W io.github.huskydg.magisk:root:0: ART APEX data files are untrusted.
07-05 03:47:36.916  2192  2192 I io.github.huskydg.magisk:root:0: Core platform API reporting enabled, enforcing=false
07-05 03:47:36.987  2192  2192 D io.github.huskydg.magisk:root:0: Time zone APEX ICU file found: /apex/com.android.tzdata/etc/icu/icu_tzdata.dat
07-05 03:47:36.988  2192  2192 D io.github.huskydg.magisk:root:0: I18n APEX ICU file found: /apex/com.android.i18n/etc/icu/icudt68l.dat
07-05 03:47:37.351   102   102 E CompositionEngine: [Splash Screen io.github.huskydg.magisk#0] Invalid device requested composition type change: CLIENT (1) --> DEVICE (2)
07-05 03:47:37.527   102   102 E CompositionEngine: [Splash Screen io.github.huskydg.magisk#0] Invalid device requested composition type change: CLIENT (1) --> DEVICE (2)
07-05 03:47:39.165   327   407 I ActivityTaskManager: Displayed io.github.huskydg.magisk/com.topjohnwu.magisk.ui.MainActivity: +2s527ms
07-05 03:47:39.843   327  1718 W InputManager-JNI: Input channel object 'e8347e4 Splash Screen io.github.huskydg.magisk (client)' was disposed without first being removed with the input manager!
07-05 03:47:42.427   327   404 W InputManager-JNI: Input channel object '5e6a812 io.github.huskydg.magisk/com.topjohnwu.magisk.ui.MainActivity (client)' was disposed without first being removed with the input manager!
07-05 03:47:46.830   327   404 W NotificationService: Toast already killed. pkg=io.github.huskydg.magisk token=android.os.BinderProxy@a2b4e2a

this is my log, restarting can't to be end

@Febtw
Copy link

Febtw commented Sep 4, 2023

How can I build redroid with Magisk, when I Build redroid with docker?

@chenfang34120
Copy link

Magisk 未安装,似乎我编译正确,因为大小变化与 redroid-12.0.0 不同

redroid/redroid                                    12.0.0-latest         171e80b17d37   4 months ago        1.95GB
redroid/redroid                                    12.0.0-magisk         6c099cf5d811   About an hour ago   1.97GB

开始于
docker run -itd --privileged -v /home/user/redroid__magisk:/data -p 5555:5555 redroid/redroid:12.0.0-magisk

1|40e06be5bbbf:/ # logcat | grep magisk

空日志

检查 和 是否/sbin/magisk*存在/system/etc/init/magisk,如果/system/etc/init/bootanim.rc包含https://github.com/ayasa520/redroid-script/blob/main/stuffs/magisk.py#L28-L53。
我认为它们没有被复制到正确的位置

都尝试过,redroid-11, redroid-12, redroid-13但都没有成功,仍然/sbin/ 是空的

[9419311.477662] init:无法读取配置文件“/system/etc/init/bootanim.rc”:跳过不安全的文件

由于 chmod 值当前为 664,它无法运行,android init 只允许 chmod 值 644,您可以将此补丁应用于 ayasa520 脚本

diff --git a/stuffs/magisk.py b/stuffs/magisk.py
index 34a7d7c..073f818 100644
--- a/stuffs/magisk.py
+++ b/stuffs/magisk.py
@@ -32,7 +32,7 @@ on post-fs-data
     mkdir /sbin/.magisk 700
     mkdir /sbin/.magisk/mirror 700
     mkdir /sbin/.magisk/block 700
-    copy /system/etc/init/magisk/config /sbin/.magisk/config
+    touch /sbin/.magisk/config
     rm /dev/.magisk_unblock
     exec u:r:su:s0 root root -- /sbin/magisk --auto-selinux --post-fs-data
     wait /dev/.magisk_unblock 40
@@ -86,8 +86,10 @@ on property:init.svc.zygote=stopped
         gz_filename = os.path.join(bootanim_path)+".gz"
         with gzip.open(gz_filename,'wb') as f_gz:
             f_gz.write(self.oringinal_bootanim.encode('utf-8'))
+        run(["chmod", "644", gz_filename])
         with open(bootanim_path, "w") as initfile:
             initfile.write(self.oringinal_bootanim+self.bootanim_component)
+        run(["chmod", "644", bootanim_path])

This may seem like the most correct answer, but I don't know how to use it

@ghost
Copy link

ghost commented Dec 7, 2023

image

## manually get a working Magisk on redroid12
## kind busy these days. will add magisk support in redroid building process later.

# add /sbin
/sbin/
├── magisk
└── stub.apk

# add busybox
/data/adb/
├── magisk
│   └── busybox

# add su (override `/system/xbin/su`)
/product/bin/
└── su -> /sbin/magisk

# add init.rc
cat /vendor/etc/init/redroid.magisk.rc
service magisk-d /sbin/magisk --daemon
    user root
    oneshot

on boot
    start magisk-d

on post-fs-data
    start logd
    rm /dev/.magisk-unblock
    start s1
    wait /dev/.magisk-unblock 5
    rm /dev/.magisk-unblock

service s1 /sbin/magisk --post-fs-data
    user root
    oneshot

service s2 /sbin/magisk --service
    class late_start
    user root
    oneshot

on property:sys.boot_completed=1
    exec /sbin/magisk --boot-complete

on property:init.svc.zygote=restarting
    exec /sbin/magisk --zygote-restart

on property:init.svc.zygote=stopped
    exec /sbin/magisk --zygote-restart

Having tried MagiskOnRedroid, which depends on the solution above, on redroid:11.0.0-latest, I successfully get Magisk installed on amd64 device.

However, the Magisk version is not the latest (so several modules cannot be installed).
When I tried to change the Magisk apk used in the script to v26.4 (the currently latest), even Magisk app is not installed in Redroid.
Any help on updating Magisk version? Thanks in advance.

@abing7k
Copy link

abing7k commented Dec 9, 2023

@IndigoRCS Can you show me your running command? I failed to add the magisk。

@ghost
Copy link

ghost commented Dec 10, 2023

@abing7k I just follow this script.

@7125Dev
Copy link

7125Dev commented Dec 12, 2023

google ‘magisk delta 25206’ download it,put it on nginx server,create apk download url edit https://github.com/ayasa520/redroid-script/blob/568d9287b877e76e1a359beffe940bde586d395b/stuffs/magisk.py#L10 ,and just run script

@7125Dev
Copy link

7125Dev commented Dec 12, 2023

google ‘magisk delta 25206’ download it,put it on nginx server,create apk download url edit https://github.com/ayasa520/redroid-script/blob/568d9287b877e76e1a359beffe940bde586d395b/stuffs/magisk.py#L10 ,and just run script

https://huskydg.github.io/magisk-files/app-release.apk has failed init issues
https://cdn.jsdelivr.net/gh/topjohnwu/magisk-files@1cea72840fbf690f9a95512d03721f6a710fe02e/app-debug.apk has loop in iptables-restore ERROR
i try magisk delta 25206 on redriod 11, success turn on zygisk and support LSPosed

@ghost
Copy link

ghost commented Dec 12, 2023

google ‘magisk delta 25206’ download it,put it on nginx server,create apk download url edit https://github.com/ayasa520/redroid-script/blob/568d9287b877e76e1a359beffe940bde586d395b/stuffs/magisk.py#L10 ,and just run script

https://huskydg.github.io/magisk-files/app-release.apk has failed init issues https://cdn.jsdelivr.net/gh/topjohnwu/magisk-files@1cea72840fbf690f9a95512d03721f6a710fe02e/app-debug.apk has loop in iptables-restore ERROR i try magisk delta 25206 on redriod 11, success turn on zygisk and support LSPosed

Which version of zygisk and LSPosed did you use?

@7125Dev
Copy link

7125Dev commented Dec 12, 2023

google ‘magisk delta 25206’ download it,put it on nginx server,create apk download url edit https://github.com/ayasa520/redroid-script/blob/568d9287b877e76e1a359beffe940bde586d395b/stuffs/magisk.py#L10 ,and just run script

https://huskydg.github.io/magisk-files/app-release.apk has failed init issues https://cdn.jsdelivr.net/gh/topjohnwu/magisk-files@1cea72840fbf690f9a95512d03721f6a710fe02e/app-debug.apk has loop in iptables-restore ERROR i try magisk delta 25206 on redriod 11, success turn on zygisk and support LSPosed

Which version of zygisk and LSPosed did you use?

Image_1702373611712
Image_1702373609387

@abing7k
Copy link

abing7k commented Dec 14, 2023

@abing7k I just follow this script.

I started successfully, but couldn't start the second one

@abing7k
Copy link

abing7k commented Dec 14, 2023

https://github.com/ayasa520/redroid-script
@7125Dev
Did the magsik in redroid script run successfully?
image
I'm failed

@ghost
Copy link

ghost commented Dec 14, 2023

I started successfully, but couldn't start the second one

What do you mean by "the second one"?

@7125Dev
Copy link

7125Dev commented Dec 14, 2023

https://github.com/ayasa520/redroid-script
@7125Dev
Did the magsik in redroid script run successfully?
image
I'm failed
try magisk delta 25206

@abing7k
Copy link

abing7k commented Dec 16, 2023

If you run on arm , you can see https://github.com/abing7k/redroid-script
I created a magisk image.

@Lua12138
Copy link

Hello, everyone,

I try to do above works on Ubuntu(x86_64).

The magiskd is works, logcat --pid==101 says:

$ logcat --pid=101
--------- beginning of main
10-13 06:07:59.426   101   101 I Magisk  : Magisk R659E930C-kitsune(26404) daemon started
10-13 06:07:59.441   101   101 I Magisk  : * Device API level: 31
10-13 06:07:59.441   101   101 I Magisk  : * CPU ABI 64-bit: x86_64,arm64-v8a
10-13 06:07:59.441   101   101 I Magisk  : * CPU ABI 32-bit: x86,armeabi-v7a,armeabi
10-13 06:07:59.703   101   104 I Magisk  : ** zygote restarted
10-13 06:08:01.294   101   104 I Magisk  : ** boot-complete triggered
$ /sbin/magisk -v
R659E930C-kitsune:MAGISK:R

But the Magisk Application says not installed

image

However, even more amazingly, when I type /sbin/magisk su at the command line, the APK prompts for authorization.

image

Did I miss some steps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests