topjohnwu / Magisk

The Magic Mask for Android
GNU General Public License v3.0
47.6k stars 12.09k forks source link

Magiskinit without magisk-services #2405

Closed hrap1919 closed 4 years ago

hrap1919 commented 4 years ago

Dear topjohnwu!

Thank for your great effort in development of the program!

Could you please to consider a preparation of a special version of magiskinit which only allow to boot, run post-fs-data.d scripts with superuser privelgies and exec the original init. After that no any actions and services are not needed including the installation of the stub magisk app.

You know that currently Magisk is somehow detected by Google, that prevents to pay by phone via GPay. There are several dirty fixes in /data/data/com.google.android.gms, each of them is not a solution at all. I want to check and investigate the problem on a maximally clean system. At least I want to know if the problem goes from the booting process, or not.

I am trying to do this just killing magiskd from post-fs-data.d and service.d (two times!) and unmounting everything in /sbin. Then safety test says ok but Gpay eventually detects the non-stock state of the device. I think that my scripts can not stop and revert everything related to magisk services (sockets, properties, etc..).

Also I think that such lightweight version of magisk can be useful itself. Sometimes a possibility to start an sshd-service is fine without full root integration. On the modern system-as-root devices even this requires many tricks which hard to make manually.

My device is Motorola G7 Power (ocean), Android 9, aarch64.

Thanks.

hrap1919 commented 4 years ago

Also, may be a stupid question. MagiskHide detects activity of some apps and try to unmount the root-related staff in their namespaces. Why not to try to do the reverse: mount the root staff in the namespaces of selected apps, for the apps which actually need the root-access?

Fox2Code commented 4 years ago

MagiskHide also work for modules Mounting magisk only for apps that need root will break almost all modules This why MagiskHide hide only on apps that don't work when root is detected

topjohnwu commented 4 years ago

@hrap1919 install Magisk with no modules and then uninstall Magisk Manager is as clean as you can get possible. Google is detecting other things, not specifically Magisk.

hrap1919 commented 4 years ago

@topjohnwu did you forget about the stub app which will be installed anyway?

hrap1919 commented 4 years ago

Ok, I have changed magiskrc.h replacing magisk services by my own script, and recompiled magiskinit. Amost everything works as intended. I just do not understand why /init remains mounted as tmpfs. I see where you patch /init in the code, but I do not see where you mount and umount it. Does /init remain mounted during normal magisk boot?