[CLOSED][OUTDATED][2017.2.7][GUIDES & DOCS] Magisk All-In-One Wiki - Magisk

This thread is outdated and will never be updated
Please check the official Magisk documentation on Github!
Magisk All-In-One Wiki​
Table of Contents
Module Creation And Online Repos
Create your first Magisk Module; Submit to Magisk Module Repo
Notes Regarding Magisk Module Repos
Magisk Guides and Tricks
How Do Magic Mount Behave
Manipulate system props (build.prop)
Remove files / folders
Cache mounts
Magisk Details (DEV)
sepolicy-inject tool
Work flow
File structure
Boot stages
Module Creation And Online Repos
Create your first Magisk Module; Submit to Magisk Module Repo
Details are all listed in the module template on Github.​
Notes Regarding Magisk Module Repos
Magisk module can be different kinds, for example it can be used to debloat your system; it can be used to install your favorite application into system to give it the privilege of system apps.; it can be a full custom rom; it can also be cool mods like Xposed and root. However I view the "Magisk Module Repo" as a platform to share modules that can be used on lots of devices, preferably universal to all Android devices. Device specific modules are OK if stated clearly in the descriptions, and actually doing something that is non-trivial.
I will moderate the "Magisk Module Repo" in my personal preference and standard, here are some that will not be included:
Modules that are too large. A full custom rom, for example, is too large to be hosted on Github effectively. You can share them on XDA forums in your device specific forums
Modules that are too trivial. For example: mods that simply just add apps to system; debloating selective apps; doing things that can be done in simple boot scripts. I'll add more here if when I face requests that I consider "trivial"
Modules that contains copyright property (unless given permission)
Modules that violates XDA rules

This thread is outdated and will never be updated
Please check the official Magisk documentation on Github!
Magisk Guides and Tricks
How Do Magic Mount Behave
Magic Mount by default merges the files in $MODPATH/system into the real /system. You can think as it dirty flashes the contents into /system.
Existing files will be replaced; new files will be added; will not remove any files
Directories under $MODPATH/system that contains a file named ".replace" will NOT merge into the system. It will directly replace the correspond directory in /system.
In the module template, you can list them in "config.sh", the scripts will create the ".replace" file automatically for you.
You can think as it wipes the existing folder, and then adds contents to that folder in /system.
The directory that contains ".replace" will replace the one in /system, all contents originally in the folder will be discarded
Adding items to system is relatively expensive, Magisk would need to do many under-the-hood tasks to achieve it (thus, called "Magic Mount")
Furthermore, the higher level the file is added, the more it effects the overall system
Only add new items if necessary! Think twice before adding items to /system root!
Replacing a whole folder is recommended if viable, it reduces the complicated process and speed up the booting time
Manipulate system props (build.prop)
Since the early days of XDA, people love "build.prop" mods. It can bring cool effects to our devices.
build.prop files are loaded early in the boot process, and once read-in, the values cannot be modified... in theory.
Magisk included a tool called "resetprop", it can modify any system props you want easily.
In the module template, you can set PROPFILE=true, then add your props into the file common/system.prop
Magisk by default reads the system.prop of each module and set the props.
Further resetprop options:
Code:
usage: /data/magisk/resetprop [-v] [-n] [--file propfile] [--delete name] [ name value ]
-v :
verbose output (Default: Disabled)
-n :
no event triggers when changing props (Default: Will trigger events)
--file propfile :
Read props from prop files (e.g. build.prop)
--delete name :
Remove a prop entry
Remove files / folders
It is complicated to actually remove a file (possible, not worth the effort). Replacing it with a dummy file should be good enough
Add an empty file with the same name and path into your module (easy way), or add this code to the updater-script to create it at flash time
Code:
# Example: you want to remove /system/media/audio/alarms/Argon.ogg
# Note: mktouch is a function defined in my updater-script, it is not a standard command!
mktouch $MODDIR/system/media/audio/alarms/Argon.ogg
It is complicated to actually remove a folder (possible, not worth the effort). Replacing it with an empty folder should be good enough
Add the folder to the replace list in "config.sh" in the module template, it will replace the folder with an empty one
Cache mounts
Some files requires to be mounted much earlier in the boot process, currently known are bootanimation, and some libs (most users won't change them).
You can place your files into the corresponding location under /cache/magisk_mount, Magisk will automagiskally manage selinux contexts, permissions and the mounting for you. For example, you want to replace /system/media/bootanimation.zip, copy your new boot animation zip to /cache/magisk_mount/system/media/bootanimation.zip, Magisk will mount your files in the next reboot​
More to come ...

This thread is outdated and will never be updated
Please check the official Magisk documentation on Github!
Magisk Details (DEV)
sepolicy-inject
Before starting, check the complete document from Chainfire
SELinux Policy Section in How-To SU
The included sepolicy manipulation tool is called "sepolicy-inject", it supports live patching, and also supports policy statements following the same syntax as supolicy:
Code:
sepolicy-inject [--live] [--minimal] [--load <infile>] [--save <outfile>] [policystatement...]
--live: directly load patched policy to device
--minimal: minimal patches for boot image to let Magisk live patch on boot
Supported policy statements:
"allow #source-class #target-class permission-class #permission"
"deny #source-class #target-class permission-class #permission"
"auditallow #source-class #target-class permission-class #permission"
"auditdeny #source-class #target-class permission-class #permission"
"create #class"
"permissive #class"
"enforcing #class"
"attradd #class #attribute"
"typetrans source-class target-class permission-class default-class (optional: object-name)"
source-class and target-class can be attributes (patches the whole group)
All sections (except typetrans) can be replaced with '*' to patch every possible matches
Sections marked with '#' can be replaced with collections in curly brackets
e.g: allow { source1 source2 } { target1 target2 } permission-class { permission1 permission2 }
Will be expanded to:
allow source1 target1 permission-class permission1
allow source1 target1 permission-class permission2
allow source1 target2 permission-class permission1
allow source1 target2 permission-class permission2
allow source2 target1 permission-class permission1
allow source2 target1 permission-class permission2
allow source2 target2 permission-class permission1
allow source2 target2 permission-class permission2
Work flow
Code:
--------post-fs---------
(Device Boots) -> Mount Magisk cache files -> (build.prop and persist prop loads) ->
-----------------------------post-fs-data---------------------------------
-> Live patch sepolicy -> mount magisk.img -> Preparation -> 5 stage of tasks ->
--------------late_start--------------
-> (System Start Up) -> run all service.sh -> Start Magisk Hide
-> (Parallel with other processes....)
(Preparation) Magisk will travel through all enabled module directories to collect info
(1st stage) Mount system (vendor) mirrors. This is used to revert dummy files
(2nd stage) Clone the system structure, and mount the dummy directories to provide a dummy skeleton
(3rd stage) Mount module items into the system (and dummy skeletons)
(4th stage) Execute scripts
(5th stage) Mount the mirror items back to the remaining dummy files
File Structures
A "Magisk Module" is a subfolder under magisk root directory
The structure of a Magisk Module do not have a strict restriction. However, here are some key files / folders:
Code:
/magisk
|
|-.core <--- Magisk auto-generated files. Do not mess with them :)
| |
| |
| |-hosts <--- This file will be mounted to /system/etc/hosts to enable
| | systemless support for AdBlocker apps.
| |-magiskhide <--- This folder holds the hide list and add/rm/list/enable/disable scripts
| | | Include the magiskhide binary
| | |-magiskhide
| | |-hidelist
| | |-add
| | |-rm
| | |-list
| | |-enable
| | |-disable
| |
| |-su <--- This folder holds the MagiskSU binaries and scripts
| | | Include the magiskhide binary
| | |-su
| | |-magisksu.sh
| | |-sbin_bind <--- This folder will bind mount to /sbin
| | |-.....
| |
| |-post-fs-data.d <--- Place scripts that should be executed at post-fs-data here
| | |-.....
| |
| |-service.d <--- Place scripts that should be executed at late_start service here
| |-.....
|
|
|-other_module
| |-.....
|
|-your_module
| |
| |-auto_mount <--- If this file exists, auto mount is enabled
| |
| |-disable <--- If this file exists, the module is disabled
| |
| |-remove <--- If this file exists, the whole module folder
| | will be removed in the next reboot
| |-module.prop <--- This files stores the info of your module
| |
| |-system.prop <--- This file will be read by resetprop
| |
| |-post-fs-data.sh <--- This script will be executed in post-fs-data
| |
| |-service.sh <--- This script will be executed in late_start service
| |
| |-system <--- If auto mount is enabled, Magisk will "Magic Mount" this folder
| | |-....
| | |-....
| | |-....
| | |-....
| |
| |-vendor <--- Auto generated. A symlink to $MODID/system/vendor
| | Dealing with separate vendor partitions
| |-..... <--- Any other files/folders are allowed
|
|-another_module
| |-.....
|-...
Other important folders (under /dev), these will be created every boot
Code:
/dev/busybox <--- Busybox applet symlinks will be created here
|-.... Will be bind mounted to /system/xbin if enable busybox in Magisk Manager
|-....
|-....
/dev/magisk
|
|-dummy <--- Lies all cloned dummy structures
| | Folders in here will be mounted to /system
| |-.....
|
|-mirror <--- Lies all mirrors
| |
| |-system
| | |-....
| |
| |-vendor <--- Could be a symlink to /dev/mirror/system/vendor
| |-....
|
|-mnt <--- Lies all mounting info
|
|-dummy <--- Lists all dummy mounts
| |-....
|
|-mirror <--- Lists all mirror mounts
| |-....
|
|-system <--- Lists all /system mounts
| |-....
|
|-vendor <--- Lists all /vendor mounts
|-....
Boot Stages
If you are working on complicated projects, you shall need more control to the whole process.
Magisk can run scripts in different boot stages, you can fine tune exactly what you want to do.
post-fs mode:
This stage is BLOCKING. Boot process will NOT continue until everything is done, or 20 seconds has passed
Happens after most partitions are mounted, except /data
Magisk will bind mount items in: /cache/magisk_mount/system (*1)
post-fs-data mode:
This stage is BLOCKING. Boot process will NOT continue until everything is done, or 60 seconds has passed
Happens after /data is ready (including encrypted data)
Happens before Zygote is started (which means pretty much everything)
/data/magisk.img will be mounted to /magisk
Magisk will bind mount items in: /magisk/$MODID/system (*2)
Magisk will run script: /magisk/$MODID/post-fs-data.sh
Magisk will run scripts in: /magisk/.core/post-fs-data.d
late_start service mode:
This stage is NON-BLOCKING, it will run parallel with other processes
Put time consuming but non time critical tasks here. In other modes, the boot process will be stuck if it took too long to finish your tasks.
Happens when class late_start is started . Most things are are loaded/loading in this case.
Magisk will run script: /magisk/$MODID/service.sh
Magisk will run scripts in: /magisk/.core/service.d
(*1) Bind mounting in post-fs only support simple bind mounts, which mean you cannot add files or replace directories.
It will only mount files that exist in the current system.
(*2) Bind mounting in post-fs-data support complex bind mounts. Please refer to the "Magic Mount" section

Thanks for this @topjohnwu.
If github is the where all modules need to be hosted, how do we plan on supporting closed source modules?
Or is closed source modules not supported?

@topjohnwu is there any thought about aroma installers being supported? is this already possible? or are you planning to add something similar?

I've tried to build a v7-compatible zip file for an app and Magisk Manager kept crashing with the following in its module.prop:
Code:
versionCode=7.1.3231428
Is it supposed to be a single round number (like a versionCode for Android apps)?

anantharam said:
Thanks for this @topjohnwu.
If github is the where all modules need to be hosted, how do we plan on supporting closed source modules?
Or is closed source modules not supported?
Click to expand...
Click to collapse
You can host closed source binary on Github.
ibrokemypie said:
@topjohnwu is there any thought about aroma installers being supported? is this already possible? or are you planning to add something similar?
Click to expand...
Click to collapse
You can flash the Magisk Module template in aroma with the same method to flash SuperSU. However if the module itself is made with aroma, it will not be able to flash in Magisk Manager
stangri said:
I've tried to build a v7-compatible zip file for an app and Magisk Manager kept crashing with the following in its module.prop:
Is it supposed to be a single round number (like a versionCode for Android apps)?
Click to expand...
Click to collapse
Yes, the versionCode is the similar concept of Android application's version code. It has to be a single number. You can place your long version number into version, which supports any string.

i have a problem with MagiskManager 2.0 launch.... app stopped after open it.
Zenfone ZE520KL...
Also, plz help - where can i found new supersu 2.78 for magisk?

topjohnwu said:
Yes, the versionCode is the similar concept of Android application's version code. It has to be a single number. You can place your long version number into version, which supports any string.
Click to expand...
Click to collapse
Still, the magisk manager shouldn't crash on invalid versionCode.

I need to patch in lines to audio_effects.conf rather than replace the file. Is there any way to do a systemless merge of lines within a conf with Magisk?

Hello, I'm trying to bring the OnePlus Camera to Magisk, and I'm having issues. I feel that I understand how to create a Magisk module from following your tutorial on Github, but apparently I don't. I just spent about 25 minutes trying to figure this out on my own, and couldn't.
When I flash my zip, I get error 255 in TWRP. It claims "/tmp/updater" doesn't exist. Magisk Manager also claims it's not a Magisk module when trying to manually add it in the app.
Below is the recovery.log, and link to the Github repo for what I'm working on. Any help is appreciated!
Source: https://github.com/ryanguy426/OnePlus-Camera-Magisk
recovery.log (PasteBin): http://pastebin.com/z0B9jaSM

ryanguy426 said:
When I flash my zip, I get error 255 in TWRP. It claims "/tmp/updater" doesn't exist. Magisk Manager also claims it's not a Magisk module when trying to manually add it in the app.
Source: https://github.com/ryanguy426/OnePlus-Camera-Magisk
recovery.log (PasteBin): http://pastebin.com/z0B9jaSM
Click to expand...
Click to collapse
AFAIK If you use the Magisk v7 template (from github), you do not flash resulting ZIP in recovery. Also, I'm not sure if just downloading the ZIP file from github will do, AFAIK doing that creates a nesting folder which is probably why Magisk refuses to add the module.
I can create the correct ZIP and I would have tried it on my phone, but I followed your support link and it leads to the generic Magisk thread and doesn't list specific models it's compatible with, so I refrained.
PS. Fix REPLACE in your config.sh

stangri said:
AFAIK If you use the Magisk v7 template (from github), you do not flash resulting ZIP in recovery. Also, I'm not sure if just downloading the ZIP file from github will do, AFAIK doing that creates a nesting folder which is probably why Magisk refuses to add the module.
I can create the correct ZIP and I would have tried it on my phone, but I followed your support link and it leads to the generic Magisk thread and doesn't list specific models it's compatible with, so I refrained.
PS. Fix REPLACE in your config.sh
Click to expand...
Click to collapse
I haven't created a support thread yet, as XDA doesn't allow placeholder threads. I'll create the thread when the module works.
I'll start over with it, and see if I can get it working. They're for the tips!

I have created a module that will enable miracast by adding a line to the build.prop. When I try to manually add the module to magisk I get an error saying "This zip is not a magisk module!!" Can someone please tell me what I'm doing wrong.
Here is the module : github.com/blake1029384756/EnableMiracast

Blake1029384756 said:
I have created a module that will enable miracast by adding a line to the build.prop. When I try to manually add the module to magisk I get an error saying "This zip is not a magisk module!!" Can someone please tell me what I'm doing wrong.
Here is the module : github.com/blake1029384756/EnableMiracast
Click to expand...
Click to collapse
If you are downloading the zip from github it nests a folder within it which magisk doesnt like, you need to zip up the files in the root of the zip.

ibrokemypie said:
If you are downloading the zip from github it nests a folder within it which magisk doesnt like, you need to zip up the files in the root of the zip.
Click to expand...
Click to collapse
I am aware that it does that and have made sure all files are in the root of the zip. Idk why it doesnt add to magisk manager

ahrion said:
I need to patch in lines to audio_effects.conf rather than replace the file. Is there any way to do a systemless merge of lines within a conf with Magisk?
Click to expand...
Click to collapse
Just make a copy of the file as /magisk/your_mldule/system/etc/audio_effects.conf, and modify the fake aidio_effects.conf which will be mounted during boot.
But the weird thing is that some setprop commands don't work when it is written in post-fs-data or post-fs, at least under Magisk v6 OnePlus 3 Oxygen OS. I have to write the setprop modifications in a fake build.prop instead.
Here is the module that I transplant from guitardedhero's ViPER4Audio_5.4_Stock.zip. Maybe it would help.
BTW: The attachment doesn't work well on v7, it stuck at boot animation. While it works well on v6.

Iceyogurt said:
Just make a copy of the file as /magisk/your_mldule/system/etc/audio_effects.conf, and modify the fake aidio_effects.conf which will be mounted during boot.
But the weird thing is that some setprop commands don't work when it is written in post-fs-data or post-fs, at least under Magisk v6 OnePlus 3 Oxygen OS. I have to write the setprop modifications in a fake build.prop instead.
Here is the module that I transplant from guitardedhero's ViPER4Audio_5.4_Stock.zip. Maybe it would help.
BTW: The attachment doesn't work well on v7, it stuck at boot animation. While it works well on v6.
Click to expand...
Click to collapse
Perhaps you might be able to tell me why Magisk Manager isn't recognizing my zip as a Magisk module...https://github.com/therealahrion/Audio-Modification-Framework

ahrion said:
Perhaps you might be able to tell me why Magisk Manager isn't recognizing my zip as a Magisk module...https://github.com/therealahrion/Audio-Modification-Framework
Click to expand...
Click to collapse
It is not easy to find a bug in my mobile browser. I'll try to look through your script more carefully when I get a PC. Now there is a mistake in the config.sh.
Code:
# This is an example
REPLACE="
/system/app/Youtube
/system/priv-app/SystemUI
/system/priv-app/Settings
/system/framework
"
# Construct your own list
REPLACE="
/system/etc
/system/vendor/etc
"
The first variable REPLACE is an example, so just delete it.(oh sorry, I forget it will be revalued because of the second one) And leave the second REPLACE void.
Code:
# Construct your own list
REPLACE=""
Since the value of REPLACE are folders, it mean replace an existing folder with a same-name-folder. The modified fake audio_effects.conf file will be mounted to replace the existing file automatically. No need to replace a whole folder.

ahrion said:
Perhaps you might be able to tell me why Magisk Manager isn't recognizing my zip as a Magisk module...https://github.com/therealahrion/Audio-Modification-Framework
Click to expand...
Click to collapse
Sorry about it, i can't figure out the reason either. I don't recommend you do the modification of the audio config files in post-fs-data.sh, which will be executed during every boot. I love your dax, wish it be a magisk module soon.

Related

[Q] lsof for android or busybox

I'm experimenting with mounting a loopback image which contains some private files. I've been mounting and unmounting it using scripts executed via GScript.
Sometimes when I try to unmount the image, it gives me a failed error. I am assuming this is because a file is open by some process, but I can't figure out which one.
So finally to my question: does anybody know of an lsof busybox applet, a native lsof binary, or any application that can tell me what files are opened by which processes?
You can try such way
lsof | grep <your process name or folder name>
Click to expand...
Click to collapse
For me it's worked. I can see all open files from one mounted folder.

[TEMPORARY FIX][TWEAK][MT6582] Xposed Installer Log File Gets Big

Hi All,
I am a happy user of Xposed Installer and using Modules.
However, one day my friend asked me if I could help him to fix the logging problems of Xposed because it almost ate like ~500MB of his internal space without him knowing it. So, I made this simple script to make a temporary fix (although I can still make this a little more flexible by checking the log file instead of running it on a fixed interval). I hope this helps and I hope Xposed dev can make an option to cleanup the logs generated by the modules.
More power
The script - I found that (not really proven, but as observed) looping scripts in the init.d are not very well handled so I did a workaround. I have the main script (cleaner) inside data and one script (trigger) in init.d. So here are they:
The main script - I placed on /data/Tweaks/scripts:
Code:
#!/system/bin/sh
# Name: 50_XposedCleanLog
# Date: 10/27/2014
# Author: Arsie Organo Jr. - [email protected]
# Link:
# About: This will clean up Xposed Installer app generated
# logs every X minutes.
# 1. Rooted
# 2. Busybox is installed.
####################################################
# Interval between 50_XposedCleanLog runs, in seconds, 18000=.5hour
XPOSEDLOGS=/data/data/de.robv.android.xposed.installer/log/error.log
a=0
sleepme=18000
while [ $a -ge 0 ]
do
busybox rm -f $XPOSEDLOGS
busybox touch $XPOSEDLOGS
chown root:root $XPOSEDLOGS
echo "Xposed Logs Cleanup Started $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $XPOSEDLOGS;
echo "Cleanup will run again in the next $(expr $sleepme / 60) min" | tee -a $XPOSEDLOGS;
echo $a
a=`expr $a + 1`
echo "Xposed Logs cleaner completed at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $XPOSEDLOGS;
sleep $sleepme
done
# END
And the trigger is placed in /system/etc/init.d - 10_DONOTDELETE:
Code:
#!/system/bin/sh
# Name: 10_DONOTDELETE
# Date: 10/28/2014
# Author: Arsie Organo Jr. - [email protected]
# Link:
# About: This script is needed to run all the tweaks
# and looping scripts.
# You will need your device to be:
# 1. Rooted
# 2. Busybox is installed.
####################################################
datalog=/data/Tweaks/logs/10_DONOTDELETE.log
busybox rm -f $datalog
busybox touch $datalog
# Xposed logs cleaner
/system/bin/sh /data/Tweaks/scripts/50_XposedCleanLog.sh > /dev/null 2>&1 &
if [ `busybox ps -ef | grep Tweaks | grep 50_XposedCleanLog.sh | wc -l` -eq 1 ] ;
then
echo "$( date +"%m-%d-%Y %H:%M:%S" ) Xposed logs cleaner initiated" | tee -a $datalog;
else
echo "$( date +"%m-%d-%Y %H:%M:%S" ) Xposed logs cleaner initialization FAILED" | tee -a $datalog;
fi;
So this simply means that the main script will be called upon restart and then loop it in the background checking the log file every 30min.
Note: Phone needs to be rooted and must have busybox installed. Tested on MediaTek MT6582 (MP Agua Rio) JB version.
I have attached a flashable here.. direct flash only and there is no need to wipe your cache.
This will work ONLY if your phone supports init.d and the generated Xposed log file is located here - /data/data/de.robv.android.xposed.installer/log/error.log
Wow very nice keep it up sir. :good:
Rovo89 set limit for log file to 5 MB. https://github.com/rovo89/XposedBridge/commit/afcc3e1e788ea44bfd00245a24b5dfe6c86aa3d0
Cool!
pyler said:
Rovo89 set limit for log file to 5 MB. https://github.com/rovo89/XposedBridge/commit/afcc3e1e788ea44bfd00245a24b5dfe6c86aa3d0
Click to expand...
Click to collapse
That's cool, however using the latest Xposed (experimental version) we've seen the error.log can go more than 500mb.
You can check the ridiculous size of the error.log below. So to aid this, I made this looping script.
eyesfortech said:
That's cool, however using the latest Xposed (experimental version) we've seen the error.log can go more than 500mb.
You can check the ridiculous size of the error.log below. So to aid this, I made this looping script.
Click to expand...
Click to collapse
Yes, this change is not part of 2.7 exp1.
too bad but there is always hope
pyler said:
Yes, this change is not part of 2.7 exp1.
Click to expand...
Click to collapse
yeah... I guess so, but there's always hope
huge issue
I check and mine is 7gb but when I check application manager it says xposed is using 11gb why?
manual Clear logs
bigchuk00 said:
I check and mine is 7gb but when I check application manager it says xposed is using 11gb why?
Click to expand...
Click to collapse
Hi,
have you tried manually clearing the logs from Xposed Logs options?
No. I didn't. The flash able zip was what I used n it worked fine . thank you.
Cool! I guess the permanent solution will be provided in the next update of Xposed (hopefully!)
It's just absurd that these 'error logs' rack up over a 100mb per day. The Xposed chappies say look at the log to see what module is causing the problem - well, I can't make head nor tail of the logs. Should be a better way of dealing with it.
eyesfortech said:
Cool! I guess the permanent solution will be provided in the next update of Xposed (hopefully!)
Click to expand...
Click to collapse
I admire your genius in setting up cron & it works flawlessly on my device, please would be able to create a flashable script or cron that will make @zeppelinrox sclean(wipe dalvik & reboot) script to run once each week?
slimcyril said:
I admire your genius in setting up cron & it works flawlessly on my device, please would be able to create a flashable script or cron that will make @zeppelinrox sclean(wipe dalvik & reboot) script to run once each week?
Click to expand...
Click to collapse
Unfortunately I am currently swamped with my day job and I cannot promise anything sooner. Can you give me the link the one you wanted me to try? And on what device? Currently I am no longer using MTK so testing it will also be a problem.
Thanks.
eyesfortech said:
Unfortunately I am currently swamped with my day job and I cannot promise anything sooner. Can you give me the link the one you wanted me to try? And on what device? Currently I am no longer using MTK so testing it will also be a problem.
Thanks.
Click to expand...
Click to collapse
Thanks for your response I later found what I was looking here http://forum.xda-developers.com/showthread.php?t=2700146

[Magisk] Magisk Mount ReSize IMG

Magisk Mount , UnMount & ReSize IMG
This is Magisk Mount , UnMount & ReSize IMG ZIP for Users/Developers.
A.K.A. "M2RI" in Short For MagiskMountReSizeIMG.
By Dark❶
Profile @ XDA-Developers : Dark❶ .
Profile @ GitHub : Dark❶ .
Magisk Mount & UnMount IMG :-
GitHub Pages Site : Magisk Mount & UnMount IMG
GitHub Repository : MagiskMountUnMountIMG
XDA Developers Topic : [Magisk] Magisk Mount & UnMount IMG
Notes :
Useful for Users/Developers who wants to Edit Magisk IMG.
This script is Depending on "Magisk" Binary File , Will Not work without IT.
Module folder can be [Deleted/Added] to [Remove/Add] a Module.
File can be [Edited/Modified/Deleted/Added] as per Users/Developers wish.
This ZIP Mount's OR UnMount's on Different Condition's :
1. If "magisk.img" is NOT Mount'ed , Then Mount "magisk.img" To "/Magisk" .
2. If "magisk.img" is Mount'ed , Then UnMount "/Magisk" From "magisk.img" .
This ZIP ReSize's on Different Mounting OR UnMounting ReSize Mode Condition's.
Following is the Pseudo Code for Mount & UnMount :
IF [ ReSize Mode Only ] , Then :
Will UnMount Magisk IMG If Mounted. ~ UnMount "/Magisk" ⇏ "magisk.img" .
This ZIP will ReSize Magisk IMG as-per User Requirement.
ELSE-IF [ "magisk.img" is NOT Mount'ed AND Mounting is Allowed ] , Then :
This ZIP will ReSize Magisk IMG as-per User Requirement.
Then , will Mount Magisk IMG. ~ Mount "magisk.img" ➔ "/Magisk" .
ELSE-IF [ "magisk.img" is Mount'ed AND UnMounting is Allowed ] , Then :
This ZIP will UnMount Magisk IMG. ~ UnMount "/Magisk" ⇏ "magisk.img" .
Then , will ReSize Magisk IMG as-per User Requirement.
ELSE , Then :
This ZIP will Do Nothing BUT Print some Sh*t InFo.
Following is the Pseudo Code for ReSize Mode :
CASE "ReSizeMode" IN
0 , Then :
Display InFo of Magisk IMG "magisk.img".
1 , Then :
ReSize** to Default "64MB" OR MoRe Depending on Current Used IMG Size.
2 , Then :
ReSize to *User Specified Size* ,
BUT NOT less than "64MB" OR Current Used IMG Size.
*User Specified Size* Need's to be Positive[+] Only.
3 , Then :
**ReSize** to Current IMG Size + User Specified Size = Total,
BUT *Total* is *NOT* less than "64MB" OR Current Used IMG Size.
*User Specified Size* Can be Positive[+] OR Negative[-].
I have Copied the Code from "magisk-module-template" ZIP by @topjohnwu.
I have Edited some part of the Code to make it work.
I have Added some part of the Code to make it work.
I have Added some Necessary File(s).
I have Removed Un-Necessary part of Code Because It is Either Not Used OR Not Needed.
I have Removed Un-Necessary Directory(s) & File(s) Because It is Either Not Used OR Not Needed.
I have DoNe Some Optimization to code.
Download : MagiskMountReSizeIMG-v2.0.zip
Download History : XDA:DevDB Downloads OR This Post .
...
XDA:DevDB Information
Magisk Mount ReSize IMG, Tool/Utility for all devices (see above for details)
Contributors
Dark❶
Source Code: https://github.com/dark-1/MagiskMountReSizeIMG
Version Information
Status: Stable
Current Stable Version: 2.0.0
Stable Release Date: 2017-10-25
Created 2017-09-19
Last Updated 2017-10-25
Reserved
Reserved
Explanation :
Explanation from "config.sh" :
Code:
###############################################
## Mount / UnMount Switch [..SW] ##
###############################################
#
# To be Set For "MTSW" , "UTSW" & "ROSW". [..SW]
#
# Set to " true " , To Allow Mount / UnMount .
# Set to " false " , To Prevent Mount / UnMount .
#
# Default is " true " , For Both , "MTSW" & "UTSW". [..SW]
# And " false " For "ROSW".
#
###############################################
###############################################
## ReSize Mode [..RSMO] ##
###############################################
#
# To be Set For "MTRSMO" , "UTRSMO" & "RSMO". [..RSMO]
#
# Set to " 0 " , To Display InFo of Magisk IMG "magisk.img".
# Set to " 1 " , To ReSize to Default "64M" OR MoRe Depending on "Current Used Size".
# Set to " 2 " , To ReSize to "User Specified Size".
# Set to " 3 " , To ReSize to "Current IMG Size" + "User Specified Size".
#
# Default is " 0 " , For All , "MTRSMO" , "UTRSMO" & "RSMO". [..RSMO]
#
###############################################
###############################################
## User Specified Size [..RSMB] ##
###############################################
#
# To be Set For "MTRSMB" , "UTRSMB" & "RSMB". [..RSMB]
#
# All Number's Here Should be Multiple of " 4 " AND in MegaBytes[M].
# AND No Need to Specify character " M " OR " MB ", Just a Number.
#
# IF ReSizeMODE is " 2 " ,
# Then "User Specified Size" Should NOT be less-than "64MB" OR "Current Used IMG Size".
# AND "User Specified Size" Need's to be Positive[+] Only.
# No Need to Specify character " + ".
# IF ReSizeMODE is " 3 " ,
# Then "Current IMG Size" + "User Specified Size" = "Total",
# AND "Total" Should NOT be less-than "64MB" OR "Current Used IMG Size".
# "User Specified Size" Can be Positive[+] OR Negative[-],
# Hence Need to Specify character " + " OR " - ".
#
# Default is " 64 " , For All , "MTRSMB" , "UTRSMB" & "RSMB". [..RSMB]
#
###############################################
Example from "config.sh" :
Code:
###############################################
## Example's ##
###############################################
#
# While Mounting , you want the "magisk.img" to be 80MB,
# then "MTRSMO" & "MTRSMB" will be :
# MTRSMO=2
# MTRSMB=80
#
# Now , after Mounting the "magisk.img" ,
# And While UnMounting , you want the "magisk.img" to be Reduced by 12MB [-12MB],
# then "UTRSMO" & "UTRSMB" will be :
# UTRSMO=3
# UTRSMB=-12
#
###############################################
EnJoY ...
Download History :
Download :
v1.0 : MagiskMountReSizeIMG-v1.0.zip
v2.0 : MagiskMountReSizeIMG-v2.0.zip
Changelog
v0.0
- Initialized.
v1.0
- Initial Release.
- Copied the Code.
- Edited some part of the Code.
- Added some part of the Code.
- Added some Necessary File(s).
- Removed Un-Necessary part of Code.
- Removed Un-Necessary Directory(s) & File(s).
v2.0
- Yea! Jump in Version.
- Updated "update-binary".
- Fix a Critical Bug due to Duplicate Code.
- Optimized the Code.
- Added some Checks.
Credit's
Thank's @topjohnwu for Magisk & for the code in "magisk-module-template" , could not have done without it.
Announcement :
This Thread is not Completed , Kindly give Me some Time Slag .....
Thread is now Completed. Thanks for your Patience.
MagiskMountReSizeIMG v2.0
Here is MagiskMountReSizeIMG v2.0 :
- Yea! Jump in Version.
- Fix a Critical Bug due to Duplicate Code.
- Optimized the Code.
- Added some Checks.
Download : MagiskMountReSizeIMG-v2.0.zip
Wouldn't mind a set of usage instructions that are a bit clearer as opposed to being outlined in pseudo-code. What I'm gathering is that you flash to mount/unmount and that image resizing is automated based on your additions/deletions. That sound about right? Is this to be flashed in recovery or via Magisk Manager?
return.of.octobot said:
Wouldn't mind a set of usage instructions that are a bit clearer as opposed to being outlined in pseudo-code. What I'm gathering is that you flash to mount/unmount and that image resizing is automated based on your additions/deletions. That sound about right? Is this to be flashed in recovery or via Magisk Manager?
Click to expand...
Click to collapse
Yea!!!
& Only in Recovery. This is NOT a Module.
Check my 4th Post : https://forum.xda-developers.com/showpost.php?p=73852785&postcount=4
Cleaner Instruction than that ,,,, then I'll need some time.
Best regards. :good:
Dark❶ said:
Yea!!!
& Only in Recovery. This is NOT a Module.
Check my 4th Post : https://forum.xda-developers.com/showpost.php?p=73852785&postcount=4
Cleaner Instruction than that ,,,, then I'll need some time.
Best regards. :good:
Click to expand...
Click to collapse
No, you're right, my issues had less to do with lack of instructions and more to do with the fact that I'm trying to resize magisk.img on a device with A/B partitions. I don't know why it is, but I've tried plethora of resizing methods, as well as modules that should auto-resize but they all fail and I've discovered in the terminal app systemizer thread that there's a commonality of this issue on A/B devices.
Any chance for update, so it'll work with /data/adb/img?
ch3mn3y said:
Any chance for update, so it'll work with /data/adb/img?
Click to expand...
Click to collapse
Yea!!! I'll try , but no ETA.
I don't think it works with Magisk 17...
I get an error Magisk not found... ?
Dante63 said:
I don't think it works with Magisk 17...
I get an error Magisk not found... ?
Click to expand...
Click to collapse
Yea! I'll Update it soon ....
I am busy with other stuff...
Best regards :good:
Dark❶ said:
Yea! I'll Update it soon ....
I am busy with other stuff...
Best regards :good:
Click to expand...
Click to collapse
I'll be fixing myself...
I know what to do... ?
Great job though
Dante63 said:
I'll be fixing myself...
I know what to do... ?
Great job though
Click to expand...
Click to collapse
If you could make a PR , that would be highly appreciated my friend.
Best regards :good:
Dark❶ said:
If you could make a PR , that would be highly appreciated my friend.
Best regards :good:
Click to expand...
Click to collapse
I'm not good with binary I guess...
Since I get error 2...
I only do script...
I added the script in binary "I know it's different" but that's what I know and I simply crossed fingers hoping it's right ?...
I suppose I'll have to wait for you...
Dante63 said:
I'm not good with binary I guess...
Since I get error 2...
I only do script...
I added the script in binary "I know it's different" but that's what I know and I simply crossed fingers hoping it's right ...
I suppose I'll have to wait for you...
Click to expand...
Click to collapse
Hey!
Try this PR : https://github.com/dark-1/MagiskMountReSizeIMG
I have updated my repo , but it's not tested with all conditions yet.
but if you could , give it a try.
Best regards :good:

[ROM] - Universal ROM One UI for any Galaxy A

Universal ROM One UI for any Galaxy A:
Hello guys, this time I bring you something different... it is a zip to convert stock to rom, this project is based on Dynamic Installer.
I am not responsible for damaged phones, install at your own risk.
Dynamic Installer: https://forum.xda-developers.com/t/...1-android-10-or-earlier.4279541/post-85046055
Features:
Spoiler: Features
Working on Snapdragon and Exynos devices
Debloat
Mod flag secure
Mod Outdoor mode
Mod remove permission when installing apps
Mod Theme Store
Vaultkeeper disabled
Proca disabled
Cass disabled
SCS disabled
CSC Features
Floating Features
knox counter at 0 (Samsung Health)
optimizations
Higher audio quality (Disabled DRC, which deeply compresses audio)
Deknoxed full (Including KnoxGuard)
Fix bluetooth pairings loss
and more
Installation:
This zip is meant to install from stock, if you have any problems please send it to me Universal_ROM_v2.x.log and recovery.log too, If it's a problem with the debloat send me too:
/sdcard/blacklist.txt
/Sdcard/packages.txt
Have stock One UI installed
Make a backup of the partitions (optional)
Just flash via recovery (TWRP recommended)
Format data
Reboot system
Downloads:
Version 2.1.1:
MD5: aa4e1555a5911b38687acd87568ce0af
AndroidFileHost: Download
Version 2.1.2:
MD5: 70607d913bd219018bea53321be43c5c
AndroidFileHost: Download
Version 2.1.3:
MD5: 4c24c7c2a0c22eb3678af6664ae02108
AndroidFileHost: Download
Version 2.1.4:
MD5: 83c658902ef14b675da9c61223fcca88
AndroidFileHost: Download
Version 2.1.5:
MD5: 8a91a604a7a3079571e7d25d93f8c38a
AndroidFileHost: Download
Version 2.2:
MD5: c4b8a62e229733b47ab73206e773ca36
AndroidFileHost: Download
Version 2.2.1:
MD5: 98696b8a42b7c02880891ec60c783c34
AndroidFileHost: Download
Version 2.2.1-b:
MD5: dbe0fd10d866ca8e2839de72cb7c1629
AndroidFileHost: Download
Credits:
@Gollo99 - Help and tips
@Nico04 - Help and tips
@3arthur6 - Fixed bluetooth pairing
@ShaDisNX255 - Mods
@BlassGO - Dynamic installer.
Thanks to all the users who tested
Paypal: Paypal.me ...
if you want to support the project
Telegram:
Channel: t.me/Swx...
XDA: DevDB Information
Universal, ROM for any Samsung Galaxy A
ROM OS Version: Android 11
Based on: ONE UI
Version Information
Status: Stable
Current Stable Versionl: 2.2.1-b
Stable Release Date: 2021-11-30
Edit the zip
Something I like about using this zip is that you can edit it according to your tastes or needs. I will show you how (Dynamic Installer Based Script Codes)
- Debloat:
You just have to add or delete the name of the apks that you want to be deleted during the installation in:
Apk name: "Universal ROM One UI v2.x.zip/META-INF/addons/blacklist.txt"
Apk package name: "Universal ROM One UI v2.x.zip/META-INF/addons/blacklist_packages.txt"
Script code:
Bash:
#Debloat normal
setdefault debloat_paths "
/system/app
/system/priv-app
/product/app
/product/priv-app
"
#Check IF AAPT WORKS
if ! can_run aapt; then
savelog "AAPT: FAIL"
else
savelog "AAPT: WORKS"
fi
#Start
apps=0
bloat=0
delete "$TMP/userlist.txt"
delete "$TMP/packages.txt"
for search in $debloat_paths; do
for userlist in $(find $search -type f -name "*.apk"); do
package=$(apk_package "$userlist")
echo "$userlist" >> "$TMP/userlist.txt"
echo "$(basename "$userlist")=$package" >> "$TMP/packages.txt"
export apps=$(($apps + 1))
done
done
#CAt debloat list
cat "$TMP/userlist.txt" > /sdcard/userlist.txt
cat "$TMP/packages.txt" > /sdcard/packages.txt
#Debloat blacklist.txt
for blacklist in $(cat "$addons/blacklist.txt"); do
black=$(grep -m1 "$blacklist" "$TMP/userlist.txt")
if defined black && exist "$black"; then
delete_recursive "$black"
if ! exist "$black"; then
export bloat=$(($bloat + 1))
package=$(get_file_prop $TMP/packages.txt "$(basename "$black")")
savelog " removed:blacklist:$bloat: package=$package path=$black"
huh=$(string escape "$(basename "$black")")
sed -i "/$huh/d" "$TMP/userlist.txt"
sed -i "/$huh/d" "$TMP/packages.txt"
else
savelog " -- CANT DELETE: $(basename "$black") "
fi
fi
done
#Debloat blacklist_packages.txt
for blackpack in $(cat "$addons/blacklist_packages.txt"); do
black=$(grep -m1 "$blackpack" "$TMP/packages.txt" | cut -d '=' -f1)
[ -z "$black" ] && continue
black=$(grep -m1 "$black" $TMP/userlist.txt)
if defined black && exist "$black"; then
delete_recursive "$black"
if ! exist "$black"; then
export bloat=$(($bloat + 1))
package=$(get_file_prop $TMP/packages.txt "$(basename "$black")")
savelog " removed:blacklist:$bloat: package=$package path=$black"
huh=$(string escape "$(basename "$black")")
sed -i "/$huh/d" "$TMP/userlist.txt"
sed -i "/$huh/d" "$TMP/packages.txt"
else
savelog " -- CANT DELETE: $(basename "$black") "
fi
fi
done
#end of debloat
ui_print " -- Removed $bloat of $apps applications"
- Decode OMC and csc features
Edit the following .xml files which are the features that will be added
cscfeatures.xml: "Universal ROM One UI v2.x.zip/omc/cscfeatures.xml"
cscfeatures_network.xml: "Universal ROM One UI v2.x.zip/omc/cscfeatures_network.xml"
Script code:
Bash:
#OMC
try_mount -e -rw /odm
#Check if dalvikvm work
run_jar_addon omc-decoder.jar > /dev/null || abort " CANT USE: run_jar: dalvikvm not available"
#Getting OMC type
if exist /system_root/optics/configs /system_root/prism/etc; then ported=true
elif exist /optics /prism; then newdevice=true
elif exist "$(find /product -type d -name "omc")" || exist "$(find /odm -type d -name "omc")"; then partdevice=true
elif exist "$(find /system -type d -name "omc")" || exist /system/csc; then olddevice=true
fi
#Getting OMC path
if defined newdevice; then
try_mount -rw -e /optics || abort " CANT MOUNT: /optics "
omc_path=/optics
elif defined partdevice; then
for omc in /product /odm; do
tryomc=$(find "$omc" -type f -name "cscfeature.xml" | head -n1)
if defined tryomc; then
if is_substring "/conf/" "$tryomc"; then
conf=true
omc_path=$(dirname "$(dirname "$(dirname "$tryomc")")")
else
omc_path=$(dirname "$(dirname "$tryomc")")
fi
fi
done
elif defined olddevice; then
if exist /system/csc; then
omc_path=/system/csc
else
tryomc=$(find /system -type f -name "cscfeature.xml" | head -n1)
if defined tryomc; then
omc_path=$(dirname "$(dirname "$tryomc")")
fi
fi
fi
#Decode All cscfeature.xml cscfeature_network.xml
error=0
ui_print " -- Decoding: $omc_path"
while read csc; do
if undefined csc; then abort "CANT FIND VALID PATH"; fi
if ! run_jar_addon omc-decoder.jar -d -i "$csc" -o "$csc"; then echo2 "CANT DECODE: $csc" && error=$(calc $error + 1); fi
done <<< $(find "$omc_path" -type f -name cscfeature.xml -o -name cscfeature_network.xml)
#Check results
if [[ "$error" != "0" ]]; then
abort " -- The installation had: $error ERRORs "
fi
#CSC Features
ui_print " -- Adding csc features... "
package_extract_dir omc "$TMP/omc"
#Get custom cscfeature.xml cscfeature_network.xml
base_csc=$(cat "$TMP/omc/cscfeature.xml")
base_network=$(cat "$TMP/omc/cscfeature_network.xml")
#Editing cscfeature.xml
for csc in $(find $omc_path -type f -name cscfeature.xml); do
content=$(string -f "$csc" extract '<FeatureSet>' '</FeatureSet>')
if defined content; then
replace "$content" "$base_csc" "$csc"
else
echo2 "CANT GET CONTENT: $csc"
fi
done
#Editing cscfeature_network.xml
for csc in $(find $omc_path -type f -name cscfeature_network.xml); do
content=$(string -f "$csc" extract '<FeatureSet>' '</FeatureSet>')
if defined content; then
replace "$content" "$base_network" "$csc"
else
echo2 "CANT GET CONTENT: $csc"
fi
done
#Remove enforcedeletepackage.txt enforceskippingpackages.txt
find $omc_path -type f -name enforcedeletepackage.txt -delete
find $omc_path -type f -name enforceskippingpackages.txt -delete
- Floating Features
Edit the following file to add the features to floating features (It does not matter if the line already exists in the stock file, it will be omitted)
Floating_Features.xml: "Universal ROM One UI v2.x.zip/META-INF/addons/floating.txt"
Script code:
Bash:
#Floating features
ui_print " -- Adding Features... "
update_file_string '<SEC_FLOATING_FEATURE_FRAMEWORK_CONFIG_AOD_ITEM>aodversion=7,clearcoveroff,clocktransition</SEC_FLOATING_FEATURE_FRAMEWORK_CONFIG_AOD_ITEM>' /vendor/etc/floating_feature.xml
force_update_file_addon floating.txt /vendor/etc/floating_feature.xml
- Tweaks build.prop
You can add or remove tweaks in the following files (in the same way as floating, if the line already exists it will be omitted)
/system/build.prop: "Universal ROM One UI v2.x.zip/META-INF/addons/newprops.txt"
/vendor/build.prop: "Universal ROM One UI v2.x.zip/META-INF/addons/vendorprops.txt"
Script code:
Bash:
#Define common files
if exist /system/build.prop; then
system_build="/system/build.prop"
else
abort "FATAL ERROR: Failed to find system partition "
fi
if exist /vendor/build.prop; then
vendor_build="/vendor/build.prop"
else
abort "FATAL ERROR: Failed to find vendor partition "
fi
#build.prop
update_file_string 'ro.build.display.id=Universal ROM One UI v2.2.1-b' $system_build
replace "ro.config.tima=1" "ro.config.tima=0" $system_build
update_file_string 'ro.config.dmverity=false' $system_build
force_update_file_addon newprops.txt $system_build
force_update_file_addon vendorprops.txt $vendor_build
update_file_string 'restore.feature.use_samsung_smart_switch_flow=0' /system/etc/prop.default
- Extra script codes
Flag Secure
Bash:
ui_print " "
ui_print " You want the patch for Flag Secure? "
press
if $yes; then
ui_print " -- Flag secure will be disabled"
flag=true
else
ui_print " -- Flag secure will not be disabled"
fi
#Flag secure
disable='
.locals 1
const/4 v0, 0x0
return v0
'
if defined flag; then
stock_services="/system/framework/services.jar"
mod_services="/system/framework/services.jar"
if ! unzip -l "$stock_services" | grep classes.dex >/dev/null; then
abort " You need a deodexed services.jar"
fi
ui_print " -- Decompiling services.jar... "
apktool -f d "$stock_services" -o "$TMP/services"
ui_print " -- Disabling Flag Secure... "
smali_kit -c -m "isSecureLocked()Z" -re "$disable" -d "$TMP/services"
smali_kit -c -m "preventTakingScreenshotToTargetWindow" -re "$disable" -d "$TMP/services"
ui_print " -- Recompiling services.jar (Please wait)..."
apktool --copy-original -f b "$TMP/services" -o "$mod_services"
if [ ! -e "$mod_services" ]; then
abort " -- Some ERROR occurred during the recompilation of services.jar ! "
elif ! unzip -l "$mod_services" | grep classes.dex >/dev/null; then
abort " -- Invalid file: services.jar "
fi
fi
Outdoor mode
Bash:
ui_print " "
ui_print " -- You want mod of Outdoor mode? "
press
if $yes; then
outdoor=true
ui_print " -- Outdoor mode will be enabled"
else
ui_print " -- Outdoor mod will not apply"
fi
#Outdoor mode
enable='
.locals 1
const/4 v0, 0x1
return v0
'
if defined outdoor; then
ui_print " -- Finding SecSettings.apk"
SecSettings=$(find_apk com.android.settings /system)
if undefined SecSettings; then
abort " CANT FIND: SecSettings.apk"
fi
ui_print " -- Decompiling SecSettings.apk"
dynamic_apktool -decompile "$SecSettings" -output "$TMP/Settings"
ui_print " -- Enabling outdoor mode..."
smali_kit -c -m "isAvailable" -remake "$enable" -dir "$TMP/Settings" -name "SecOutDoorModePreferenceController"
ui_print " -- Recompiling SecSettings.apk (Please wait)..."
dynamic_apktool -preserve-signature -recompile "$TMP/Settings" -output "$SecSettings"
if ! is_valid "$SecSettings"; then
abort "Some error in the SecSettings.apk recompilation"
fi
fi
ThemeCenter Patch
Bash:
ui_print " "
ui_print " -- You want mod of ThemeCenter Patch? "
press
if $yes; then
themes=true
ui_print " -- The mod will be applied"
else
ui_print " -- Mod will not apply"
fi
#ThemesCenter mod
dummy='
.registers 5
return-void
'
if defined themes; then
ui_print " -- Finding ThemeCenter.apk"
ThemesCenter=$(find_apk com.samsung.android.themecenter /system)
if undefined ThemesCenter; then
abort " CANT FIND: ThemesCenter.apk"
fi
ui_print " -- Decompiling ThemeCenter.apk"
dynamic_apktool -decompile "$ThemesCenter" -output "$TMP/Center"
ui_print " -- Patching ThemeCenter.apk..."
smali_kit -c -m "setTrialExpiredPackage" -remake "$dummy" -d "$TMP/Center"
smali_kit -c -m "setAlarm" -remake "$dummy" -d "$TMP/Center"
ui_print " -- Recompiling ThemeCenter.apk (Please wait)..."
dynamic_apktool -preserve-signature -recompile "$TMP/Center" -output "$ThemesCenter"
if ! is_valid "$ThemesCenter"; then
abort "Some error in the ThemesCenter.apk recompilation"
fi
fi
permission when installing apps
Bash:
ui_print " "
ui_print " -- You want remove permission when installing apps? "
press
if $yes; then
permission=true
ui_print " -- The mod will be applied"
else
ui_print " -- Mod will not apply"
fi
#permission when installing apps
disabledd='
.registers 6
invoke-direct {p0}, Lcom/android/packageinstaller/PackageInstallerActivity;->initiateInstall()V
return-void
'
if defined permission; then
ui_print " -- Finding GooglePackageInstaller.apk "
googleinstaller=$(find_apk com.google.android.packageinstaller /system)
if undefined googleinstaller; then
abort " CANT FIND: GooglePackageInstaller.apk"
fi
ui_print " -- Decompiling GooglePackageInstaller.apk"
dynamic_apktool -decompile "$googleinstaller" -output "$TMP/googleinstaller"
ui_print " -- Removing permission when installing apps..."
smali_kit -c -m "checkIfAllowedAndInitiateInstall" -remake "$disabledd" -dir "$TMP/googleinstaller" -name "PackageInstallerActivity"
ui_print " -- Recompiling GooglePackageInstaller.apk (Please wait)..."
dynamic_apktool -preserve-signature -recompile "$TMP/googleinstaller" -output "$googleinstaller"
if ! is_valid "$googleinstaller"; then
abort "Some error in the GooglePackageInstaller.apk recompilation"
fi
fi
fstab file (encryption storage)
Bash:
#fstab
for fstab in $(find /vendor/etc -type f -name "fstab.*"); do
if $(cat "$fstab" | grep -q "encryptable=ice"); then
savelog "device no encrypt"
else
ui_print " -- Patching $fstab... "
replace "fileencryption" "encryptable" $fstab
fi
done
Version 1.1.0:
- Fixed side key option (Bixby removed)
- Added ViperFX and OnePlus Launcher to apps that should not be removed
- Themes mod was added (Apply themes without trial limit)
- DFE was added on installation
- Optimizations
Version 1.1.1:
- Random WIFI MAC address error fixed
- Samsung Max was added to the apps that need to be removed
Version 2.1.1:
- Now works on any Galaxy A device that is Snapdragon or Exynos
- Optimizations added
- Updated the base of Dynamic Installer to version 3.0
- Other changes
Version 2.1.2:
- Fixed some bugs in exynos
- Other small changes
Version 2.1.3:
- Added ripple animation on devices with FOD (optional)
- Fixed option to change clock on devices without always on display
- Corrections in the debloat
Version 2.1.4:
- The following services were disabled: Frp, cass, vaultkeeperd, proca, wsm and encryption [fstab file]
- AirCommand added [SPen feature] (optional)
- Disable DRC audio is now optional
- Removed multidisabler and DFE
- Dynamic Installer base was updated to version 3.2
- Some corrections
Version 2.1.5:
- Fixed creating custom omc on devices with unsupported csc (Csc Features)
- Knox removal improved
- Camera features returns for Galaxy A70 devices
- Debloat was improved for snapdragon devices with dynamic partitions
- Removing some apps like Chrome, Game Launcher, Samsung Free, etc, is now optional (This will only ask if the app exists)
Version 2.2:
- Fixed installation on newer devices like Galaxy A72, A52, etc
- The system should be more stable
- Debloat improvements
- Redesigned debloat code logic
- Now decode the existing cscfeatures.xml and cscfeatures_network.xml during the installation and add the new features in them (before it deleted the existing ones and created a new one)
- The precision of the extra debloat was improved
- Added flag secure mod
- Now the bootanimation will keep the stock
- Will now delete bixby residues
- DeKnox improvements (will now clear knox permissions)
- Now delete permissions of some deleted apps
- Now disable scs service (services disabler)
- Now recovery-from-boot.p is also deleted
- Fixes some file contexts on installation
- AirComand was deleted
- Camera features was deleted from galaxy a70 due to some bugs
- The visual error in the TIMA version was corrected
- Smart switch is disabled in the initial android setup
- Samsung cloud was deleted because if bixby does not work it does not work and is useless
- Now wipe cache and dalvik is automatic at the end of the installation
- Wallpaper was updated
- Dynamic Installer base was updated to version 4.x
- And more
Version 2.2.1:
- Dynamic Installer base was updated to version 4.1-b
- Outdoor mod added
- Added mod of disable permission when installing apps
- Fixed selection to remove Chrome and Google app on devices with dynamic partitions
- VPN networks should work now
- Debloat improvements
- Now a installation log is created in /sdcard/Universal_ROM_v2.1.1.log, if you have any problems please send it to me and recovery.log too, If it's a problem with the debloat send me too:
/sdcard/blacklist.txt
/Sdcard/packages.txt
Version 2.2.1-b:
- Project name change to "Universal ROM One UI"
- Theme Store mod added
Devices tested:
- Galaxy A20
- Galaxy A30
- Galaxy A70
- Galaxy A51
- Galaxy A71
- Galaxy A21s
Please let me know if it works on other devices.
This is modifed original ROM?
oli231 said:
This is modifed original ROM?
Click to expand...
Click to collapse
It is a zip to edit your stock rom or stock base with only flash that you already have installed
Followed your steps and am having a bloat-free experience till now. Samasung health also working. No bugs whatsoever. Excited for future updates. Would really appreciate more development for this device. (A705gm)
Thanks
kirbyNx said:
Universal ROM Galaxy A70:
Hi guys, this time I bring something different... it is a zip to convert stock to a rom, this project is based on Dynamic Installer and SuperR custom zip.
This time it works for all variants of the Galaxy A70 ( SM-: A705FN, A705MN, A705GM, etc...)
I am not responsible for damaged phones, install at your own risk.
FEATURES:
Spoiler: Features
Debloat
Vaultkeeper disabled
Proca disabled
Wsm disabled
Cass disabled
Custom CSC Features
Floating Features
knox counter at 0 (Samsung Health)
optimizations
Higher audio quality (Disabled DRC, which deeply compresses audio)
Deknoxed full (Including KnoxGuard)
Secure Folder working
Multidisabler
Fix bluetooth pairings loss
and more
Installation:
This zip is intended to be installed over stock but if you get bootloop you can use one of the bases where encryption is disabled to allow booting
Just flash via recovery (TWRP recommended)
Format data
Reboot system
Downloads:
Version 1.0.1:
AndroidFileHost: download
Version 1.1.1:
AndroidFileHost: download
Download direct: download
Bases stock:
Extract .7z with an unzip program
Reboot recovery
Full wipes (Cache, Dalvik cache, system, vendor y data)
Install "system.img" as "system" image in TWRP
Install "vendor.img" as "vendor" image in TWRP
Install "boot.img" as "boot" image in TWRP
SM-A705MN: download
SM-A705FN: download
SM-A705GM: download
Credits:
@Gollo99 - Help and suggestions
@SuperR. - kitchen SuperR to make the zip
@Nico04 - Help and suggestions
@3arthur6 - Fixed bluetooth pairing
@BlassGO - Mods, secure folder, Dynamic Installer.
@itz_rogue_77 - Help, suggestions, and more
@ Samsung - FIrmware
Samsung Open Source
opensource.samsung.com
BTC: bc1qqtg3pgxkhm7egmh35qnsq8xmnjjte6zeyz8s30
Paypal: Paypal.me...
if you want to support the project
XDA: DevDB Information
Universal, ROM for the Samsung Galaxy A70
ROM OS Version: Android 11
Based On: ONE UI
Version Information
Status: Stable
Current Stable Version: 1.1.0
Stable Release Date: 2021-07-18
Click to expand...
Click to collapse
Al flashear el archivo pierde la aleatorizacion de Mac address y muestra la del dispositivo, puede solucionar eso por favor? . Mac Rndomization es muy importante para la privacidad
When flashing the file loses the Mac address randomization and shows that of the device, can you fix that please? . Mac Rndomization is very important for privacy
javierami said:
Al flashear el archivo pierde la aleatorizacion de Mac address y muestra la del dispositivo, puede solucionar eso por favor? . Mac Rndomization es muy importante para la privacidad
When flashing the file loses the Mac address randomization and shows that of the device, can you fix that please? . Mac Rndomization is very important for privacy
Click to expand...
Click to collapse
Logs please...
logs mac randomization not work
javierami said:
logs mac randomization not work
Click to expand...
Click to collapse
Ok, I have fixed it, I will update Universal ROM later
javierami said:
logs mac randomization not work
Click to expand...
Click to collapse
Meanwhile, you can fix it with just flash this file
after installing rom it goes in downoald mode
what are the differences between this and swx rom?
Awesome software and all working like it should GZ!!
One question, does this method remove TWRP? I cant enter it somehow. What are the keys to press? I watched youtube and none work...
rolarocka said:
Awesome software and all working like it should GZ!!
One question, does this method remove TWRP? I cant enter it somehow. What are the keys to press? I watched youtube and none work...
Click to expand...
Click to collapse
I think you can Access twrp if your phone connected to cable and use combination (up+power) then release
Second if you have root access you can use magisk manager or any boot app to enter twrp
Kraitos said:
I think you can Access twrp if your phone connected to cable and use combination (up+power) then release
Second if you have root access you can use magisk manager or any boot app to enter twrp
Click to expand...
Click to collapse
True, didn't know they changed that and made it annoying
Flash this file, and you will be able to turn on TWRP mode without connecting the power cord
kissa67zwi said:
Flash this file, and you will be able to turn on TWRP mode without connecting the power cord
Click to expand...
Click to collapse
Tyvm
kissa67zwi said:
Flash this file, and you will be able to turn on TWRP mode without connecting the power cord
Click to expand...
Click to collapse
Flash it how. i tried with twrp and it tells me i need magisk to use that file.
WharfRat4 said:
Flash it how. i tried with twrp and it tells me i need magisk to use that file.
Click to expand...
Click to collapse
After flashing magisk this file works

How To Guide Some hints for using Magisk on Android phones

In this post I summarize everything I found out about using Magisk (https://topjohnwu.github.io/Magisk) until now. A lot of the infos in this post are already in my other posts in this board but hopefully this summary is useful anyway.
My main purpose is to configure Magisk as much as possible via scripts so this tutorial is mostly about using Magisk via CLI commands in an adb shell or from within scripts.
Please note that I mirror all my HowTos for Android on my web page:
http://bnsmb.de/My_HowTos_for_Android.html
I will update this post when I found something new and interesting. A history of changes in this post is at the end of the post.
PreRequisites
Most of the instructions below need an enabled adb access for the phone and root permissions for the adb shell. In addition, a working Recovery image that is able to mount the /data partition (like for example TWRP) is strongly recommended before starting to play with Magisk.
The Magisk version used for this tutorial is Magisk 25.1 and Magisk 25.2; the ROM used was OmniROM (Android 12 based).
The phone used was an ASUS Zenfone 8 but the instructions should work on other phones also.
Installation
Magisk consists out of two parts:
The Magisk App and the Magisk files in the boot partition. Without the files in the boot partition Magisk can do more or less nothing.
The Magisk App can be installed using the standard Android tools for installing apps.
The installation of the Magisk files into the boot partition can then be done using the Magisk App.
The official instructions to install Magisk into the boot partition are here:
https://topjohnwu.github.io/Magisk/install.html
Magisk can also be installed via script without user intervention into the boot partition -- see How to install Magisk into the boot partition using a script
Update 18.04.2023/bs
see How to install Magisk v26.0 or newer via script for how to install Magisk v26 via script
Note that the Magisk files for the boot partition must be reinstalled after an OS upgrade but this can be done from within the Magisk App.
Uninstalling Magisk
Use the Button "Uninstall Magisk" in the Magisk App to uninstall Magisk.
The Magisk App can also remove the Magisk files from the boot partition.
To uninstall the Magisk App only via script do
Bash:
adb shell pm uninstall com.topjohnwu.magisk
To remove Magisk from the boot partition manually I suggest to flash the image of the original boot partition.
Installing Magisk Modules
Magisk Modules are extensions for Magisk to for example replace or add files to /system (and much more ... I suggest to study the documentation for Magisk for those that are interested in using Magisk)
Magisk Modules are distributed via ZIP files.
As of Magisk v25 or newer the official method to install Magisk Modules is to manually copy the ZIP file with the Magisk Module to the phone and then use the button "Install from storage" in the "Modules" sub menu in the Magisk App.
In previous versions of Magisk a Module browser to list and install Magisk Modules was part of the Magisk App but unfortunately the developer dropped that feature. Therefor you must search and download the available Magisk Modules using a browser on the phone or a PC.
Repositories with Magisk Modules are for example:
https://github.com/Magisk-Modules-Repo/
and
https://github.com/Magisk-Modules-Alt-Repo
A XDA thread about Magisk Modules (including a list of Magisk Modules) is here:
https://forum.xda-developers.com/t/collection-of-magisk-modules-v2.3575758/
There is now a new App for Android called "Fox's Magisk Module Manager" that can be used to list and download Magisk Modules to the phone (see https://github.com/Fox2Code/FoxMagiskModuleManager).
It's also possible to install a Magisk Module via script. The commands to install an Magisk Module via script are:
Bash:
# copy the Magisk Module to the phone
adb push /data/backup/Android/MagiskModules/Nano_for_Android_NDK-6_3-6300.zip /sdcard/Download/
# install the Module
#
# Note:
#
# The command can also be executed in a script runnning on the phone (without "adb shell")
#
adb shell magisk --install-module /sdcard/Download/Nano_for_Android_NDK-6_3-6300.zip
# reboot the phone
adb reboot
Example:
Code:
[[email protected] ~]$ adb push /data/backup/Android/MagiskModules/Nano_for_Android_NDK-6_3-6300.zip /sdcard/Download/
/data/backup/Android/MagiskModules/Nano_for_Android_NDK-6_3-6300.zip: 1 file pushed, 0 skipped. 37.6 MB/s (380554 bytes in 0.010s)
[[email protected] ~]$ adb shell magisk --install-module /sdcard/Download/Nano_for_Android_NDK-6_3-6300.zip
- Current boot slot: _a
- Device is system-as-root
*****************************
Nano for Android NDK
by osm0sis @ xda-developers
*****************************
*******************
Powered by Magisk
*******************
Archive: /storage/emulated/0/Download/Nano_for_Android_NDK-6_3-6300.zip
inflating: diffusion_config.sh
inflating: module.prop
Mounting...
Extracting files...
Archive: /storage/emulated/0/Download/Nano_for_Android_NDK-6_3-6300.zip
inflating: META-INF/com/google/android/updater-script
inflating: META-INF/com/google/android/update-binary
inflating: sbin/nano
...
inflating: etc/terminfo/l/linux
inflating: customize.sh
inflating: update.json
inflating: bin/nano
inflating: bin/nano.bin
inflating: README.md
inflating: diffusion_config.sh
inflating: module.prop
Installing...
Installing nano to /data/adb/modules_update/nano-ndk/system/bin ...
Installing terminfo to /data/adb/modules_update/nano-ndk/system/etc ...
Unmounting...
Done!
[[email protected] ~]$ adb reboot
[[email protected] ~]$
Uninstalling a Magisk Module
Magisk Modules should be uninstalled via Magisk App if possible because there is no parameter for the magisk binary to uninstall a Magisk Module.
To force Magisk via shell command to remove the module after the next reboot create the file
remove
in the module directory.
If uninstalling the Magisk Module via Magisk does not work or if you want to uninstall a Magisk Module via script you can just delete the directory for the Magisk Module in /data/adb/modules and reboot the phone. This can be done in an adb shell or if that does not work anymore after rebooting the phone from a Recovery Image like TWRP, e.g.
Bash:
# uninstall the module "dummy_module" via adb shell commands
#
# check for an uninstall script for this module
#
if [ -x /data/adb/modules/dummy_module/uninstall.sh ] ; then
echo "Executing the module uninstall script ...."
/data/adb/modules/dummy_module/uninstall.sh
fi
adb shell rm -rf /data/adb/modules/dummy_module/
adb reboot
Note:
You should reboot the phone immediately after removing the directory with the Module.
This method is not really recommended.
List all installed Magisk Modules
The Magisk App will list all installed Magisk Modules
To list the installed Magisk Modules via CLI command use either
Bash:
adb shell ls -d /data/adb/modules/* | cut -f5 -d "/"
e.g.
Code:
[[email protected] ~]$ adb shell ls -d /data/adb/modules/* | cut -f5 -d "/"
PlayStore_for_MicroG
ccbins
dummy_module
initshell
nano-ndk
terminalmods
[[email protected] ~]$
# or
[[email protected] /]$ for i in $( adb shell su - -c ls -d /data/adb/modules/* ); do printf "%-30s %s\n" "${i##*/}" "$( adb shell su - -c grep name= $i/module.prop 2>/dev/null | cut -f2 -d "=" | tr -s " " )" ; done
MiXplorer MiXplorer
PlayStore_for_MicroG Patched Playstore from NanoDroid for MicroG (for ARM64 CPUs only)
ccbins Cross Compiled Binaries
dummy_module Dummy Module for testing a new module
initshell Create writable config files (/etc/profile) for sh
nano-ndk Nano for Android NDK
terminalmods Terminal Modifications
[[email protected] /]$
or on the phone:
Code:
[email protected]_I006D:/ # echo; for i in /data/adb/modules/*; do printf "%-30s %s\n" "${i##*/}" "$( grep name= $i/module.prop 2>/dev/null | cut -f2 -d "=" | tr -s " " )" ; done
PlayStore_for_MicroG Patched Playstore from NanoDroid for MicroG (for ARM64 CPUs only)
ccbins Cross Compiled Binaries
dummy_module
initshell Create writable config files (/etc/profile) for sh
nano-ndk Nano for Android NDK
terminalmods Terminal Modifications
[email protected]_I006D:/ #
How to disable a Magisk Module
To disable a Magisk Module via script create a file called disable in the Module directory, e.g.:
Bash:
touch /data/adb/modules/dummy_module/disable
The Magisk Module will then be disabled after the next reboot.
To re-enable the Magisk Module just delete the file disable in the Module directory and reboot the phone.
To list all disabled Magisk Modules do
Bash:
adb shell ls /data/adb/modules/*/disable | cut -f5 -d "/"
Replacing files in /system using a Dummy Magisk Module
One feature of Magisk Modules is the possibility to change files in the sub directories in the directory /system or also add new files to the sub directories in the directory /system. /system is mounted read-only and in the current Android version it is not possible to remount /system read-write anymore so without Magisk it's very difficult to change files in /system.
Please note that you can not create new files or directories in the directory /system using this Magisk feature.
To test this feature you do not need to create a Magisk Module : It's sufficient to simulate a Magisk Module.
For that just create the necessary directory structure and files manually.
Magisk Modules are are installed in the directory /data/adb/modules. Each Magisk Module use an uniqe sub directory in that directory. To simulate a Magisk Module open an adb shell as user root and create the directories for your Dummy Magisk Module, e.g.:
Bash:
mkdir /data/adb/modules/dummy_module
# Next create the sub directory system in that new directory
mkdir /data/adb/modules/dummy_module/system
Now copy the files for /system to that directory: The files in that directory will overwrite existing files in /system after the next reboot. Files in that directory that not already exist in /system will be created in /system.
e.g.
Code:
# contents of my Dummy Magisk Module
#
[email protected]_I006D:/data/adb/modules/dummy_module/system # pwd
/data/adb/modules/dummy_module/system
[email protected]_I006D:/data/adb/modules/dummy_module/system # find .
.
./bin
./bin/my_new_binary
./etc
./etc/my_new_file_for_systme
[email protected]_I006D:/data/adb/modules/dummy_module/system #
After rebooting the phone the files are visible in /system:
Code:
[email protected]_I006D:/ # ls -l /system/etc/my_new_file_for_systme
-rw-rw-rw- 1 root root 20 2022-07-20 16:55 /system/etc/my_new_file_for_systme
[email protected]_I006D:/ # cat /system/etc/my_new_file_for_systme
This is my new file
[email protected]_I006D:/ #
[email protected]_I006D:/ # ls -l /system/bin/my_new_binary
-rwxr-xr-x 1 root root 41 2022-07-20 16:57 /system/bin/my_new_binary
[email protected]_I006D:/ # my_new_binary
Hello world from my dummy binary
[email protected]_I006D:/ #
The permissions for the new files in /system are equal to the permissions of the original files in
/data/adb/modules/dummy_module so if the original files are writable you can also edit the new files in /system, e.g
Code:
[email protected]_I006D:/ # cat /system/etc/my_new_file_for_systme
This is my new file
[email protected]_I006D:/ #
[email protected]_I006D:/ # echo "Test Test" >> /system/etc/my_new_file_for_systme
[email protected]_I006D:/ # cat /system/etc/my_new_file_for_systme
This is my new file
Test Test
[email protected]_I006D:/ #
These changes are persistent (because they change the original file in /data/adb/modules/<modulename>). You can also edit the files in /data/adb/modules/<modulename> but be aware that you can not use tools that create temporary files for changing the files like for example sed: Changes done with these kind of tools are only visible after a reboot of the phone.
To change the file via script I recommend to create a new file and then replace the existing file with the new file using cp.
This Magisk feature can also be used to make files in sub directories in /system writable -- see How to make files in system writable for detailed instructions.
Make sure that the new files for /system are readable for the user using them; e.g some files (like for example apk files) are used by the user system). IMHO it's recommended to add the read permission (chmod o+r) to all new files for /system.
Notes:
Magisk does not really change the files in /system - instead it uses "bind mounts" to replace the files with others. Therefor you can always restore the original files by deleting the files in /data/adb/modules/<module_name> and rebooting the phone. Another big advantage of this technique is that you do not have to take care about an update of the OS:
changes done via Magisk will also work after an OS upgrade (assuming you reinstalled Magisk to the boot partition after installing the OS update)
Please be careful when changing existing files in /system.
To add the necessary infos for the Magisk App to list your dummy module properly just create the file module.prop for your Dummy Magisk Module, e.g.
Code:
[email protected]_I006D:/ # cat /data/adb/modules/dummy_module/module.prop
id=dummy-module
name=Dummy Module for testing a new module
version=1.0
versionCode=1000
[email protected]
description=Dummy Module ..
[email protected]_I006D:/ #
For some examples for this technique see
How to change files in the directory /system with Magisk
How to replace the Fake Store from OmniROM with MicroG with a patched Playstore
How to change the home directory for the user root on an Android phone
How to use this technique to disable an app that can not be uninstalled
Apps that can not be uninstalled can be disabled by creating empty files for the app.
Example:
My Magisk Module for the patched Playstore must disable the FakeStore installed in the OmniROM with MicroG by default.
That's done by creating an empty file in the Magisk Module for the apk file for the FakeStore, the result looks like this:
Code:
[email protected]_I006D:/ # ls -l /data/adb/modules/PlayStore_for_MicroG/system/priv-app/FakeStore/FakeStore.apk
-rw-r--r-- 1 root root 1 2022-07-15 11:54 /data/adb/modules/PlayStore_for_MicroG/system/priv-app/FakeStore/FakeStore.apk
[email protected]_I006D:/ #
[email protected]_I006D:/ # ls -l /system/priv-app/FakeStore/FakeStore.apk
-rw-r--r-- 1 root root 1 2022-07-15 11:54 /system/priv-app/FakeStore/FakeStore.apk
[email protected]_I006D:/ #
In case there are multiple files in the folder for the app you can also hide the entire folder:
From the original documentation from https://topjohnwu.github.io/Magisk/guides.html:
If you place a file named .replace in any of the folders, instead of merging its contents, that folder will directly replace the one in the real system. This can be very handy for swapping out an entire folder.
Click to expand...
Click to collapse
How to access the files replaced by Magisk
Use another bind mount to access the files replaced by Magisk, e.g:
Code:
[email protected]_I006D:/ # head /data/adb/modules/fmradio/system/etc/public.libraries.txt
# See https://android.googlesource.com/platform/ndk/+/master/docs/PlatformApis.md
#
# 04.08.2022 /bs
# added the library libqcomfm_jni.so
#
libandroid.so
libaaudio.so
libamidi.so
libbinder_ndk.so
libc.so
[email protected]_I006D:/ #
[email protected]_I006D:/ #
[email protected]_I006D:/ # head /system/etc/public.libraries.txt
# See https://android.googlesource.com/platform/ndk/+/master/docs/PlatformApis.md
#
# 04.08.2022 /bs
# added the library libqcomfm_jni.so
#
libandroid.so
libaaudio.so
libamidi.so
libbinder_ndk.so
libc.so
[email protected]_I006D:/ #
# -> The file /system/etc/public.libraries.txt is replaced by a file from a Magisk Module
# To access the original version of the file /system/etc/public.libraries.txt do
[email protected]_I006D:/ #
[email protected]_I006D:/ # mkdir -p /data/test
[email protected]_I006D:/ #
[email protected]_I006D:/ # mount -o bind /system /data/test
#
# -> /data/test is now bind mounted to /system
#
# -> /data/test/etc/public.libraries.txt is the original version of that file:
#
[email protected]_I006D:/ #
[email protected]_I006D:/ # head /data/test/etc/public.libraries.txt
# See https://android.googlesource.com/platform/ndk/+/master/docs/PlatformApis.md
libandroid.so
libaaudio.so
libamidi.so
libbinder_ndk.so
libc.so
libcamera2ndk.so
libdl.so
libEGL.so
libGLESv1_CM.so
[email protected]_I006D:/ #
Replacing files in /vendor, /product, or /system_ext using a Dummy Magisk Module
The dummy Magisk Module can also be used to replace files in the directories /vendor, /product, or /system_ext:
from the Magisk documentation at https://topjohnwu.github.io/Magisk/guides.html:
If you want to replace files in /vendor, /product, or /system_ext, please place them under system/vendor, system/product, and system/system_ext respectively. Magisk will transparently handle whether these partitions are in a separate partition or not.
Click to expand...
Click to collapse
Note that this works only to replace existing files in these directories - you can not add new files to these directories using this method.
Example:
Code:
[email protected]_I006D:/ # cd /data/adb/modules/dummy_module/system
#
# files in the Magisk Module
#
[email protected]_I006D:/data/adb/modules/dummy_module/system # find . -type f
./bin/my_new_binary
./etc/my_new_file_for_systme
./product/mynewfile
./product/media/audio/alarms/Krypton.ogg
./vendor/mynewfile
./vendor/etc/sap.conf
./system_ext/mynewfile
./system_ext/etc/dpm/dpm.conf
[email protected]_I006D:/data/adb/modules/dummy_module/system #
#
# the new files for /product, /vendor, and /system_ext in the Magisk Module do not exist:
#
[email protected]_I006D:/data/adb/modules/dummy_module/system # ls -l /product/mynewfile /vendor/mynewfile /system_ext/mynewfile
ls: /product/mynewfile: No such file or directory
ls: /vendor/mynewfile: No such file or directory
ls: /system_ext/mynewfile: No such file or directory
#
# The existing files in /product, /vendor, and /system_ext are replaced with the files from the Magisk Moduel
#
[email protected]_I006D:/data/adb/modules/dummy_module/system # cksum ./product/media/audio/alarms/Krypton.ogg /product/media/audio/alarms/Krypton.ogg
4294967295 0 ./product/media/audio/alarms/Krypton.ogg
4294967295 0 /product/media/audio/alarms/Krypton.ogg
[email protected]_I006D:/data/adb/modules/dummy_module/system #
[email protected]_I006D:/data/adb/modules/dummy_module/system # cksum ./vendor/etc/sap.conf /vendor/etc/sap.conf
1967598015 7121 ./vendor/etc/sap.conf
1967598015 7121 /vendor/etc/sap.conf
[email protected]_I006D:/data/adb/modules/dummy_module/system #
[email protected]_I006D:/data/adb/modules/dummy_module/system # cksum ./system_ext/etc/dpm/dpm.conf /system_ext/etc/dpm/dpm.conf
1970692378 2925 ./system_ext/etc/dpm/dpm.conf
1970692378 2925 /system_ext/etc/dpm/dpm.conf
[email protected]_I006D:/data/adb/modules/dummy_module/system #
[email protected]_I006D:/data/adb/modules/dummy_module/system # grep mynewfile /cache/magisk.log
01-01 00:11:51.764 767 769 W : Unable to add: /product/mynewfile, skipped
01-01 00:11:51.771 767 769 W : Unable to add: /system_ext/mynewfile, skipped
01-01 00:11:51.771 767 769 W : Unable to add: /vendor/mynewfile, skipped
[email protected]_I006D:/data/adb/modules/dummy_module/system #
A work around to create new files in sub directories in /product, /vendor, or /system_ext:
Copy the complete existing folder to the sub directory in
/data/adb/modules/<magisk_module>/system/[product|vendor|system_ext]/
and create the file .replace in that directory and add the new file(s) to that directory.
Example:
Code:
[email protected]_I006D:/ # find /data/adb/modules/testmodule/
/data/adb/modules/testmodule/
/data/adb/modules/testmodule/system
/data/adb/modules/testmodule/system/product
/data/adb/modules/testmodule/system/product/lib
/data/adb/modules/testmodule/system/product/lib/.replace
/data/adb/modules/testmodule/system/product/lib/libframesequence.so
/data/adb/modules/testmodule/system/product/lib/libgiftranscode.so
/data/adb/modules/testmodule/system/product/lib/newfile001
/data/adb/modules/testmodule/system/vendor
/data/adb/modules/testmodule/system/vendor/app
/data/adb/modules/testmodule/system/vendor/app/TimeService
/data/adb/modules/testmodule/system/vendor/app/TimeService/TimeService.apk
/data/adb/modules/testmodule/system/vendor/app/TimeService/oat
/data/adb/modules/testmodule/system/vendor/app/TimeService/oat/arm64
/data/adb/modules/testmodule/system/vendor/app/TimeService/oat/arm64/TimeService.vdex
/data/adb/modules/testmodule/system/vendor/app/TimeService/oat/arm64/TimeService.odex
/data/adb/modules/testmodule/system/vendor/app/TimeService/newfile002
/data/adb/modules/testmodule/system/vendor/app/TimeService/.replace
/data/adb/modules/testmodule/system/system_ext
/data/adb/modules/testmodule/system/system_ext/app
/data/adb/modules/testmodule/system/system_ext/app/FM2
/data/adb/modules/testmodule/system/system_ext/app/FM2/.replace
/data/adb/modules/testmodule/system/system_ext/app/FM2/FM2.apk
/data/adb/modules/testmodule/system/system_ext/app/FM2/lib
/data/adb/modules/testmodule/system/system_ext/app/FM2/lib/arm64
/data/adb/modules/testmodule/system/system_ext/app/FM2/lib/arm64/libqcomfm_jni.so
/data/adb/modules/testmodule/system/system_ext/app/FM2/oat
/data/adb/modules/testmodule/system/system_ext/app/FM2/oat/arm64
/data/adb/modules/testmodule/system/system_ext/app/FM2/oat/arm64/FM2.odex
/data/adb/modules/testmodule/system/system_ext/app/FM2/oat/arm64/FM2.vdex
/data/adb/modules/testmodule/system/system_ext/app/FM2/newfile003
[email protected]_I006D:/ #
[email protected]_I006D:/ # find /data/adb/modules/testmodule/system | grep newfile
/data/adb/modules/testmodule/system/product/lib/newfile001
/data/adb/modules/testmodule/system/vendor/app/TimeService/newfile002
/data/adb/modules/testmodule/system/system_ext/app/FM2/newfile003
[email protected]_I006D:/ #
[email protected]_I006D:/ # pwd
/
[email protected]_I006D:/ # ls -l $( find /data/adb/modules/testmodule/system | grep newfile | cut -f6- -d "/" )
-rw-r--r-- 1 root root 0 2022-08-07 14:34 system/product/lib/newfile001
-rw-r--r-- 1 root root 0 2022-08-07 14:24 system/system_ext/app/FM2/newfile003
-rw-r--r-- 1 root root 0 2022-08-07 14:36 system/vendor/app/TimeService/newfile002
[email protected]_I006D:/ #
See How to change any file or directory using Magisk for another approach to change files on read-only mounted filesystems.
Executing scripts while booting the phone
Magisk also supports executing additional scripts while booting the phone.
The scripts to be executed must be copied to one of these directories
/data/adb/post-fs-data.d/
/data/adb/service.d/
see the description in the original Magisk documentation: https://topjohnwu.github.io/Magisk/details.html
Working examples for this technique are described in these posts:
How to run a script atevery boot using Magisk
How to disable or change the swap device in the Android 12 from ASUS for the Zenfone 8
How to create or change a swap device in the OmniROM 12 using Magisk
Another example for using this technique I found here
https://gist.github.com/niikoo/3f6bd13a69f2d68f3dd51cc667e79bdc :
Bash:
# Boot logging
# Create the file: /data/adb/post-fs-data.d/0001logcatboot
#!/system/bin/sh
mkdir -p /cache/logs
/system/bin/logcat -r 1024 -n 9 -v threadTime -f /cache/logs/log >info.log 2>err.log &
Note that I added commands to create / cleanup the log directory and changed the logcat command on my phone:
Bash:
#!/system/bin/sh
mkdir -p /cache/logs
rm -rf /cache/logs/*
/system/bin/logcat -r 102400 -n 9 -v threadTime -f /cache/logs/log >/cache/logs/info.log 2>/cache/logs/err.log &
To execute additional scripts earlier in the boot process you must add them to the boot image -- see the section Using Magisk to unpack and repack the boot image below for details.
Creating Magisk Modules
The official documentation for creating a Magisk Module is here: https://topjohnwu.github.io/Magisk/guides.html
Creating Magisk Modules that only use the standard features isn't that difficult and the official documentation should be sufficient.
I suggest to download an existing simple Magisk Module; unzip the ZIP file and study the contents.
Using Magisk to unpack and repack the boot image
The binary magiskboot that is part of the Magisk package can be used to unpack and repack the boot partition for every phone supported by Magisk.
For details see here: How to change files in the boot image using Magisk
Magisk also supports changing files in the root directory via Root Directory Overlays (see https://github.com/topjohnwu/Magisk/blob/master/docs/guides.md) :
This feature can be used to create additional start or stop services for the Android OS:
Android uses init *rc files to define the services to start when booting and also to define the services to run when doing the shutdown (like the systemd or initd in other Linux implementations).
These files are read early in the boot process and therefore reside only in the ramdisk on the boot partition. To add new init* rc files the boot image must be modified. This can be done with Magisk:
Just add the new init*rc files and optimal other scripts or files to the boot image using Magisk . Magisk will then take care of processing the new init*rc files by the Android operating system when booting the phone.
See these posts:
How to run a script at shutdown
How to trigger an action when a property is changed
How to enable root access using Magisk in a script
for examples for using that feature.
There are also magiskboot binaries for x86 in the Magisk apk file that can be used on a PC running the Linux OS:
see How to process Android boot image files on a PC running the Linux OS for more details about this feature.
Using Magisk to change the active slot
The Magisk App can also be used to change the active slot on phones with A/B slots -- for details see here :
How to manually switch the active slot
Directories and files used by Magisk
The directories and files used by Magisk are documented here https://topjohnwu.github.io/Magisk/guides.html
Some important directories and files for developing and trouble shooting Magisk Modules are:
The logfile used by Magisk is
/cache/magisk.log
In case something goes wrong with a Magisk Module you should first check that file.
The base directory for the data files for Magisk is
/data/adb
The config setttings for Magisk are stored in the SQLite database
/data/adb/magisk.db
To view (or probably) change the database entries via script you can either use sqlite3 binary (if installed)
Code:
ASUS_I006D:/ # sqlite3 /data/adb/magisk.db
SQLite version 3.7.6.3-Titanium
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .headers on
sqlite> .mode column
sqlite>
sqlite> .tables
denylist policies settings strings
sqlite>
sqlite> .schema
CREATE TABLE denylist (package_name TEXT, process TEXT, PRIMARY KEY(package_name, process));
CREATE TABLE policies (uid INT, policy INT, until INT, logging INT, notification INT, PRIMARY KEY(uid));
CREATE TABLE settings (key TEXT, value INT, PRIMARY KEY(key));
CREATE TABLE strings (key TEXT, value TEXT, PRIMARY KEY(key));
sqlite>
sqlite> select * from denylist ;
sqlite>
sqlite> select * from policies ;
uid policy until logging notification
---------- ---------- ---------- ---------- ------------
2000 2 0 1 1
10134 1 0 1 1
sqlite>
sqlite> select * from settings ;
key value
---------- ----------
denylist 0
su_biometr 0
sqlite>
sqlite> select * from strings ;
sqlite>
or the magisk binary, e.g:
Code:
ASUS_I006D:/ # magisk --sqlite 'select * from policies'
logging=1|notification=1|policy=2|uid=2000|until=0
ASUS_I006D:/ #
ASUS_I006D:/ # magisk --sqlite 'select * from settings'
key=denylist|value=0
key=su_biometric|value=0
ASUS_I006D:/ #
There is a handy little script to list all apps with root access in the XDA thread https://forum.xda-developers.com/t/magisk-general-support-discussion.3432382/page-2681 .
How to create the Magisk database manually
To create the Magisk database manually (e.g. after installing Magisk manually via script) these commands can be used:
Bash:
# start the Magisk daemon if necessary
#
MAGISK_DAEMON_IS_RUNNING=true
/data/adb/magisk/magisk64 -v || /data/adb/magisk/magisk64 --daemon && MAGISK_DAEMON_IS_RUNNING=false
#
# force Magisk to create the Magisk database if it not yet exists
#
/data/adb/magisk/magisk64 --sqlite "PRAGMA user_version"
# stop the Magisk daemon again
#
[ ${MAGISK_DAEMON_IS_RUNNING} = false ] && /data/adb/magisk/magisk64 --stop
To create the Magisk database using sqlite3 use these commands:
SQL:
.open ${CUR_MAGISK_DATABASE_FILE}
CREATE TABLE IF NOT EXISTS policies (uid INT, policy INT, until INT, logging INT,notification INT, PRIMARY KEY(uid));
CREATE TABLE IF NOT EXISTS settings (key TEXT, value INT, PRIMARY KEY(key));
CREATE TABLE IF NOT EXISTS strings (key TEXT, value TEXT, PRIMARY KEY(key));
CREATE TABLE IF NOT EXISTS denylist (package_name TEXT, process TEXT, PRIMARY KEY(package_name, process));
PRAGMA user_version=6;
.exit
Note:
The Magisk database will be upgraded to the latest version automatically by the Magisk daemon after the next restart
Magisk root access configuration details
Magisk uses the table policies in the sqlite database /data/adb/magisk.db to store the list of root enabled apps.
See this post https://forum.xda-developers.com/t/how-to-enable-root-access-using-magisk-in-a-script.4527035/ for details about this feature and how to enable root access via Magisk using a script.
Magisk App installation directory
Use
Bash:
pm list packages -f | grep magisk
to get the Magisk App installation directory.
Credits: https://forum.xda-developers.com/t/magisk-general-support-discussion.3432382/page-2689#post-87694851
The Magisk App Configuration files
The Magisk App stores the configuration (e.g. the app settings) in the default directory for App Settings, on my phone this is
/data/user_de/0/com.topjohnwu.magisk/shared_prefs
The file in that directory used to store the settings is
com.topjohnwu.magisk_preferences.xml
For more details about the file see the post Where does the Magisk App store the settings?.
Temporary Magisk config directory
While running Magisk uses a temporary directory for the configuration.
The path to the config directory can be retrieved via magisk binary:
Code:
ASUS_I006D:/dev/hP3B # magisk --path
/dev/hP3B
ASUS_I006D:/dev/hP3B#
The contents of that directory look like :
Code:
ASUS_I006D:/dev/hP3B # ls -al /dev/hP3B/
total 568
drwx------ 3 root root 200 1970-01-01 04:08 .
drwxr-xr-x 27 root root 5480 2022-11-06 18:32 ..
drwxr-xr-x 8 root root 180 1970-01-01 04:08 .magisk
lrwxrwxrwx 1 root root 10 1970-01-01 04:08 magisk -> ./magisk64
-rwxr-xr-x 1 root root 0 1970-01-01 04:08 magisk32
-rwxr-xr-x 1 root root 247168 1970-01-01 04:08 magisk64
-rwxr-xr-x 1 root root 328240 1970-01-01 04:08 magiskpolicy
lrwxrwxrwx 1 root root 8 1970-01-01 04:08 resetprop -> ./magisk
lrwxrwxrwx 1 root root 8 1970-01-01 04:08 su -> ./magisk
lrwxrwxrwx 1 root root 14 1970-01-01 04:08 supolicy -> ./magiskpolicy
ASUS_I006D:/dev/hP3B # ls -al /dev/hP3B/.magisk/
total 7
drwxr-xr-x 8 root root 180 1970-01-01 04:08 .
drwx------ 3 root root 200 1970-01-01 04:08 ..
d--------- 2 root root 160 1970-01-01 04:08 block
drwxr-xr-x 2 root root 7240 1970-01-01 04:08 busybox
---------- 1 root root 127 1970-01-01 04:08 config
d--------- 7 root root 220 1970-01-01 04:08 mirror
drwxr-xr-x 3 root root 3452 2022-11-06 18:32 modules
drwxr-xr-x 2 root root 0 1970-01-01 04:08 pts
d--------- 2 root root 80 1970-01-01 04:08 selinux
ASUS_I006D:/dev/hP3B # cat /dev/hP3B/.magisk/config
KEEPVERITY=false
KEEPFORCEENCRYPT=false
PATCHVBMETAFLAG=false
RECOVERYMODE=false
SHA1=1a05ccb9844d3ad4f6d1873dfbf76ebf83a5bdeb
ASUS_I006D:/dev/hP3B #
Backup of the boot partitions
Magisk creates backups of the boot partitions in sub directories in /data/adb with filenames starting with magisk_backup_, e.g.:
Code:
[email protected]_I006D:/data/adb # ls -l /data/magisk_backup_*
/data/magisk_backup_79f3370cd83d03441325998a8875888780c3182f:
total 31712
-rwxr-xr-x 1 root root 32436260 2022-09-26 12:20 boot.img.gz
/data/magisk_backup_a0c712541fd002c331c25772a3b8609ae2fba546:
total 31712
-rwxr-xr-x 1 root root 32436965 2022-09-27 19:30 boot.img.gz
[email protected]_I006D:/data/adb #
The uniq string after the second underscore in the name of the directory with the backup is the SHA-1 from the boot image that was patched to install Magisk:
Code:
[[email protected] /data/develop/android/scripts_on_linux]$ ./install_magisk_via_twrp.sh
install_magisk_via_twrp.sh version - v2.0.0.1 - add Magisk to the boot partition of a phone running Android using TWRP
....
Creating the boot image file "/sdcard/Download/boot_b.1086412.img" from the partition "/dev/block/by-name/boot_b" ...
196608+0 records in
196608+0 records out
100663296 bytes (96 M) copied, 0.313082 s, 307 M/s
Checking the result ...
-rw-rw---- 1 root media_rw 100663296 2022-11-06 16:01 /sdcard/Download/boot_b.1086412.img
...
OK, patching the boot partition "/dev/block/by-name/boot_b" was successfull
....
[[email protected] /data/develop/android/scripts_on_linux]$
The image file patched by Magisk in this example is /sdcard/Download/boot_b.1086412.img.
The backup of the boot partition on the phone created by Magisk for this installation is:
Code:
ASUS_I006D:/ # ls -ld /data/magisk_backup*
drwxr-xr-x 2 root root 3452 2022-11-06 17:14 /data/magisk_backup_1a05ccb9844d3ad4f6d1873dfbf76ebf83a5bdeb
ASUS_I006D:/ #
ASUS_I006D:/ # ls -l /data/magisk_backup_1a05ccb9844d3ad4f6d1873dfbf76ebf83a5bdeb
total 50692
-rw-r--r-- 1 root root 51852324 2022-11-06 17:14 boot.img.gz
ASUS_I006D:/ #
1a05ccb9844d3ad4f6d1873dfbf76ebf83a5bdeb is the SHA-1 from the image file used for the installation of Magisk:
Code:
ASUS_I006D:/ # sha1sum /sdcard/Download/boot_b.1086412.img
1a05ccb9844d3ad4f6d1873dfbf76ebf83a5bdeb /sdcard/Download/boot_b.1086412.img
ASUS_I006D:/ #
or
Code:
ASUS_I006D:/data/adb/workdir/unpack/ramdisk # /data/adb/magisk/magiskboot sha1 /sdcard/Download/boot_b.1086412.img
1a05ccb9844d3ad4f6d1873dfbf76ebf83a5bdeb
ASUS_I006D:/data/adb/workdir/unpack/ramdisk #
The SHA1 from the previous boot image is stored in the file /dev/hP3B/.magisk/config used by Magisk while running, e.g.:
Code:
ASUS_I006D:/data/adb/workdir/unpack/ramdisk # cat /dev/hP3B/.magisk/config
KEEPVERITY=false
KEEPFORCEENCRYPT=false
PATCHVBMETAFLAG=false
RECOVERYMODE=false
SHA1=1a05ccb9844d3ad4f6d1873dfbf76ebf83a5bdeb
ASUS_I006D:/data/adb/workdir/unpack/ramdisk #
/dev/hP3B is a directory on the temporary ramdisk used by Magisk while it is running.
Use the command magisk --path to retrieve the path for the current ramdisk while Magisk is running, e.g.:
Code:
ASUS_I006D:/data/adb/workdir/unpack/ramdisk # magisk --path
/dev/hP3B
ASUS_I006D:/data/adb/workdir/unpack/ramdisk #
The SHA1 from the previous boot image is also stored in the file .backup/.magisk in the ramdisk of a boot image, e.g:
Code:
# Note: unpack the boot image and the ramdisk from the boot image to get that file
#
ASUS_I006D:/data/adb/workdir/unpack/ramdisk # cat .backup/.magisk
KEEPVERITY=false
KEEPFORCEENCRYPT=false
PATCHVBMETAFLAG=false
RECOVERYMODE=false
SHA1=1a05ccb9844d3ad4f6d1873dfbf76ebf83a5bdeb
ASUS_I006D:/data/adb/workdir/unpack/ramdisk #
To do it all in once use:
Bash:
grep "^SHA1=" $( magisk --path )/.magisk/config | cut -f2 -d "="
e.g.:
Code:
ASUS_I006D:/data/adb/workdir/unpack/ramdisk # grep "^SHA1=" $( magisk --path )/.magisk/config | cut -f2 -d "="
1a05ccb9844d3ad4f6d1873dfbf76ebf83a5bdeb
ASUS_I006D:/data/adb/workdir/unpack/ramdisk # #
Backup the Magisk config
To backup the Magisk config just copy the directories in /data/adb except the directory /data/adb/magisk (that directory is used for the binaries only)
Code:
adb shell tar --exclude data/adb/magisk/ -czf /sdcard/Download/magisk_config_$( date +%Y-%m-%d).$$.tar /data/adb/
To restore the backup unpack the tar file on the phone and reboot the phone.
To also create a backup the settings from the Magisk App create a backup of the directory with the Magisk App Settings (see above for details).
Start/Stop the Magisk App
To start the Magisk App via CLI command use
Bash:
am start -n com.topjohnwu.magisk/.ui.MainActivity
To stop the Magisk App via CLI command use:
Bash:
am force-stop com.topjohnwu.magisk
Start/Stop the Magisk Daemon
To stop the Magisk Daemon use
Bash:
magisk --stop
Be aware that stopping the magisk daemon will remove all bind mounts for files in /system. To re-enable these bind mounts a reboot is required.
To start the Magisk Daemon use
Bash:
/data/adb/magisk/magisk64 --daemon
To check if the Magisk Daemon is running use
Bash:
/data/adb/magisk/magisk64 -v
Example output:
Code:
# Magisk Daemon is running
ASUS_I006D:/ # /data/adb/magisk/magisk64 -v
25.2:MAGISK:R
ASUS_I006D:/ #
# Magisk Daemon is not running
|ASUS_I006D:/ # /data/adb/magisk/magisk64 -v
No daemon is currently running!
1|ASUS_I006D:/ #
Building Magisk
The Magisk source code is available at
https://github.com/topjohnwu/Magisk
There are also instructions how to create a local copy of the repository and compile Magisk on that page. I've successfully build Magisk using these instructions.
Miscellaneous
magiskboot can also be used compress or decompress files:
Code:
1|ASUS_I006D:/data/adb/magisk # ./magiskboot
MagiskBoot - Boot Image Modification Tool
Usage: ./magiskboot <action> [args...]
Supported actions:
...
compress[=format] <infile> [outfile]
Compress <infile> with [format] to [outfile].
<infile>/[outfile] can be '-' to be STDIN/STDOUT.
If [format] is not specified, then gzip will be used.
If [outfile] is not specified, then <infile> will be replaced
with another file suffixed with a matching file extension.
Supported formats: gzip zopfli xz lzma bzip2 lz4 lz4_legacy lz4_lg
decompress <infile> [outfile]
Detect format and decompress <infile> to [outfile].
<infile>/[outfile] can be '-' to be STDIN/STDOUT.
If [outfile] is not specified, then <infile> will be replaced
with another file removing its archive format file extension.
Supported formats: gzip zopfli xz lzma bzip2 lz4 lz4_legacy lz4_lg
1|ASUS_I006D:/data/adb/magisk #
magiskboot is also used in TWRP to unpack and repack the boot image for installing Magisk
Using the magisk binary while the phone is booted into TWRP
If the used TWRP can mount the volume for /data you can also use the binary magisk while in TWRP. The magisk binary is not in the path while booted into TWRP - therefor you must use the fully qualified filename:
This is
/data/adb/magisk/magisk64
for 64 Bit CPUs and
/data/adb/magisk/magisk32
for 32 Bit CPUs.
Some functions of Magisk are only usable if the Magisk daemon is running. To start the Magisk daemon the Magisk binary can also be used - example:
Code:
# read the policies table from the Magisk squlite database
#
ASUS_I006D:/ # /data/adb/magisk/magisk64 --sqlite "select * from policies ;"
No daemon is currently running!
#
# -> the Magisk daemon is not running -> start it
#
1|ASUS_I006D:/ # /data/adb/magisk/magisk64 --daemon
ASUS_I006D:/ #
ASUS_I006D:/ # /data/adb/magisk/magisk64 --sqlite "select * from policies ;"
logging=1|notification=1|policy=2|uid=2000|until=0
logging=1|notification=1|policy=2|uid=10135|until=0
logging=1|notification=1|policy=2|uid=10143|until=0
logging=1|notification=1|policy=2|uid=10055|until=0
logging=1|notification=1|policy=2|uid=10142|until=0
ASUS_I006D:/ #
Use
Bash:
/data/adb/magisk/magisk64 -V
to check if the Magisk daemon is running
Use
Bash:
/data/adb/magisk/magisk64 --stop
to stop the Magisk Daemon, e.g.:
Code:
ASUS_I006D:/ # /data/adb/magisk/magisk64 -V
25200
# -> The Magisk Daemon is running
ASUS_I006D:/ # /data/adb/magisk/magisk64 --stop
ASUS_I006D:/ #
ASUS_I006D:/ # /data/adb/magisk/magisk64 -V
No daemon is currently running!
1|ASUS_I006D:/ # 2D
Trouble Shooting
If something went wrong and booting the phone does not work anymore after installing a Magisk Module just remove the files in /data/adb/modules/<modulename> and reboot the phone :
Either connect via adb to the not booting phone (this should be possible in most cases even if the boot process does not finish), delete the files, and reboot the phone. Or reboot the phone from a Recovery image like TWRP, delete the files in /data/adb/modules/<modulename>, and reboot the phone.
The same procedure can be used if booting the phone does not work anymore after adding another init script - just delete the new script in /data/adb/post-fs-data.d or /data/adb/service.d and reboot the phone
An error like this
Code:
08-06 18:41:39.341 +0000 1356 1726 W ziparchive: Unable to open '/system/app/AsusFMRadio/AsusFMRadio.apk': Permission denied
08-06 18:41:39.341 +0000 1356 1726 E system_server: Failed to open APK '/system/app/AsusFMRadio/AsusFMRadio.apk': I/O error
08-06 18:41:39.354 +0000 1356 1356 W PackageManager: Failed to parse /system/app/AsusFMRadio: Failed to parse /system/app/AsusFMRadio/AsusFMRadio.apk
is most of the time caused by missing read permissions for the file.
Use
Bash:
chmod o+r /system/app/AsusFMRadio/AsusFMRadio.apk
to fix it.
To catch errors from a script executed by Magisk you might use this technique:
Bash:
# redirect STDERR of all commands in the script to a file
#
exec 2>/data/script_stderr.log
set -x
... rest of your script
To remove all installed Magisk Modules using the official method use:
Code:
magisk --remove-modules
to remove all modules (but not the new init scripts!) and reboot the phone
According to the FAQ Magisk will not start if the phone is booted into safe mode (see
https://topjohnwu.github.io/Magisk/faq.html)
Be aware that after rebooting the phone again in normal mode all Magisk Modules are disabled and must be enabled again using either the Magisk App or a CLI command:
To reenable all Magisk Modules via shell command do
Bash:
adb shell rm /data/adb/modules/*/disable
Spoiler: History
HIstory
07.08.2022 /bs
Added additional infos about the permissions for new files for /system.
Added additional commands to the script for catching the OS logs while booting the phone
Added infos about a workaround to add new files to /product, /vendor, or /system_ext
Added infos about how to access file replaced by a Magisk Module
20.09.2022 /bs
Added new links to posts about configuring swap devices via Magisk script
Added a link to the post about how to use Magisk to unpack and repack the boot image
28.09.2022 /bs
Added infos about the backups of the boot partitions created by Magisk
30.09.2022 /bs
Added a short info about using Magisk Overlays to change files in the root filesystem
Added the URL for the post with how to change the active slot using the Magisk App
02.10.2022 /bs
Added a short info about Root Directory Overlay system from Magisk
04.10.2022 /bs
Add an URL to another post to use the Root Directory Overlay system from Magsik
Fixed some spelling errors and also some errors in the code examples
Added more details about changing files in /system
26.10.2022/bs
Added the section Miscellaneous
28.10.2022/bs
Added the section Start/Stop the Magisk App
Added the section Start/Stop the Magisk Daemon
02.11.2022 /bs
added the infos about the x86 version of the magiskboot executables in the Magisk apk file
fixed some spelling and formatting errors
04.11.2022/bs
add the link to the Howto about making a file in /system writable
corrected some formatting errors
06.11.2022/bs
added more details about the boot partition backups created by Magisk
added missing "su - -c" to some adb shell commands
07.11.2022/bs
added more details about the boot partition backups created by Magisk
added the section about the temporary Magisk config directory
08.11.2022/bs
added the section about how to get the Magisk App installation directory
25.11.2022/bs
added infos about how to build Magisk using a local copy of the repository
02.12.2022 /bs
added the infos about sing the magisk binary while the phone is booted into TWRP
06.12.2022 /bs
added the section Magisk root access configuration details
added infos about the files used to store the settings for the Magisk App
30.12.2022 /bs
added more infos about how to add new start / stop services in Android
07.05.2023 /bs
add infos about how to create the Magisk database manuallay
Nice.
Thank you very much for all the details and explanations.
possible to change "Automatic Response" setting via adb command?
LEENO said:
possible to change "Automatic Response" setting via adb command?
Click to expand...
Click to collapse
What do you mean with "Automatic Response"?
bnsmb said:
What do you mean with "Automatic Response"?
Click to expand...
Click to collapse
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Most probably yes ... I will check that
LEENO said:
View attachment 5778489
Click to expand...
Click to collapse
Where does the Magisk App store the settings?

Categories

Resources