Related
Hi,
So I want to systemlessly replace a huge number of files (images)/or just an entire folder within an app.
For example: inside app.apk there is a folder "assets/images". I want to replace every single image that is in that folder with other ones.
Is this possible with a Magisk Module?
Grab a copy of the apk, edit it to your liking, and then make a Magisk module that replaces the stock apk with your edited one.
That would be the way to do it in Magisk.
If you want it done in a more automatic fashion, you would have to create a script or program that extracts the apk, edits it, and then creates and installs a Magisk module that replaces the stock apk with the edited one.
Yes, I would like an automated one... I think it should be done with post-fs-data.sh. But is it capable of decompiling and recompiling apk files?
No. And you don't want to do something like that during post-fs-data.
Your best bet (IMHO) is to do it during installation of the module, somehow. An automated process that pulls the apk from /system, decompiles, edits, and recompiles it, before installing it as a Magisk module.
Why do you need the automation? Just for fun, or do you specifically need it? I often find my reason for doing something to be: "to see if I can"... :laugh:
Didgeridoohan said:
No. And you don't want to do something like that during post-fs-data.
Your best bet (IMHO) is to do it during installation of the module, somehow. An automated process that pulls the apk from /system, decompiles, edits, and recompiles it, before installing it as a Magisk module.
Why do you need the automation? Just for fun, or do you specifically need it? I often find my reason for doing something to be: "to see if I can"... :laugh:
Click to expand...
Click to collapse
Yes, I want to learn and see if I can do it. And Ivdont want to make a new apk everytime the original app updates. If you have a script this happens automatically.
Also if I program config.sh (this is the install script right?) to automate this process would it still me systemless? I think even when I uninstall the module the mod would still be there...
ilivss said:
Also if I program config.sh (this is the install script right?) to automate this process would it still me systemless? I think even when I uninstall the module the mod would still be there...
Click to expand...
Click to collapse
If you copy the apk from /system before working on it, and then make it into a Magisk module that magic mounts the apk over the stock apk, it'll be a systemless modification. If you then proceed to uninstall the module, the modified apk will not be replacing the original apk anymore, returning everything to stock. Anything else would not be systemless...
Didgeridoohan said:
Why do you need the automation? Just for fun, or do you specifically need it? I often find my reason for doing something to be: "to see if I can"... :laugh:
Click to expand...
Click to collapse
I got one that I actually need. Rotation set to landscape and auto-rotation off in the head unit upgrade I recently put on. However, my unit orientation is portrait.
I have Magisk installed, and I need it to override this setting and change the default to portrait.
Is this even possible or sound like something fun to do ?
SOLVED! (Solution below)
Alright, so I tried everything I could, and spent almost my day trying to fix this. First of all what I did so far (it's maybe not the right method, so I let you know):
- Tried smali patcher
- Deodex error
- Google for hours, find a solution
- Search for /system folder, couldn't find NOWHERE, even with ES file explorer (root was checked)
- Downloaded "File explorer root browser"
(it's when the interesting part begins)
- Found system folder, copied to the storage, but somehow it didn't copy everything, only the apps an 2 empty folders
- So I copied the framework folder too into the system, and the build.prop
- Connecting phone, the folder is not even there
- Opened TWRP, because I read that I have to use that too, file manager, found the folders, copied them there into ANOTHER folder, and somehow it was there when I checked from the PC
- Finally finishing the deodexing, everything was okay, smali-blaksmali browsed etc.
- Opening smali patcher again, trying to browse services.jar, and of course it wasn't there, somehow it didn't copy that one (but I believe everything else was there)
- Searching for it via TWRP, copy-paste, PC, copy-paste into the framework, deodexer, bootclasspath not found
- I thought it's because the other files already deodexed, so I copied them from the phone again, put services.jar into the right folder, deodexing, done.
- Browsing in smali patcher, click on Path jar, I was so happy, I thought it's over, I did it, I'm the king.....
- "Target JAR must be deodexed"
- (UPDATE) I was able to copy the system folder properly with TWRP, deodexed, now smali patcher says "Mock location class not found".
Sorry for the long post, but I thought I share every information. I'm really sad. And really desperate. I read this forum too for help, and saw some really helpful people, I really hope someone can help me too.
For the TWRP part, I read about some adb sideload, read a llllot of things about it, but all of them was about copying files TO the phone, not FROM it, that's why I did it like this.
So again please help, because at this point I really don't know what to do.
As the device: Android version 7.0, Xiaomi redmi note 4.
Deodexer version 1.6, smali patcher 0.3.7 and 0.4.0
Solution
So apparently I'm blind. First of all I did everything by a reddit guide named "[mini Guide] [Android] [ROOT] Smalli Patcher: Deodexing services.jar "
It didn't really help, and even if I read some comments, I missed the most important to me, the comment of ajdroid270, who linked the correct, deodexed files to the phones Redmi note 4 (MIUI 10 - 8.12.20) and OnePlus 6T with 9.0.11 version. So if you have one of these devices, just simply download the files he mentioned, copy them to your phone, and flash with magisk. If not but you're stuck... well... praying helps sometimes.
I have a Pixel 5.
The stock rom does not have South Korean carrier mbn files.
I managed to source the files from the Internet.
I tried to copy paste it into
/system/vendor/rfs/msm/mpss/readonly/vendor/mbn/mcfg_sw/generic/Pixel
but it doesn't work (I can't change folder properties to write).
I tried using the volte_switch.zip from this guide
Module to enable 5G/VoLTE/VoWIFI on Pixel4a 5G/Pixel5
Update (9 Oct 2022): Upload module here. Update (7 Apr 2021): If you are looking for the manual way to add 5G support besides the magisk module way or the module does not work for you. Please refer to #54 for the detailed steps. Thanks again to...
forum.xda-developers.com
and modified the files to add the mbn files of my choice but flashing the zip deletes all folders under generic/Pixel/ except my country's folder.
Removing the "module" from magisk manager and rebooting brings everything back.
Is it possible to make a flashable zip to add the mbn files?
Or does it require repacking the radio.img?
Or does the volte_switch.zip install the mbn files systemlessly?
If you post your Magisk module it might be easier to say why it doesn't work.
But if the Pixel directory is emptied out it sounds like you have a replace file in there causing issues. Just guessing though...
Didgeridoohan said:
If you post your Magisk module it might be easier to say why it doesn't work.
But if the Pixel directory is emptied out it sounds like you have a replace file in there causing issues. Just guessing though...
Click to expand...
Click to collapse
Thanks for the suggestion. I've uploaded the flash zip file as well. When I went through the install script, I did notice the "replace" code in there. How should I change it to?
Ok after much googling, I figured out.
I added in all my original mbn folders as well and then typed in:
REPLACE="
/system/vendor/rfs/msm/mpss/readonly/vendor/mbn/mcfg_sw/
"
into customize.sh
This Replaced the folder with all the original and new mbn files.
Ok, I thought it worked but it's not actually working.
The new mbn files seems to be there but when I force a mbn reload by changing sim cards, it still loads the "original" files as if the new files aren't actually there.
For countries/carriers that's not listed in google's official supported list, the phone uses a 'generic' carrier mbn which is located in the generic/pixel/common/wildcard/pixel_wildcard/mcfg_sw.mbn.
This wildcard mbn is the generic carrier file that has 5G disabled by default. So in theory, all I need to do is replace the wildcard mbn with a different carrier's mbn which has 5G enabled by default. Then create magisk module and flash it to have it replaced.
My module appears to replace the files but the new files don't actually get loaded. When I change sim cards to force a reloading of mbn file, It still loads the old files.
What can I do to fix this? Any help is appreciated. Thanks.
Attached is my module.
Calling @Didgeridoohan good sir, if you could kindly provide me with knowledge about the post above, if possible. Thanks.
swangjang said:
Calling @Didgeridoohan good sir, if you could kindly provide me with knowledge about the post above, if possible. Thanks.
Click to expand...
Click to collapse
Busy life...
In theory you shouldn't at all need to do that replace function and add back all the stock files with the module. Magisk should take care of mounting or replacing only the files you need, so anything else is just redundant... But if it works, sure.
But it seems like it doesn't.
If you can verify with a file explorer that the files have been replaced with the ones from your module and the values still are taken from the original files that very likely means that there's more to it than just replacing those files.
You could provide the module install log and the Magisk log (Canary release so that it's actually useful) to see if there's anything wrong there.
hi.I rooted the phone using magisk, it was installed and apparently rooted, but I have a problem with root file programs like root explorer or es file manager. The problem is that the rw mount does not work or I even have trouble installing busybox.
my phone : redmi note 10 pro
miui version : 12.5.8 and 12.5.9
android version : 11
magiak version : 23
I don't know deeply this case, but it was told that mounting r/w is not possible in recent Androids for system partitions.
However this is Magisk benefit that you put your files to it's tree and Magisk overmounts original files, I guess it does it using option "mount --bind".
You put file into /data/adb/modules/<module_name>/system/etc/<exemplary file> and after reboot you see it under /system/etc/.
At least the above path was checked personally by me by changing /system/etc/gps_psds.conf file to my own.
F308 said:
I don't know deeply this case, but it was told that mounting r/w is not possible in recent Androids for system partitions.
However this is Magisk benefit that you put your files to it's tree and Magisk overmounts original files, I guess it does it using option "mount --bind".
You put file into /data/adb/modules/<module_name>/system/etc/<exemplary file> and after reboot you see it under /system/etc/.
At least the above path was checked personally by me by changing /system/etc/gps_psds.conf file to my own.
Click to expand...
Click to collapse
I want to install a program as a system, but it is not possible without rw mount, do you know the solution?
I presume you have at least one Magisk module installed.
Put it into /data/adb/modules/<any_Magisk_module_name>/PATH_WHERE_YOU_WANT_TO_HAVE_IT/.
If wanted directories don't exist - create them.
Reboot.
Check.
Maybe tune permissions to make file executable.
Report result here.
F308 said:
I presume you have at least one Magisk module installed.
Put it into /data/adb/modules/<any_Magisk_module_name>/PATH_WHERE_YOU_WANT_TO_HAVE_IT/.
If wanted directories don't exist - create them.
Reboot.
Check.
Maybe tune permissions to make file executable.
Report result here.
Click to expand...
Click to collapse
I have no problem installing the module. My problem is accessing the system / app folder and making changes.
What changes do you want to perform?
Change one or more of files there, right?
If so - I repeat.
Put your modified file(s) under /data/adb/modules/<any_installed_Magisk_module_name>/system/app/ and reboot.
F308 said:
What changes do you want to perform?
Change one or more of files there, right?
If so - I repeat.
Put your modified file(s) under /data/adb/modules/<any_installed_Magisk_module_name>/system/app/ and reboot.
Click to expand...
Click to collapse
I do not want to install the module, I want to move an apk file to the system/app folder that is installed as a system and can not be deleted
I wasted my time.
Good luck.
I devoted a while to check that I was right suggesting what I suggested.
I have an LG V60 phone and I would like to put the phone in "high impedance mode" all the the time for more power to the earphones even if they are less than 50 ohm impedance.
In LG V40/50, it was very simple by rooting the phone and making some modifications in the one of the files that was in the "vendor/etc" directory. The problem with LG V60 is it does not allow any write access to the vendor folder at all.
So the only feasible option that I can think of is to create a Magisk module that replaces the original file with the modified one. My biggest disadvantage is not knowing anything about writing codes including Magisk module ones. So I was wondering if anyone could create a Magisk module that would replace the original file through Magisk?
ADDTIONAL INOFRMATION:
I am running Magisk 25 on a fully rooted LG V60.
The file that needs to be changed is mixer_paths.xml and it resides in the "vendor/etc" folder. I have created the modified file.
So if someone is able to develop a module to accomplish this, I will place the modified file in the "system/vendor/etc" folder of the Magisk module, as I understand it.
Many thanks for your support!
You can use this template system in future as its super easy
The template itself is here
GitHub - Zackptg5/MMT-Extended: Magisk Module Template Extended
Magisk Module Template Extended. Contribute to Zackptg5/MMT-Extended development by creating an account on GitHub.
github.com
click the Code button, then download zip
then extract the zip into a folder and rename the folder "MMT-Extended-master" to the something more meaningful, like the name of your module
Read the wiki and docs here to go step by step to create your first module:
Home
Magisk Module Template Extended. Contribute to Zackptg5/MMT-Extended development by creating an account on GitHub.
github.com
Notably the heading:
How do I make a MMT Extended mod?
The steps for a simple file addition/replacement module, which are simple, should be steps 1-4, then 8. Then zip up the modules (as a zip) and test.
For you, if you read along (in Step 3) you will need to create a folder vendor, under the existing system one, and then a further etc folder under vendor, and put the necessary file (mixer_paths.xml in there.
If you try and fail, post back and someone will assist. But we prefer people to at least read the documentation and try first, ideally...this is the way the great didgeridoohan mentored myself and many others, he was not big on spoonfeeding
Imagine the satisfaction you might get finding out youre capable of such feats...i promise its not rocket surgery
Feel free to PM even, if you get stuck and think you have a silly question - of course knowing me, and i do, you'll probably get an even sillier, and off topic answer as well...
hint: you can knock out this basic module in far far less time than it took me to write all this
Thank you!
So my changes look like this:
1. Put the modified file in the system/vendor/etc folder of the Magisk module.
2. Made the needed changes to the customize.sh as attached.
Royaltiger said:
Thank you!
So my changes look like this:
1. Put the modified file in the system/vendor/etc folder of the Magisk module.
2. Made the needed changes to the customize.sh as attached.
Click to expand...
Click to collapse
Yes, though you'll need to uncomment (remove the leading #) from the set_perm lines to make them active, also you only really need the 2nd one
Royaltiger said:
Thank you
73sydney said:
Yes, though you'll need to uncomment (remove the leading #) from the set_perm lines to make them active, also you only really need the 2nd one
Click to expand...
Click to collapse
Click to expand...
Click to collapse
So I made the module with the suggested changes in customize.sh and put the modified mixer_path.xml file in the system/vendor/etc folder of the module. Module installs fine with Magisk but when it reboots, the device hangs on the initial LG screen and does not go anywhere from there.
I am attaching the customize.sh snapshot. Also, attached is the module file.
See here under "Disabling/uninstalling modules manually" if youre not able to boot
Module Issues:Magisk and MagiskHide Installation and Troubleshooting guide
www.didgeridoohan.com
I am assuming that it is not possible to accomplish what I wanted to achieve.
Royaltiger said:
I am assuming that it is not possible to accomplish what I wanted to achieve.
Click to expand...
Click to collapse
mixer_paths files have been replaced for years, long before magisk even...i did it back as far as the Galaxy S2 from memory, so im not sure why this didnt work for you, was the mxer_paths file specifically for your device? i have no clear idea why it hasnt worked for you
this thread has a guide to making /system RW, so you could manually copy the file and overwrite it, but id really consider how much you want to replace mixer_paths before i set out to do that
V60 Bootloader Unlock and Magisk Root
Earlier today I was alerted to https://www.cnblogs.com/yanhua-tj/p/15525593.html which has the actual firehose and steps to unlock! However it seems to be in Simplified Chinese so I'll translate it here for you. The firehose is attached below...
forum.xda-developers.com
73sydney said:
mixer_paths files have been replaced for years, long before magisk even...i did it back as far as the Galaxy S2 from memory, so im not sure why this didnt work for you, was the mxer_paths file specifically for your device? i have no clear idea why it hasnt worked for you
this thread has a guide to making /system RW, so you could manually copy the file and overwrite it, but id really consider how much you want to replace mixer_paths before i set out to do that
V60 Bootloader Unlock and Magisk Root
Earlier today I was alerted to https://www.cnblogs.com/yanhua-tj/p/15525593.html which has the actual firehose and steps to unlock! However it seems to be in Simplified Chinese so I'll translate it here for you. The firehose is attached below...
forum.xda-developers.com
Click to expand...
Click to collapse
Actually I had no problem in editing the mixer_tavil.xml file in LG V40/50. But when it comes to LG V60, the file is read-only. There is no way to edit it due to dynamic partition. Hence, I was seeking the only option available i.e., via Magisk module.
Royaltiger said:
Actually I had no problem in editing the mixer_tavil.xml file in LG V40/50. But when it comes to LG V60, the file is read-only. There is no way to edit it due to dynamic partition. Hence, I was seeking the only option available i.e., via Magisk module.
Click to expand...
Click to collapse
So, I encountered the same problem and found what you did wrong. I was able to write my own Magisk module and it works wonderfully. It took so much time to understand how to do it because there is no proper tutorial.
If you are still active and trying to know how to do it the right way, here comes the explanation:
The Replace = " /system/vendor/etc/ " must not be written as it completely wipes the actual folder from your phone. This is why you were not able to turn the phone on. It should be like this:
Replace = " " (That part must be blank)
The rest of the code is good. If you try it like this now, you will see it will work, just like mine did.
Cheers
Does not work. May I see your module? Please upload it here as attachment.
I even put my edited file under /data/adb/modules/<my directory>/system/vendor/etc. It shows up in Magisk as a module and the file loads (as it is not visible in file explorer) but there is no change in volume. So the thing is not working.