MAGISK_v26_APK_FILE="/data/backup/Android/EssentialApps/Magisk-v26.1.apk"
./prepare_phone.sh task_install_magisk_v26_in_boot_partition
Log:
[15.04.2023 19:36 ] ### prepare_phone.sh started at 15.04.2023
19:36:07 (The PID of this process is 204833)
[15.04.2023 19:36 ] ### Processing the parameter ...
[15.04.2023 19:36 ] Not yet used parameter are:
"task_install_magisk_v26_in_boot_partition"
[15.04.2023 19:36 ] Tasks to execute are:
"task_install_magisk_v26_in_boot_partition"
[15.04.2023 19:36 ] Parameter for the function
init_tasks are: ""
[15.04.2023 19:36 ] ### The logfile used is
/var/tmp/prepare_phone.sh.log
[15.04.2023 19:36 ] Checking the include file
"/data/develop/android/scripts_on_linux/prepare_phone.include"
...
[15.04.2023 19:36 ] Reading the include file
"/data/develop/android/scripts_on_linux/prepare_phone.include"
...
[15.04.2023 19:36 ] Processing the parameter
...
[15.04.2023 19:36 ] Preparing the list of tasks to
execute ...
[15.04.2023 19:36 ] "init_tasks" is defined - now
executing it ...
----------------------------------------------------------------------
[15.04.2023 19:36 ] Searching for a config file ....
[15.04.2023 19:36 ] Config file "prepare_phone.conf"
succesfully read
[15.04.2023 19:36 ] Using the directory "/tmp" for
temporary files
[15.04.2023 19:36 ] The PID of this process is 204833
[15.04.2023 19:36 ] The include file used is :
-rwxr-xr-x. 1 xtrnaw7 xtrnaw7 252706 Apr 15 19:27
/data/develop/android/scripts_on_linux/prepare_phone.include
[15.04.2023 19:36 ] The include file used was last
edited at: "15.04.2023 /bs"
[15.04.2023 19:36 ] The version of the used
execute_tasks.sh script is "v2.2.2"
-----------------------------------------------------------------------
[15.04.2023 19:36 ] Using the TWRP image
"/data/backup/ASUS_ZENFONE8/twrp/twrp-3.7.0_12-0-I006D-enhanced.img"
for booting the phone into TWRP
[15.04.2023 19:36 ] Using the working directory
"/tmp/prepare_phone.sh_WORKDIR.204833" .
[15.04.2023 19:36 ] *** Reading the include file
"/data/develop/android/scripts_on_linux/boot_phone_from_twrp.sh"
...
[15.04.2023 19:36 ] The script is running as user
"xtrnaw7" -- will use "sudo" for the fastboot commands ...
[15.04.2023 19:36 ] Will use the attached phone with
the serial number "M6AIB760D0939LX"
[15.04.2023 19:36 ] Using the TWRP image found in the
parameter:
"/data/backup/ASUS_ZENFONE8/twrp/twrp-3.7.0_12-0-I006D-enhanced.img"
[15.04.2023 19:36 ] Using the options "-d -s
M6AIB760D0939LX " for the adb commands
[15.04.2023 19:36 ] Using the options " -s
M6AIB760D0939LX " for the fastboot commands
[15.04.2023 19:36 ] Checking the script prerequisites
...
[15.04.2023 19:36 ] Will wait up to 60 second(s)
after booting the phone into the bootloader
[15.04.2023 19:36 ] Will wait up to 120 second(s)
after booting the phone from the TWRP image
[15.04.2023 19:36 ] Will wait up to 30 second(s)
until the adb daemon is ready to use
[15.04.2023 19:36 ] The phone is currently booted
into the Android OS
[15.04.2023 19:36 ] The boot slot is _b.
----------------------------------------------------------------------
[15.04.2023 19:36 ] Executing the tasks now ...
[15.04.2023 19:36 ] The tasks to execute are:
Task 1: install_magisk_v26_in_boot_partition
[15.04.2023 19:36 ] Processing the task
"install_magisk_v26_in_boot_partition" ...
[15.04.2023 19:36 ] Executing now
"install_magisk_v26_in_boot_partition "
----------------------------------------------------------------------
[15.04.2023 19:36 ] The slot to use for this task is
"active"
[15.04.2023 19:36 ]
[15.04.2023 19:36 ] *** Installing Magisk using the
apk file "/data/backup/Android/EssentialApps/Magisk-v26.1.apk"
into the boot partition using the script
"/data/develop/android/scripts_on_linux/install_magisk_via_twrp.sh"
with the parameter "active copy_apk use_apk
magisk_apk_file=/data/backup/Android/EssentialApps/Magisk-v26.1.apk"
...
[15.04.2023 19:36 ]
[15.04.2023 19:36 ] The automatic reboot after
executing the script is enabled
[15.04.2023 19:36 ] The task execution will stop if
the script ends with a return code not zero
[15.04.2023 19:36 ]
----------------------------------------------------------------------
[15.04.2023 19:36 ] *** Executing now
"/data/develop/android/scripts_on_linux/install_magisk_via_twrp.sh
active copy_apk use_apk
magisk_apk_file=/data/backup/Android/EssentialApps/Magisk-v26.1.apk"
...
#
---------------------------------------------------------------------
install_magisk_via_twrp.sh version - v3.1.0.0 - add
Magisk to the boot partition of a phone running Android using
TWRP
Parameter "copy_apk" found: Will copy the Magisk apk
file to the phone if neccessary
Parameter "use_apk" found: Will use the files from
the apk file even if the files in /data/adb/magisk exist
Parameter "magisk_apk_file=file" found : Will use the
Magisk apk file
"/data/backup/Android/EssentialApps/Magisk-v26.1.apk"
Using the TWRP image hardcoded in the script:
"/data/backup/ASUS_ZENFONE8/twrp/current_twrp.img"
Checking the script prerequisites ...
Will wait 10 second(s) before starting the script on
the phone
The Magisk version used is v26.0 or newer
Using the temporary directory
"/data/local/tmp/MagiskInst" on the phone
The script is running as user "xtrnaw7" -- will use
"sudo" for the fastboot commands ...
Will patch the boot partition on the attached phone
with the serial number "M6AIB760D0939LX"
Using the options "-d -s M6AIB760D0939LX " for the
adb commands
Using the options " -s M6AIB760D0939LX " for the
fastboot commands
Checking for a connected phone booted into fastboot
mode ...
No attached phone in fastboot mode found
Checking for an attached phone with working access
via adb (USB) ...
Linux localhost 5.4.147-Omni-qgki-perf-g875131b91949
#20 SMP PREEMPT Sun Mar 26 09:47:43 CEST 2023 aarch64 Toybox
... found a phone connected via USB with working adb
access
The phone is booted in normal mode
The installed OS is based on Android 13 (Sun Mar 26
09:44:05 CEST 2023); the description for the distribution is
"omni_zenfone8-user 13 TQ2A.230305.008.C1
eng.xtrnaw.20230326.094541 release-keys"
The installed version of Magisk is
com.topjohnwu.magisk versionCode 25200
Booting the phone into the fastboot mode now ...
Waiting up to 60 seconds for
the boot into the fastboot mode ...
Booting the phone from the TWRP image
"/data/backup/ASUS_ZENFONE8/twrp/current_twrp.img" now
...
Sending 'boot.img' (98304
KB)
OKAY [ 2.850s]
Booting
OKAY [ 10.358s]
Finished. Total time: 13.259s
Waiting up to 60 seconds for the boot of the phone
....
Retrieving the current boot slot from the phone ...
The current boot slot is "_b"
The boot slot to patch is "_b"
The boot partition to patch is "boot_b"
Copying the Magisk apk file
"/data/backup/Android/EssentialApps/Magisk-v26.1.apk" to the
phone into the directory "/data" ...
/data/backup/Android/EssentialApps/Magisk-v26.1.apk:
1 file pushed, 0 skipped. 48.4 MB/s (11411692 bytes in 0.225s)
Creating the temporary directory
"/data/local/tmp/MagiskInst" with the Magisk files necessarry to
install Magisk into the boot partition ...
Creating the script file "/tmp/init_magisk_dirs.sh"
to create the directory "/data/local/tmp/MagiskInst" on the
phone ...
Creating the directory "/data/local/tmp/MagiskInst"
on the phone ...
Copying the temporary script file
"/tmp/init_magisk_dirs.sh" to the file
"/data/local/tmp/MagiskInst/create_temporary_magisk_dir.sh" on
the phone ...
/tmp/init_magisk_dirs.sh: 1 file pushed, 0 skipped.
72.1 MB/s (6573 bytes in 0.000s)
Executing the script
"/data/local/tmp/MagiskInst/create_temporary_magisk_dir.sh" on
the phone ...
------------------------------------------------------------------------------
+ adb -d -s M6AIB760D0939LX shell
/data/local/tmp/MagiskInst/create_temporary_magisk_dir.sh
/data/local/tmp/MagiskInst /data/Magisk-v26.1.apk
Using the directory "/data/local/tmp/MagiskInst/bin"
for the Magisk Binaries
Creating the files in the directory
"/data/local/tmp/MagiskInst/bin" using the files for the CPU
"arm64-v8a" from the apk file "/data/Magisk-v26.1.apk" ...
Unpacking the apk file "/data/Magisk-v26.1.apk" into
the directory
"/data/local/tmp/MagiskInst/magisk_apk_contents.531" ...
Copying the files to "/data/local/tmp/MagiskInst/bin"
...
+ mv ./assets/util_functions.sh
/data/local/tmp/MagiskInst/bin
+ mv ./assets/chromeos
/data/local/tmp/MagiskInst/bin/
+ mv ./assets/boot_patch.sh
/data/local/tmp/MagiskInst/bin
+ mv ./assets/addon.d.sh
/data/local/tmp/MagiskInst/bin
+ '[' -r ./assets/stub.apk ']'
+ mv ./assets/stub.apk /data/local/tmp/MagiskInst/bin
+ cd ./lib/arm64-v8a
+ mv libbusybox.so
/data/local/tmp/MagiskInst/bin/busybox
+ mv libmagisk64.so
/data/local/tmp/MagiskInst/bin/magisk64
+ mv libmagiskboot.so
/data/local/tmp/MagiskInst/bin/magiskboot
+ mv libmagiskinit.so
/data/local/tmp/MagiskInst/bin/magiskinit
+ mv libmagiskpolicy.so
/data/local/tmp/MagiskInst/bin/magiskpolicy
+ file=libmagisk32.so
+ '[' arm64-v8ax '=' arm64-v8ax -a -r
./lib/armeabi-v7a/libmagisk32.so ']'
+ set +x
+ TEMPRC=0
+ set +x
------------------------------------------------------------------------------
...
"/data/local/tmp/MagiskInst/create_temporary_magisk_dir.sh"
successfully executed
Checking if the Magisk patch script "boot_patch.sh"
exists on the phone ....
-rwxr-xr-x 1 root root 6978 2023-04-15 17:36
/data/local/tmp/MagiskInst/bin/boot_patch.sh
Checking if the download directory "/sdcard/Download"
exists on the phone ....
/sdcard/Download
Creating the boot image file
"/sdcard/Download/boot_b.205108.img" from the partition
"/dev/block/by-name/boot_b" ...
196608+0 records in
196608+0 records out
100663296 bytes (96 M) copied, 0.486934 s, 197 M/s
Checking the result ...
-rw-rw---- 1 root media_rw 100663296 2023-04-15 17:36
/sdcard/Download/boot_b.205108.img
The check sums are:
The check sum of the boot partition
"/dev/block/by-name/boot_b" on the phone
is
"556884404"
The check sum of th boot image file on the phone is
"/sdcard/Download/boot_b.205108.img" is "556884404"
Installing Magisk into the boot partition using the
new method ...
Patching the boot image file
"/sdcard/Download/boot_b.205108.img" ...
Preparing the directory with the temporary Magisk
installation files for usage by the user with the UID 2000 (this
is the user "shell") ...
+ adb -d -s M6AIB760D0939LX shell chown -R 2000:2000
/data/local/tmp/MagiskInst
+ adb -d -s M6AIB760D0939LX shell chmod -R 755
/data/local/tmp/MagiskInst
+ adb -d -s M6AIB760D0939LX shell chown -R 2000:2000
/sdcard/Download/boot_b.205108.img
+ adb -d -s M6AIB760D0939LX shell chmod o+r
/sdcard/Download/boot_b.205108.img
+ set +x
Rebooting the phone into the
Android OS now ...
Waiting up to 60 seconds for the boot of the phone
.....
The phone is now booted into the Android OS.
Using the patch script
"/data/local/tmp/MagiskInst/bin/boot_patch.sh" ...
Waiting up to 20 seconds for /data to get mounted
...........
- Unpacking boot image
Parsing boot image:
[/sdcard/Download/boot_b.205108.img]
HEADER_VER [3]
KERNEL_SZ
[39928320]
RAMDISK_SZ [37815858]
OS_VERSION [13.0.0]
OS_PATCH_LEVEL [2023-03]
PAGESIZE
[4096]
CMDLINE
[]
KERNEL_FMT [raw]
RAMDISK_FMT [gzip]
VBMETA
- Checking ramdisk status
Loading cpio: [ramdisk.cpio]
- Magisk patched boot image detected
Loading cpio: [ramdisk.cpio]
Remove [.backup]
Remove [.backup/.magisk]
Remove [overlay.d]
Remove [overlay.d/sbin]
Remove [overlay.d/sbin/magisk64.xz]
Remove [.backup/.rmlist]
Move [.backup/init] -> [init]
Move [.backup/system/etc/fstab.postinstall] ->
[system/etc/fstab.postinstall]
Dump cpio: [ramdisk.cpio]
- Patching ramdisk
- Pre-init storage partition device ID: metadata
Loading cpio: [ramdisk.cpio]
Add entry [init] (0750)
Create directory [overlay.d] (0750)
Create directory [overlay.d/sbin] (0750)
Add entry [overlay.d/sbin/magisk64.xz] (0644)
Add entry [overlay.d/sbin/stub.xz] (0644)
Patch with flag KEEPVERITY=[false]
KEEPFORCEENCRYPT=[false]
Found fstab file [system/etc/fstab.postinstall]
Remove pattern
[,avb_keys=/product/etc/security/avb/system_other.avbpubkey]
Loading cpio: [ramdisk.cpio.orig]
Backup mismatch entry: [init] -> [.backup/init]
Record new entry: [overlay.d] -> [.backup/.rmlist]
Record new entry: [overlay.d/sbin] ->
[.backup/.rmlist]
Record new entry: [overlay.d/sbin/magisk64.xz] ->
[.backup/.rmlist]
Record new entry: [overlay.d/sbin/stub.xz] ->
[.backup/.rmlist]
Backup mismatch entry: [system/etc/fstab.postinstall]
-> [.backup/system/etc/fstab.postinstall]
Create directory [.backup] (0000)
Add entry [.backup/.magisk] (0000)
Dump cpio: [ramdisk.cpio]
- Repacking boot image
Parsing boot image:
[/sdcard/Download/boot_b.205108.img]
HEADER_VER [3]
KERNEL_SZ
[39928320]
RAMDISK_SZ [37815858]
OS_VERSION [13.0.0]
OS_PATCH_LEVEL [2023-03]
PAGESIZE
[4096]
CMDLINE
[]
KERNEL_FMT [raw]
RAMDISK_FMT [gzip]
VBMETA
Repack to boot image: [new-boot.img]
HEADER_VER [3]
KERNEL_SZ
[39928320]
RAMDISK_SZ [37859538]
OS_VERSION [13.0.0]
OS_PATCH_LEVEL [2023-03]
PAGESIZE
[4096]
CMDLINE
[]
Checking the result ...
-rw-r--r-- 1 shell shell 100663296 2023-04-15 19:37
/data/local/tmp/MagiskInst/bin/new-boot.img
The patched boot image is
"/sdcard/Download/patched_boot_b.205108.img"
Removing the installed Magisk app ...
+ adb -d -s M6AIB760D0939LX shell pm uninstall -k
com.topjohnwu.magisk
Success
+ set +x
Now installing the Magisk apk
"/data/backup/Android/EssentialApps/Magisk-v26.1.apk" ...
+ cat
/data/backup/Android/EssentialApps/Magisk-v26.1.apk
+ adb -d -s M6AIB760D0939LX shell pm install -S
11411692
Success
+ set +x
Will now grant the permission
"android.permission.POST_NOTIFICATIONS" for the Magisk app ...
Now rebooting the phone into
the bootloader ...
Waiting up to 60 seconds for the boot into the
fastboot mode ...
Booting the phone from the TWRP
image "/data/backup/ASUS_ZENFONE8/twrp/current_twrp.img"
now ...
Sending 'boot.img' (98304
KB)
OKAY [ 2.823s]
Booting
OKAY [ 10.359s]
Finished. Total time: 13.245s
Waiting up to 60 seconds for the boot of the phone
....
INFO: The Magisk binaries in "/data/adb/magisk"
already exist
Waiting now 10 seconds ...
Patching the partition "/dev/block/by-name/boot_b"
from the patched boot image file
"/sdcard/Download/patched_boot_b.205108.img" via dd ...
196608+0 records in
196608+0 records out
100663296 bytes (96 M) copied, 4.720204 s, 20 M/s
Checking the result ....
The check sums for the images and devices on the
phone are:
556884404 100663296
/sdcard/Download/boot_b.205108.img
1291167315 100663296
/sdcard/Download/patched_boot_b.205108.img
1291167315 100663296 /dev/block/by-name/boot_b
OK, patching the boot partition
"/dev/block/by-name/boot_b" was successfull
INFO: The Magisk binaries in "/data/adb/magisk"
already exist
Rebooting the phone now ...
#
---------------------------------------------------------------------
[15.04.2023 19:39 ] ... the script ended with
RC=0
----------------------------------------------------------------------
[15.04.2023 19:39 ] "finish_tasks" is defined - now
executing it ...
----------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
[15.04.2023 19:39 ] *** Task summary :
-------------------------------------------------------------------------------------------------------------
[15.04.2023 19:39 ] Tasks executed successfully are:
install_magisk_v26_in_boot_partition
-------------------------------------------------------------------------------------------------------------
[15.04.2023 19:39 ] The working directory used is:
"/tmp/prepare_phone.sh_WORKDIR.204833" .
[15.04.2023 19:39 ] The include file used was :
[15.04.2023 19:39 ] -rwxr-xr-x. 1 xtrnaw7
xtrnaw7 252706 Apr 15 19:27
/data/develop/android/scripts_on_linux/prepare_phone.include
[15.04.2023 19:39 ] The include file used was last
edited at: "15.04.2023 /bs"
----------------------------------------------------------------------
[15.04.2023 19:39 ] Execution summary:
[15.04.2023 19:39 ] Tasks
processed:
1
[15.04.2023 19:39 ] Tasks executed
succesfully: 1
[15.04.2023 19:39 ] Tasks executed with
errors: 0
[15.04.2023 19:39 ] Tasks not executed on request: 0
[15.04.2023 19:39 ] Tasks not
found:
0
[15.04.2023 19:39 ] ### The logfile used was
/var/tmp/prepare_phone.sh.log
[15.04.2023 19:39 ] ### The start time was 15.04.2023
19:36:07, the script runtime is (day:hour:minute:seconds)
0:00:03:07 (= 187 seconds)
[15.04.2023 19:39 ] ### prepare_phone.sh ended at
15.04.2023 19:39:14 (The PID of this process is 204833; the RC
is 0)
[ OmniRom 13 Dev - xtrnaw7@t15g
/data/develop/android/scripts_on_linux ] $