tiann / KernelSU

A Kernel based root solution for Android
https://kernelsu.org
GNU General Public License v3.0
10.63k stars 1.74k forks source link

How do I modify the files in the /system path? #322

Closed Imzpy closed 1 year ago

Imzpy commented 1 year ago

I want to add a file or folder in the path/system/etc, But when I create a file or folder, will prompt "Read only file system". I have seen some articles that can use the systemless method to add files or folders, But I don't know how to do it in kernelsu, Do I need to install zygisk? Place the file I want to add in the /data/adb/ksu/modules/zygisksu/system/etc/xxx.conf directory? like this? Is there any other way? Can I use this method without installing modules?

Please help me.tks!

Imzpy commented 1 year ago

Last night, I conducted a test , created the required files in the path "/data/adb/ksu/modules/", such as "/data/adb/ksu/modules/mroot/system/etc/xxx. conf". When I restart my phone, I find that using the command "ls - al/system/etc | grep xxx. conf" , can output the existence of this file.

I want to know when the file created in this way was loaded? After the file system has been loaded?

If you can,please publish some tutorials on the official website, If it can include the principle and the process and load time , That would be perfect. Thank you.

Imzpy commented 1 year ago

One more question, When the original file already exists, Will creating a file with the same name overwrite it? What if I want to delete a file? What should I do? Please help me, thank you very much.

tiann commented 1 year ago
  1. To modify /system, you should use modules, modules in KernelSU works nearly same way as Magisk, check the magisk document first: https://topjohnwu.github.io/Magisk/guides.html#magisk-modules
  2. KernelSU use overlayfs to modify system, you can use mknod filename c 0 0 in the module dir to delete filename in the same directory in system.
Imzpy commented 1 year ago

Thank you very much for your help, It is recommended that you annotate the overayfs on the official website, And attach a module description for magisk, This is very friendly to newcomers.

tiann commented 1 year ago

Thanks for your advice, I am writing a document about module

tiann commented 1 year ago

https://kernelsu.org/guide/module.html#system-directory

Imzpy commented 1 year ago

Thank you very much. I saw your update yesterday

deyloTT commented 1 year ago

Hey, i was reading through the pages about modulea but im yet to understand how do i edit /system/build.prop what i want is to force dark mode system wide. I usually add a line to build.prop but since this is my first time using kernelsu, i dont know how to get it done. Simply trying to edit the file doesn’t work anymore

tiann commented 1 year ago

Hey, i was reading through the pages about modulea but im yet to understand how do i edit /system/build.prop what i want is to force dark mode system wide. I usually add a line to build.prop but since this is my first time using kernelsu, i dont know how to get it done. Simply trying to edit the file doesn’t work anymore

https://kernelsu.org/guide/module.html#system-prop same as Magisk