setup variables for commands
echo -e "\n
export image=redroid/redroid:11.0.0-amd64
export image_tar=${HOME}/redroid:11.0.0-amd64" >> ${HOME}/.bashrc
source ${HOME}/.bashrc
1 is recommended
preserve original redroid image
sudo docker pull $image
sudo docker save --output redroidBak.tar $image
backup or install original redroid image
# remove the changed image if exist
sudo docker image rmi -f $image
# install the original image
sudo docker load -i redroidBak.tar
preserve original redroid image
wget -q "https://raw.githubusercontent.com/moby/moby/master/contrib/download-frozen-image-v2.sh" -P ~ ; chmod u+x ~/download-frozen-image-v2.sh
~/download-frozen-image-v2.sh "$image_tar" redroid/redroid:11.0.0-amd64
backup or install original redroid image
# remove the changed image if exist
sudo docker image rmi -f $image
# install the original image
tar -cC "$image_tar" . | sudo docker load
mkdir ~/MagiskOnRedroid
cd ~/MagiskOnRedroid
download+extract magisk
find -maxdepth 1 -iname "magisk*" -not -name "*.apk" -exec rm -r {} \;
magisk_file="app-debug.apk"
# download Magisk 9b61bdfc(25201) debug as you did i guess
if [ ! -f $magisk_file ]; then
wget "https://cdn.jsdelivr.net/gh/topjohnwu/magisk-files@1cea72840fbf690f9a95512d03721f6a710fe02e/app-debug.apk"
fi
# because my machine x64 i will choose x86_64
unzip -j $magisk_file "lib/x86_64/libmagisk64.so" -d magisk
unzip -j $magisk_file "lib/x86_64/libbusybox.so" -d magisk
mv -v magisk/libmagisk64.so magisk/magisk
mv -v magisk/libbusybox.so magisk/busybox
# $ tree ~/MagiskOnRedroid
# .
# ├── app-debug.apk
# └── magisk
# ├── busybox
# └── magisk
compress magisk
tar --transform 's/.*\///g' -cf ~/magisk.tar --absolute-names $( find ~/MagiskOnRedroid | grep -E "magisk/|app-debug.apk$" )
remove.rc
cat <<\EOF > ~/remove.rc
on early-init
export PATH /sbin:/product/bin:/apex/com.android.runtime/bin:/apex/com.android.art/bin:/system_ext/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin
chmod 0700 /magisk.tar
chown root root /magisk.tar
chmod 0700 /setup.sh
chown root root /setup.sh
exec root root -- /setup.sh
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
EOF
sudo chmod 644 ~/remove.rc
sudo chown root:root ~/remove.rc
setup.sh
cat <<\EOF > ~/setup.sh
#!/system/bin/sh
# rm /system/fonts/NotoColorEmoji.ttf
tmpPushed=/magisk
rm -rf $tmpPushed
mkdir $tmpPushed
tar -xvf /magisk.tar --no-same-owner -C $tmpPushed
umount /magisk.tar ; rm -v /magisk.tar
mkdir /sbin
chown root:root /sbin
# chmod 0700 /sbin
chmod 0751 /sbin
cp $tmpPushed/magisk /sbin/
cp $tmpPushed/app-debug.apk /sbin/stub.apk
find /sbin -type f -exec chmod 0755 {} \;
find /sbin -type f -exec chown root:root {} \;
# add /sbin
# /sbin/
# ├── magisk
# └── stub.apk
ln -f -s /sbin/magisk /system/xbin/su
mkdir /product/bin
chmod 751 /product/bin
ln -f -s /sbin/magisk /product/bin/su
# add su (override `/system/xbin/su`)
# /product/bin/
# └── su -> /sbin/magisk
mkdir -p /data/adb/magisk
chmod 700 /data/adb
mv $tmpPushed/busybox /data/adb/magisk/
chmod -R 755 /data/adb/magisk
chmod -R root:root /data/adb/magisk
# /data/adb/
# ├── magisk
# │ └── busybox
# rm -rf $tmpPushed
EOF
sudo chmod 700 ~/setup.sh
sudo chown root:root ~/setup.sh
- phase
- boot with magisk support
( sudo docker stop a11 clear sudo docker run -itd --rm --privileged \ --name a11 \ -v ~/data:/data \ -v ~/remove.rc:/vendor/etc/init/remove.rc \ -v ~/setup.sh:/setup.sh \ -v ~/magisk.tar:/magisk.tar \ -p 5555:5555 \ redroid/redroid:11.0.0-amd64 \ ro.secure=0 )
Many errors and zygisk not work
---Magisk Logs---
9b61bdfc (25201)
11-20 13:17:35.089 91 91 I : Magisk 9b61bdfc(25201) daemon started
11-20 13:17:35.097 91 91 D : resetprop: prop [ro.config.per_app_memcg] does not exist
11-20 13:17:35.097 91 91 I : * Device API level: 30
11-20 13:17:35.100 91 93 D : resetprop: prop [ro.crypto.state] does not exist
11-20 13:17:35.100 91 93 I : ** post-fs-data mode running
11-20 13:17:35.100 91 93 I : * Mounting mirrors
11-20 13:17:35.101 91 93 E : mkdir /sbin/.magisk/mirror/data 493 failed with 2: No such file or directory
11-20 13:17:35.101 91 93 E : mount /sbin/.magisk/block/data->/sbin/.magisk/mirror/data failed with 2: No such file or directory
11-20 13:17:35.101 91 93 I : mount: /sbin/.magisk/mirror/data
11-20 13:17:35.101 91 93 E : symlink ./system_root/system->/sbin/.magisk/mirror/system failed with 2: No such file or directory
11-20 13:17:35.101 91 93 I : link: /sbin/.magisk/mirror/system
11-20 13:17:35.101 91 93 E : mkdir /sbin/.magisk/mirror/system_root 493 failed with 2: No such file or directory
11-20 13:17:35.101 91 93 E : mount /sbin/.magisk/block/system_root->/sbin/.magisk/mirror/system_root failed with 2: No such file or directory
11-20 13:17:35.101 91 93 I : mount: /sbin/.magisk/mirror/system_root
11-20 13:17:35.101 91 93 E : symlink ./system/product->/sbin/.magisk/mirror/product failed with 2: No such file or directory
11-20 13:17:35.101 91 93 I : link: /sbin/.magisk/mirror/product
11-20 13:17:35.101 91 93 E : symlink ./system/system_ext->/sbin/.magisk/mirror/system_ext failed with 2: No such file or directory
11-20 13:17:35.101 91 93 I : link: /sbin/.magisk/mirror/system_ext
11-20 13:17:35.118 91 93 I : * Initializing Magisk environment
11-20 13:17:35.126 91 93 D : resetprop: decode with protobuf [/data/property/persistent_properties]
11-20 13:17:35.126 91 93 D : resetprop: prop [persist.sys.safemode] does not exist
11-20 13:17:35.186 91 93 I : * Running post-fs-data.d scripts
11-20 13:17:35.189 91 93 E : mount /sbin/.magisk/mirror/data/adb/modules->/sbin/.magisk/modules failed with 2: No such file or directory
11-20 13:17:35.190 91 93 I : * Running module post-fs-data scripts
11-20 13:17:35.190 91 93 I : * Loading modules
11-20 13:17:42.756 91 93 I : ** late_start service mode running
11-20 13:17:42.756 91 93 I : * Running service.d scripts
11-20 13:17:42.756 91 93 I : * Running module service scripts
11-20 13:17:46.144 91 93 I : ** boot-complete triggered
11-20 13:31:34.815 91 93 D : su: request from pid=[2274], client=[12]
11-20 13:31:34.815 91 93 D : su: request from uid=[10116]
11-20 13:31:34.818 91 93 D : su: waiting child pid=[2277]
11-20 13:31:34.818 2277 2277 D : su: fork handler
11-20 13:31:34.818 2277 2277 D : su: use global namespace