Need someone to convert TWRP zip into Magisk Module - Magisk

Dear Members iam not a developer so i am looking for someone who can convert attached file into Magisk Module.. This TWRP zip contain vendor files for Sharp Aquos S3 (HH6) and iam using it to run Android One which is for device HH1..
If it is possible for anyone please.
I downloaded this file from 4PDA so i can not request them to convert as i don't know russian to communicate

You don't need to be a developer to create a Magisk module. You've got the module template right here: https://github.com/topjohnwu/magisk-module-installer
Simply take the vendor directory from the original zip and place it in the system directory of the module template. Then you can update the info in module.prop to something descriptive (so you know which module it is in the modules list later), zip up the template and flash it.

Great Thanks alot i will do it right away
Didgeridoohan said:
You don't need to be a developer to create a Magisk module. You've got the module template right here: https://github.com/topjohnwu/magisk-module-installer
Simply take the vendor directory from the original zip and place it in the system directory of the module template. Then you can update the info in module.prop to something descriptive (so you know which module it is in the modules list later), zip up the template and flash it.
Click to expand...
Click to collapse

Iam getting an error as below
Copying zip to temp_directory
Installing module.zip
Installation failed
Where I can see what is wrong, i simply copied vendor folder from original TWRP zip folder and pasted into system folder of module template as instructed
There are no logs in Magisk Manager > Logs
Didgeridoohan said:
You don't need to be a developer to create a Magisk module. You've got the module template right here: https://github.com/topjohnwu/magisk-module-installer
Simply take the vendor directory from the original zip and place it in the system directory of the module template. Then you can update the info in module.prop to something descriptive (so you know which module it is in the modules list later), zip up the template and flash it.
Click to expand...
Click to collapse

jameelmemon said:
Iam getting an error as below
Copying zip to temp_directory
Installing module.zip
Installation failed
Where I can see what is wrong, i simply copied vendor folder from original TWRP zip folder and pasted into system folder of module template as instructed
There are no logs in Magisk Manager > Logs
Click to expand...
Click to collapse
I'm gonna guess you didn't replace the dummy update-binary with the proper installation script. It's detailed in the documentation but I could probably have mentioned it... Here's the relevant part of the docs: https://topjohnwu.github.io/Magisk/guides.html#magisk-module-installer

Didgeridoohan said:
I'm gonna guess you didn't replace the dummy update-binary with the proper installation script. It's detailed in the documentation but I could probably have mentioned it... Here's the relevant part of the docs: https://topjohnwu.github.io/Magisk/guides.html#magisk-module-installer
Click to expand...
Click to collapse
After Following all instructions, module gets installed but it is not effective
After analyzing files that this module loads I think they doesn't work as they do not execute as they should, I maybe wrong here, but i think these scripts need to be split and placed / executed in different way.
here is code from vendor/etc/init/hw/init.sku.rc
on fs
setprop persist.radio.skt_iot 1
setprop persist.vendor.ims.no_stapa 1
setprop ro.product.first_api_level 27
setprop ro.product.vendor.brand SHARP
setprop ro.product.vendor.model FS8032
setprop ro.product.vendor.name FS8032_00A0
setprop ro.product.vendor.device HH6_sprout
setprop ro.product.vendor.manufacturer SHARP
on post-fs
setprop persist.sys.security_enable false
setprop persist.radio.multisim.config dsds
on fs
setprop ro.vendor.build.fingerprint SHARP/FS8032_00A0/HH6_sprout:9/PPR1.180610.011/FS8032S0314P:user/release-keys
there are 2 files init.fingerprint.gxfp5288_sd1.rc and init.fingerprint.gxfp3258_sd1.rc containing on post-fs-data which should be placed in common/post-fs-data.sh file, but i don't know about on fs or other parts.
whereas vendor/etc/init/hw/init.HH1.target.rc imports some existing scripts from vendor folder and executes code on boot, on pre-boot and on init
from prename of each file i guess they can be executed as init.d script if so how i can use a module to convert them as init.d scripts and load effectively

All the props (the setprop commands) can be placed in the module system.prop file (don't forget to also activate it in install.sh). The rest of the commands would have to be converted to the post-fs-data.sh and service.sh module scripts, depending on when they're needed (again, don't forget to activate them in install.sh). The service.sh script runs later in the boot process.
I can unfortunately not help you there though. Time is a way too valuable commodity...

Setprop i can do but can you please have a look into the files and explain to me how i would rewrite the script or point me to a tutorial would be great help
Didgeridoohan said:
All the props (the setprop commands) can be placed in the module system.prop file (don't forget to also activate it in install.sh). The rest of the commands would have to be converted to the post-fs-data.sh and service.sh module scripts, depending on when they're needed (again, don't forget to activate them in install.sh). The service.sh script runs later in the boot process.
I can unfortunately not help you there though. Time is a way too valuable commodity...
Click to expand...
Click to collapse

Related

[DEPRECATED][MODULE TEMPLATE][DEV] System/Less Magisk Module Template

SYSTEM/LESS MODULE TEMPLATE FOR MAGISK
This template is a modified version of the original one.
Its purpose is to make Magisk Modules install in either Magisk (as a module) or directly in /system.
How to use/create a module:
Clone / download this repo
Open config.sh, follow the instructions written at the beginning of the file. You should at least change config.sh and module.prop
Zip your files, the zipped file is a flashable zip for both Magisk Manager and custom recoveries
Please check Notes for precautions
You can make a module from this template almost the same as you can make one in the Original template.
It should be easy to transition from there to here.
ADDITIONAL STUFF
Installation is configurable. It means that you can control on where it installs (system or magisk), and a few other variables that is also important.
For Devs:
Installation is configurable in config.sh. You can control the variables (starting in line 95) that will help you how to configure your module.
Code:
Variables:
[B]MAGISKINSTALL [/B]- forces magisk installation (might conflict with SYSTEMINSTALL) (values: [B]true [/B]or [B]false[/B])
[B]SYSTEMINSTALL [/B]- forces system installation (might conflict with MAGISKINSTALL) (values: [B]true[/B] or [B]false[/B])
[B]INITPATH [/B]- sets path to install scripts (post-fs-data.sh, service.sh) if system install (values: [B]directories[/B])
[B]BUILDPROP [/B]- sets properties from system.prop directly to build.prop (values: [B]true [/B]or [B]false[/B])
[B]PERMANENTDELETE [/B]- PERMANENTLY delete folders in $REPLACE (values: [B]true [/B]or [B]false[/B])
[B]ERROREXIT[/B] - exits with an error on every failed attempt to install to Magisk (enabled by default) (values: [B]true [/B]or [B]false[/B])
set_permissions_system
It behaves like set_permissions, but it sets them on whatever file you want and will be executed in system install only.
System Install
The directories in system folder will correspond to which directory the files will be copied.
Ex. if you put in the zip /system/example.file, it will be copied to /system/example.file.
Click to expand...
Click to collapse
For Users:
If a module is based on this template, you can also configure it's installation.
The variables that is in /dev/.config will overwrite the dev's setting for the module.
Code:
Variables:
[B]MAGISKINSTALL [/B]- forces magisk installation (might conflict with SYSTEMINSTALL) (values: [B]true [/B]or [B]false[/B])
[B]SYSTEMINSTALL [/B]- forces system installation (might conflict with MAGISKINSTALL) (values: [B]true[/B] or [B]false[/B])
[B]INITPATH [/B]- sets path to install scripts (post-fs-data.sh, service.sh) if system install (values: [B]directories[/B])
[B]BUILDPROP [/B]- sets properties from system.prop directly to build.prop (values: [B]true [/B]or [B]false[/B])
[B]PERMANENTDELETE [/B]- PERMANENTLY delete folders in $REPLACE (values: [B]true [/B]or [B]false[/B])
They need to be in /dev/.config to be read by the installer.
To enter them, just create the file and then add.
How to do it on Terminal:
Code:
Example:
echo "SYSTEMINSTALL=TRUE" >> /dev/.config
You can add them in different lines to be valid.
I put it in /dev/.config to make it a temporary file. So whenever a module is flashed, the file will be gone and won't interrupt the installation process of the currently installing module.
Click to expand...
Click to collapse
XDA:DevDB Information
System/Less Module Template for Magisk, Tool/Utility for all devices (see above for details)
Contributors
veez21, topjohnwu
Source Code: [url]https://github.com/veez21/unify-magisk-module-template[/URL]
Version Information
Status: Beta
Current Beta Version: v0.3
Beta Release Date: 2017-06-11
Created 2017-06-11
Last Updated 2017-06-14
Reserved
Reserved
reserved+
UPDATE TO v0.2
commit 3709f37
Changelog:
add more notes
fixed some terms
fix setting PERM
added ERROREXIT variable
added post-fs-data and late_start service scripts notes and better compatibility with system install
Hi veez. I like to know about how to edit default.prop using magisk module. There are somes ro. In default.prop i want to edit. I had seen some module make by others and i look at post-fs-data.sh they edit ro.fingerprint or dpi screen using magisk module it for build.prop. but now i want to edit default.prop . Can u help me how to edit default.prop using magisk module. I search on google some people said that i must to unpack boot.img to edit defaukt.prop thanks before. And I newbie for this magisk module.
Duden17 said:
Hi veez. I like to know about how to edit default.prop using magisk module. There are somes ro. In default.prop i want to edit. I had seen some module make by others and i look at post-fs-data.sh they edit ro.fingerprint or dpi screen using magisk module it for build.prop. but now i want to edit default.prop . Can u help me how to edit default.prop using magisk module. I search on google some people said that i must to unpack boot.img to edit defaukt.prop thanks before. And I newbie for this magisk module.
Click to expand...
Click to collapse
If you just want to set a new value to the prop, it's the same procedure as the modules you've been looking at. Just add the prop and new value to the system.prop file of the module and you're done. Shameless promotion: if you don't want to make a module yourself, my MagiskHide Props Config module can actually set custom props for you.
If you want to edit the default.prop file itself you're going to have to go about the way you found about unpacking the boot image, etc.
Didgeridoohan said:
If you just want to set a new value to the prop, it's the same procedure as the modules you've been looking at. Just add the prop and new value to the system.prop file of the module and you're done. Shameless promotion: if you don't want to make a module yourself, my MagiskHide Props Config module can actually set custom props for you.
If you want to edit the default.prop file itself you're going to have to go about the way you found about unpacking the boot image, etc.
Click to expand...
Click to collapse
Oke. I use ur module man. Its great for people need to change their cts or selinux. Good job :good::good: i will look at to ur magiskhide prop again. Thanks man
Not sure where to post this as I was looking for guide/s on how to create a magisk module for this feature.
iZLeeP said:
Not sure where to post this as I was looking for guide/s on how to create a magisk module for this feature.
Click to expand...
Click to collapse
This isn't. Also this template is abandoned.
You should start here https://github.com/topjohnwu/magisk-module-template
veez21 said:
This isn't. Also this template is abandoned.
You should start here https://github.com/topjohnwu/magisk-module-template
Click to expand...
Click to collapse
That was the first thing I did. I was just looking for additional sources to better understand on how to make a Magisk module as this is the first time I'm doing so. Anyway, thanks for pointing out.
Old topic but this is a great idea, I think a better way of doing this would be automatically detecting if magisk is installed and acting accordingly otherwise install to system..
Hi i want to make auto face unlock module
Could you please help me
and also want to make quick pin unlock module
ntrimurthulu said:
Hi i want to make auto face unlock module
Could you please help me
and also want to make quick pin unlock module
Click to expand...
Click to collapse
Not possible with magisk
Sent from my Moto G 2015 using XDA Labs
DanGLES3 said:
Not possible with magisk
Click to expand...
Click to collapse
Oh sad
---------- Post added at 05:11 PM ---------- Previous post was at 05:11 PM ----------
DanGLES3 said:
Not possible with magisk
Click to expand...
Click to collapse
Do you know other way
ntrimurthulu said:
Oh sad
---------- Post added at 05:11 PM ---------- Previous post was at 05:11 PM ----------
Do you know other way
Click to expand...
Click to collapse
The only way would be a custom ROM or xposed but it only supports up to Oreo and I don't think there's a module for face auto unlock
Sent from my Moto G 2015 using XDA Labs
DanGLES3 said:
The only way would be a custom ROM or xposed but it only supports up to Oreo and I don't think there's a module for face auto unlock
Click to expand...
Click to collapse
Yeah no such module that's why i want to create
BTW thank you
!Magisk is not activated !... abort
! Installation failed
obviously magisk is activated 19.1 ... is this template too old ?
edit: nevermind ... i just edited the zip directly from github so there was a folder in the root of the zip :silly:

[Q] How to change a build.prop value using resetprop

Hello guys. I'm trying to make some modifications in my build.prop using magisk's systemless interface. In a module, I saw that resetprop can add lines in build.prop, but, I need to change a specific line in build.prop and resetprop in a module intercafe can't do that (or can, I don't know ). I was thinking in creating a script using su + resetprop to delete and include again, and I'll put in a .sh file inside /magisk/.core/service.d/ to run in every boot.
Code:
su
resetprop --delete [my build.prop line]
But I don't know to to include a line using this interface (script in terminal).
So, I need you, guys haha
Just put whatever resetprop commands you want inside a file, put that file in service.d and give it execution permissions (755). You don't need "su" in there... It's Magisk executing those scripts and it already has escalated privileges.
If it doesn't work, try putting the file in post-fs-data.d instead.
To do this with a module, simply put your commands inside the service.sh file (or post_fs_data.sh) in the common folder.
https://github.com/garethwza/TheFla...mmit/25fb6a451a4d5280c26dbd67f4c5dfad7a3f20fc how to do this with resetprop? resetprop is binary here. how to make it?
Didgeridoohan said:
Just put whatever resetprop commands you want inside a file, put that file in service.d and give it execution permissions (755). You don't need "su" in there... It's Magisk executing those scripts and it already has escalated privileges.
If it doesn't work, try putting the file in post-fs-data.d instead.
To do this with a module, simply put your commands inside the service.sh file (or post_fs_data.sh) in the common folder.
Click to expand...
Click to collapse

[MODULE HELP] How to execute a script only once when module is installed/uninstalled?

The question title can't be much longer but I basically need to execute a script only once when each of the following events happen:
Module is installed.
Module is uninstalled.
Module is enabled.
Module is disabled.
In other words:
When the user first installs my module, I need to execute a script just once.
If the user eventually disables the module, I need to execute the same script again just once.
If the user eventually re-enables the module, I need to execute the same script again just once.
When the user decides to uninstall my module, I need to execute a script just once.
That script is basically removing a particular app's dalvik cache (rm -rf /data/dalvik-cache/<(arm|arm64)>/<app_specific_folder>), and user data (rm -rf /data/data/<package_name>).
I need some pointers on how to do this properly for those 4 events mentioned above and in a way compatible with most devices (for the record, I'm only supporting Nougat and above, if that's relevant).
Installation is easy. Make a function with your script in config.sh and call that from update-binary. Also make sure to let the module install a boot script (post-fs-data.d or service.d, depends on what you want to do) that takes care of the rest for you.
Whenever a module is disabled, there'll be a file named disable in the module folder, so you can let the boot script check for that and then run whatever code you need for the "module disabled" scenario. If you also let that code add a check file to the module folder you can let the code only run once. If both the disable and check files are present, don't run the code...
If the module then is enabled again, the disable file will be deleted. In that case you'll only have the check file, which will mean you should then run the "module enabled" code (which should also delete the check file, of course).
Also let the boot script check for the module folder. If it isn't found it means the module has been uninstalled and you can safely run your "module uninstalled" scenario, do some cleanup, and then let the boot script uninstall itself.
That should work...
There are several modules that do something similar, my MagiskHide Props Config is one of them. Look around for more examples.
I see what you mean but I need to test my code with logging to make sure I'm doing things correctly. What's the best way for me to print to logcat from my Magisk module?
Use exec with xtrace.
Code:
exec 2>/path/to/log/file;
set -x;
It will redirect the command (execution) tree and their errors to the log_file.
Regards.
@JayminSuthar Sorry, I don't understand. Where should I place that code? And are you saying that all the commands (outputs and errors) on my module will be redirected to that file, no exceptions?
You should place this code in your script from where you want logging to start (mostly the beginning). This will print the command (execution) tree in the log file, and all errors (if any), It will not print the output, but the command executed itself.
The format of the logs should be like
Code:
+ >&2
+ echo 'Here logging starts, I'm stderr'
Here logging starts, I'm stderr
+ rm -f /some/non/existent/file
rm: Can't remove file: No such file or directory

[Help] Modifying and replacing existing files

Hi! I need to modify build.prop in /vendor partition. As i understood system.prop can't affect it. So i decided to edit it with "sed" cmd. But i got stuck on boot script. It is executed in magisk logs, but there is no code executed (i added one copy+paste cmd to test).
How should i properly modify /vendor files?
Should i modify it in post-fs-data.sh or service.sh?
I'm noob in magisk module making
Bash:
# This script will be executed in post-fs-data mode
# More info in the main Magisk thread
MODDIR=${0%/*}
#testing and no result
cp /system/build.prop /storage/emulated/0/build.propes
cp /system/build.prop /sdcard/build.propes
#i want to do this
sed -i 's/ro.product.system.brand=Xiaomi/ro.product.system.brand=Google/g' ${$MODDIR}/system/build.prop
sed -i 's/ro.product.system.brand=Xiaomi/ro.product.system.brand=Google/g' ${$MODDIR}/vendor/build.prop
Why do you need to edit the actual build.prop file? Isn't it enough to use the resetprop tool (system.prop in the module).
Didgeridoohan said:
Why do you need to edit the actual build.prop file? Isn't it enough to use the resetprop tool (system.prop in the module).
Click to expand...
Click to collapse
I've tried to do this via system.prop, but got negative result. When i do replace modified files through recovery, i get positive result. Idk whats the problem, cuz i even tried to mount files in moddir/system/ folder. Seems android somehow detects any changes
So i have to copy files to module folder, modify, and replace them in original directory. Now the problem is in editing file, i successfully copied file but "sed" doesnt seem to work lol
What do you mean with "negative results"? Does the prop value not change? Have you tested with the getprop command (because you can't look in the prop file, it won't change when using the resetprop tool)?
Using a Magisk module to magic mount the prop files is likely not going to work since that will happen way too late for the files to be read by the system.
Didgeridoohan said:
What do you mean with "negative results"? Does the prop value not change? Have you tested with the getprop command (because you can't look in the prop file, it won't change when using the resetprop tool)?
Using a Magisk module to magic mount the prop files is likely not going to work since that will happen way too late for the files to be read by the system.
Click to expand...
Click to collapse
Negative result for me - app does not recognize me as another device. There is some protection in it that doesnt simply read system props. It read the build props in root directory. (last android security patch)
I just need to modify files in module directory and thats all. I have only this problem now.
No apps can read the build.prop files directly (unless they're root apps, of course)... Apps will be reading the values, not the file, which is why the resetprop tool works without changing the prop file.
If you really want to go for it though your sed command looks fine, except that I would use ${MODDIR}/system/vendor/build.prop since I don't think the ${MODDIR}/vendor symlink will be available when post-fs-data.sh is executed.
Not sure why you're copying the files to the internal storage and why you're naming them .propes, so can't say much about that.

How To Guide How to change files in the directory /system with Magisk

How to change files in the directory /system with Magisk
Note:
I tested the instructions below with Magisk 24. 25.0, and 25.2 on an ASUS Zenfone 8 running OmniROM (Android 12 ) .
The filesystem for /system is normally mounted read-only In Android 12 and it's difficult to change files in that filesystem.
One possible solution to change files in /system is to create a Magisk module for this task.
For testing if a Magisk Module would work like expected you can create a Dummy Magisk module . The steps to implement the Dummy Magisk Module are:
Install Magisk, enable root access for the shell in Magisk and enable access via adb (this can be done in the "Developer Options" in the system settings)
Next connect to the phone using the command
Code:
adb shell
and become root user
Code:
su -
Now create a sub directory in the directory
/data/adb/modules
e.g.
Code:
ASUS_I006D:/ # ls -ld /data/adb/modules/*
drwxrws--- 3 u0_a118 media_rw 3452 2022-05-30 12:12 /data/adb/modules/playstore
ASUS_I006D:/ #
Then copy the new files for the directory in /system to that directory (/data/adb/modules/<modulename>/ is equal here to the root dir, /, on the phone)
Example:
Code:
ASUS_I006D:/ # find /data/adb/modules/playstore
/data/adb/modules/playstore
/data/adb/modules/playstore/system
/data/adb/modules/playstore/system/etc
/data/adb/modules/playstore/system/etc/permissions
/data/adb/modules/playstore/system/etc/permissions/com.android.vending.xml
/data/adb/modules/playstore/system/priv-app
/data/adb/modules/playstore/system/priv-app/Phonesky
/data/adb/modules/playstore/system/priv-app/Phonesky/lib
/data/adb/modules/playstore/system/priv-app/Phonesky/lib/arm
/data/adb/modules/playstore/system/priv-app/Phonesky/lib/arm/libbrotli.so
/data/adb/modules/playstore/system/priv-app/Phonesky/lib/arm/libconscrypt_jni.so
/data/adb/modules/playstore/system/priv-app/Phonesky/lib/arm/libcronet.85.0.4181.5.so
/data/adb/modules/playstore/system/priv-app/Phonesky/lib/arm/libgame_sdk_device_info_jni.so
/data/adb/modules/playstore/system/priv-app/Phonesky/lib/arm/libphonesky_data_loader.so
/data/adb/modules/playstore/system/priv-app/Phonesky/lib/arm/libtensorflowlite_jni.so
/data/adb/modules/playstore/system/priv-app/Phonesky/Phonesky.apk
/data/adb/modules/playstore/system/priv-app/FakeStore
/data/adb/modules/playstore/system/priv-app/FakeStore/oat
/data/adb/modules/playstore/system/priv-app/FakeStore/oat/arm64
/data/adb/modules/playstore/system/priv-app/FakeStore/oat/arm64/FakeStore.odex
/data/adb/modules/playstore/system/priv-app/FakeStore/oat/arm64/FakeStore.vdex
/data/adb/modules/playstore/system/priv-app/FakeStore/FakeStore.apk
ASUS_I006D:/ #
Now reboot the phone.
After the reboot all files in /data/adb/modules/<modulename> will be mapped to /system by Magisk, e.g:
Code:
ASUS_I006D:/ # find /system/priv-app/Phonesky/
/system/priv-app/Phonesky/
/system/priv-app/Phonesky/lib
/system/priv-app/Phonesky/lib/arm
/system/priv-app/Phonesky/lib/arm/libbrotli.so
/system/priv-app/Phonesky/lib/arm/libconscrypt_jni.so
/system/priv-app/Phonesky/lib/arm/libcronet.85.0.4181.5.so
/system/priv-app/Phonesky/lib/arm/libgame_sdk_device_info_jni.so
/system/priv-app/Phonesky/lib/arm/libphonesky_data_loader.so
/system/priv-app/Phonesky/lib/arm/libtensorflowlite_jni.so
/system/priv-app/Phonesky/Phonesky.apk
ASUS_I006D:/ #
ASUS_I006D:/ # find /system/priv-app/FakeStore/
/system/priv-app/FakeStore/
/system/priv-app/FakeStore/oat
/system/priv-app/FakeStore/oat/arm64
/system/priv-app/FakeStore/oat/arm64/FakeStore.vdex
/system/priv-app/FakeStore/oat/arm64/FakeStore.odex
/system/priv-app/FakeStore/FakeStore.apk
ASUS_I006D:/ #
Because the mapping will be done while booting the phone it will also survive updating the OS on the phone to a new version as long as the user data is not deleted and Magisk is installed in the boot partition.
Notes:
Magisk "replaces" existing directories and files in /system with the files in that directory by using bind mounts.
You can not add additional files or directories to /system using this method -- it's only possible to add additional files and directories to the existing sub directories in /system.
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.
This method can also be used to replace files in the directories /vendor, /product, or /system_ext:
from https://topjohnwu.github.io/Magisk/guides.html:
The system folder​
All files you want to replace/inject should be placed in this folder. This folder will be recursively merged into the real /system; that is: existing files in the real /system will be replaced by the one in the module’s system, and new files in the module’s system will be added to the real /system.
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.
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
But this seems to work only to replace existing files in these directories.
This method to replace files in /system simulates a module in Magisk so if everything is okay I strongly recommend to create a "real" Magisk Module with the new files for /system.
Trouble Shooting
If something does not work check the Magisk log file in /cache :
/cache/magisk.log
History
Update 10.06.2022
added the infos about how to update files /vendor, /product, /system-ext
Update 12.06.2022
The Magisk Module to install the patched Playstore used in this example can be downloaded here
http://bnsmb.de/files/public/Android/PlayStore_for_MicroG.zip
see also this Message
https://forum.xda-developers.com/t/...h-a-patched-playstore-from-nanodroid.4456421/
Update 03.10.2022
The sentence about how to update files in /vendor, /product, /system-ext was missing here --fixed
Added a note about what can not be done using this method
Update 04.11.2022
Added the hint for the post to make files in /system writable
Doing some cleanup to make the instructions more clear
Update 18.01.2023
See How to change any file or directory using Magisk for another approach to change files on read-only mounted filesystems.
Can this way be used with the Product and other folders?, framework?
To remove apps?, make fake apk's?
NisseGurra said:
Can this way be used with the Product and other folders?, framework?
Click to expand...
Click to collapse
I just did a quick test and it seems that replacing files in other folders seems not to work
(but this was only a quick test without checking the documentation for Magisk ...)
To remove apps?, make fake apk's?
Click to expand...
Click to collapse
I don't think that you can remove files because Magisk uses bind mounts for replacing the files. But you can disable apps by creating empty files.
E.g. in my example in the previous post
/data/adb/modules/playstore/system/priv-app/FakeStore/FakeStore.apk
is an empty file to overwrite (and therfor disable) the file
/system/priv-app/FakeStore/FakeStore.apk.
That's neccessary because FakeStore.apk and Phonesky.apk use the same signature and that is not allowed in Android.
regards
Bernd
Tested to change a app: SamsungCalendar
Copied the files to /data/adb/modules/
Want to exchange the samsung calendar to an other calendar app that cant be installed due to name conflict.
Replace app?, seems no go
NisseGurra said:
Tested to change a app: SamsungCalendar
Copied the files to /data/adb/modules/
Want to exchange the samsung calendar to an other calendar app that cant be installed due to name conflict.
Replace app?, seems no go
Click to expand...
Click to collapse
Post an "ls -l" for the directory with the app you want to replace and the output of
ls -lr /data/adb/
The file structure in /data/adb/module must match the file structure in / , e.g. to replace the file
/system/priv-app/<appname>/<app.apk>
the file to replace that app must be
/data/adb/modules/<modulename>/system/priv-app/<appname>/<app.apk>
Module Name can be any name .
regards
Bernd
I have try this again, seems magisk creates an file connected to the replaced file.
How do i make these files?
I have some 200 apps in system that i like to disable. Would an "fake" apk disable these apps?
Tested calendar app again, it replaces apk but as its in system/app it can not start the "calendar"
Hi,
Do you think that in this module I can switch mbm system file from
vendor/rfs/msm/mpss/readonly/vendor/mbm/mcfg_sw/mbn_sw.txt
kubans2301 said:
Hi,
Do you think that in this module I can switch mbm system file from
vendor/rfs/msm/mpss/readonly/vendor/mbm/mcfg_sw/mbn_sw.txt
Click to expand...
Click to collapse
Hi
The file does not exist on my phone:
Code:
ASUS_I006D:/ # ls /vendor/rfs/msm/mpss/readonly/vendor/
firmware
ASUS_I006D:/ #
So I will create it now:
Code:
ASUS_I006D:/data/adb/modules/fmradio # mkdir -p system/vendor/rfs/msm/mpss/readonly/vendor/mbm/mcfg_sw
ASUS_I006D:/data/adb/modules/fmradio #
ASUS_I006D:/data/adb/modules/fmradio # echo "# Test file" > system/vendor/rfs/msm/mpss/readonly/vendor/mbm/mcfg_sw/mbn_sw.txt
ASUS_I006D:/data/adb/modules/fmradio #
ASUS_I006D:/data/adb/modules/fmradio # cat system/vendor/rfs/msm/mpss/readonly/vendor/mbm/mcfg_sw/mbn_sw.txt
# Test file
ASUS_I006D:/data/adb/modules/fmradio #
and reboot
Code:
ASUS_I006D:/data/adb/modules/fmradio # reboot
after the reboot the file is thre:
Code:
ASUS_I006D:/data/adb/modules/fmradio # cat /vendor/rfs/msm/mpss/readonly/vendor/mbm/mcfg_sw/mbn_sw.txt
# Test file
ASUS_I006D:/data/adb/modules/fmradio #
ASUS_I006D:/data/adb/modules/fmradio # echo "Test 1234" >>./system/vendor/rfs/msm/mpss/readonly/vendor/mbm/mcfg_sw/mbn_sw.txt
ASUS_I006D:/data/adb/modules/fmradio #
ASUS_I006D:/data/adb/modules/fmradio #
ASUS_I006D:/data/adb/modules/fmradio # cat /vendor/rfs/msm/mpss/readonly/vendor/mbm/mcfg_sw/mbn_sw.txt
# Test file
Test 1234
ASUS_I006D:/data/adb/modules/fmradio #
So it should also work to "overwrite" an existing file in that directory.
regards
Bernd
regards
Bernd
NisseGurra said:
I have try this again, seems magisk creates an file connected to the replaced file.
How do i make these files?
I have some 200 apps in system that i like to disable. Would an "fake" apk disable these apps?
Tested calendar app again, it replaces apk but as its in system/app it can not start the "calendar"
Click to expand...
Click to collapse
HI
I missed that post -- what did you do exactly and what did not work?
regards
Bernd
just make a Replace list in customize.sh in magisk zip is fine
Thank you so much. It works perfectly on my Xiaomi mi 11 on miui 14 (android 13). It is easy and very fast way to change files in subfolders in system when it mounted read-only.
This is great and the best thing is that if something doesnt work and I get a bootloop I can always just boot into safe mode and remove the module
So this replaces files or just creates some links?
For instance if I make a module to replace Samsung My Files with a custom app, will this be reversible, meaning that if I delete my module I get original My Files app back?
veso266 said:
This is great and the best thing is that if something doesnt work and I get a bootloop I can always just boot into safe mode and remove the module
So this replaces files or just creates some links?
For instance if I make a module to replace Samsung My Files with a custom app, will this be reversible, meaning that if I delete my module I get original My Files app back?
Click to expand...
Click to collapse
This is great and the best thing is that if something doesnt work and I get a bootloop I can always just boot into safe mode and remove the module
Click to expand...
Click to collapse
correct (and if booting to save mode does not work anymore you can boot from the recovery image and fix the problem)
So this replaces files or just creates some links
Click to expand...
Click to collapse
/system is mounted read-only and neither you nor Magisk can replace files on a read-only mounted filesystem . Magisk creates bind mounts for the files and directories to replace.
Bind mounts only exist in memory and will be removed by a reboot.
For instance if I make a module to replace Samsung My Files with a custom app, will this be reversible, meaning that if I delete my module I get original My Files app back?
Click to expand...
Click to collapse
yes, just deactivate or deinstall the Magisk Module. This can be done either in the Magisk App, in an adb shell, or, if the phone does not boot anymore, from within a booted recovery image
regards
Bernd
bnsmb said:
correct (and if booting to save mode does not work anymore you can boot from the recovery image and fix the problem)
/system is mounted read-only and neither you nor Magisk can replace files on a read-only mounted filesystem . Magisk creates bind mounts for the files and directories to replace.
Bind mounts only exist in memory and will be removed by a reboot.
yes, just deactivate or deinstall the Magisk Module. This can be done either in the Magisk App, in an adb shell, or, if the phone does not boot anymore, from within a booted recovery image
regards
Bernd
Click to expand...
Click to collapse
Thanks, let me first tell you I am using Android 10 (no need to upgrade, and I don't want some obscure api to be removed, which I found out about when I need it)
I was able to make a small module that adds a priv-app, a permissions and a library, and it works great
No the onlything I need to add is a system service
So I need to replace framework.jar (I also have EdXposed installed through Riru and I dont want to break it)
Now I have Samsung Galaxy S10+ (SM-G975F) which doesnt have this service, but korean version of it (SM-G975N) has
So for the first test, I just wanted to transplant framework.jar (using the same android version of course) from SM-G975N to my SM-G975F
this seams easier to do then patch my framework.jar, because I read that system service also needs to be signed, and I don't know how to do that yet
I hope replacing framework.jar file will be enought (since I also read system services are located elsewhere)
The service I need to add is called: FMRadioService.java (and is located under com\android\server\ (if you decompile framework.jar)
Now I need to figure out how to recover, if something goes wrong (because something alawys goes wrong, I would like to be prepared)
So how to enter safe mode and disable my module?
And you said that if this doesnt work I can boot from recovery image (what image? is stock recovery allright? (I don't have TWRP yet (I will install it, once I figure out how), and I explained the reasons in this thread: https://forum.xda-developers.com/t/...-app-after-you-have-root-with-magisk.4564363/ )
Thanks
veso266 said:
Thanks, let me first tell you I am using Android 10 (no need to upgrade, and I don't want some obscure api to be removed, which I found out about when I need it)
I was able to make a small module that adds a priv-app, a permissions and a library, and it works great
No the onlything I need to add is a system service
So I need to replace framework.jar
Now I have Samsung Galaxy S10+ (SM-G975F) which doesnt have this service, but korean version of it (SM-G975N) has
So for the first test, I just wanted to transplant framework.jar (using the same android version of course) from SM-G975N to my SM-G975F
this seams easier to do then patch my framework.jar, because I read that system service also needs to be signed, and I don't know how to do that yet
I hope replacing framework.jar file will be enought (since I also read system services are located elsewhere)
The service I need to add is called: FMRadioService.java (and is located under com\android\server\ (if you decompile framework.jar)
Now I need to figure out how to recover, if something goes wrong (because something alawys goes wrong, I would like to be prepared)
So how to enter safe mode and disable my module?
And you said that if this doesnt work I can boot from recovery image (what image? is stock recovery allright? (I don't have TWRP yet (I will install it, once I figure out how), and I explained the reasons in this thread: https://forum.xda-developers.com/t/...-app-after-you-have-root-with-magisk.4564363/ )
Thanks
Click to expand...
Click to collapse
Hi
I don't have a Samsung phone and as far as I know Samsung uses other tools then other vendors for accessing the phone ...
Anyway, these are the instructions to do this on an ASUS Zenfone 8 (using fastboot and adb):
To enter the safe mode just press the power button; wait until the dialog with restart, power-off, etc occurs. Klick on the restart button in that dialog without releasing the power button of the phone. A new dialog to confirm the Save mode should appear.
To boot the ASUS Zenfone 8 from the recovery image boot the phone into the bootloader
adb reboot bootloader
and then issue on the PC
sudo fastboot boot <recovery_image>
<recovery_image> can either be the TWRP image for the phone or the recovery image for the LineageOS (or any other recovery with enabled access via adb).
adb is enabled by default in the TWRP image; in the LineageOS access via adb must be enabled via a menu entry after booting from the image.
AFAIK the stock recovery from Android does not support access via adb.
The phone can also be booted from the recovery installed on the phone via
adb reboot recovery
if the installed recovery supports access via adb.
And, for the records:
In most cases where the OS is loaded after booting the phone but seems to hang, access via adb will already work.
The Magisk Modules are stored in sub directories the directory /data/adb/modules/ , e.g.:
Bash:
ASUS_I006D:/ # ls -l /data/adb/modules/
total 21
drwxr-xr-x 3 root root 3452 1970-01-29 22:32 MiXplorer
drwxr-xr-x 4 root root 3452 1970-01-29 22:32 PlayStore_for_MicroG
drwxr-xr-x 5 root root 3452 1970-01-29 22:32 addbin
drwxr-xr-x 3 root root 3452 1970-01-29 22:32 bootctl-binary
drwxr-xr-x 5 root root 3452 1970-02-01 14:10 btop++
drwxrwxrwx 3 root root 3452 1970-01-29 22:32 nano-ndk
drwxr-xr-x 3 root root 3452 1970-01-29 22:32 ssh
ASUS_I006D:/ #
To disable a Magisk module after the next reboot create the file
/data/adb/modules/<modulename>/disable
To force Magisk to remove a Magisk module after the next reboot create the file
/data/adb/modules/<modulename>/remove
(see also here: https://forum.xda-developers.com/t/some-hints-for-using-magisk-on-android-phones.4471857/)
Note that Magisk will disable all Magisk modules automatically if the phone is booted into Safe mode.
regards
Bernd

Categories

Resources