Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modules_update.img doesn't get processed during initial KSU setup boot #945

Closed
osm0sis opened this issue Sep 11, 2023 · 6 comments
Closed

Comments

@osm0sis
Copy link

osm0sis commented Sep 11, 2023

Describe the bug
On non-GKI devices the AnyKernel3 installation zip for a KernelSU-supporting custom kernel may also require to change .ko kernel modules for feature support, and these could be needed for the device to boot correctly into the ROM.

This can normally be done with a Magisk/KernelSU helper module that AK3 creates during installation, however if it's the initial installation of KernelSU the modules_update.img doesn't appear to get processed during boot, and instead shows as a pending module until the next reboot.

Expected behaviour
During the initial KSU setup boot (i.e. when KernelSU itself is first installed), KernelSU should setup its /data/adb files and then look for an existing modules_update.img and process it as it normally would.

Smartphone (please complete the following information):

  • Device: OnePlus 7T
  • OS: Lineage 20
  • Version: KernelSU 11191 + Manager v0.6.7 (11210)

Additional context
In case it's of use, I discovered this behavior while adding KernelSU helper module support to AK3 in osm0sis/AnyKernel3@4030d36 (see the NOTE at the bottom of the commit message).

@tiann
Copy link
Owner

tiann commented Sep 12, 2023

KernelSU's module system can only work after it is initialized once after the manager is launched. If you only flash the kernel without launching the manager, the module will not work; in this case, there is no way to process modules_update.img.

If the manager has been initialized once and you want the manager to process modules_update.img instead of modules.img, you can create /data/adb/ksu/update: https://github.com/tiann/KernelSU /blob/main/userspace/ksud/src/event.rs#L132

@osm0sis
Copy link
Author

osm0sis commented Sep 12, 2023

Hmm, yeah I've already got the update flagged: osm0sis/AnyKernel3@4030d36#diff-703f70c41865bc8e07b7f5da93d9d052658d938a58435ee3f04f5df3a4e65794R422

So seems we've got a chicken-egg situation, unfortunately, where KernelSU processing the modules_update.img requires the app be run once while already rooted... I guess non-GKI device custom kernels may have to supply a more generic build for initial flashing, then once KernelSU is initialized they could get their users to switch to the more complex build which requires overlayed kernel modules to boot. 🤔

@tiann
Copy link
Owner

tiann commented Sep 12, 2023

There is a workaround: pack the ksud to module and copy it to /data/adb. This is the only thing manager do now.

@osm0sis
Copy link
Author

osm0sis commented Sep 13, 2023

There is a workaround: pack the ksud to module and copy it to /data/adb. This is the only thing manager do now.

Ahah! Thank you for this clue, I think we can do one better and dump the ksud directly from the KernelSU Manager APK from recovery and then all will be seamless for custom KSU kernels that require the helper module to boot! 🤠

@osm0sis osm0sis closed this as not planned Won't fix, can't repro, duplicate, stale Sep 13, 2023
@osm0sis
Copy link
Author

osm0sis commented Sep 13, 2023

@tiann, I'm confused though.. if I can dump ksud before first install and the KernelSU app only needs to have been installed (and not even run) for me to dump that, and then it'll process the modules_update.img like normal, then couldn't KernelSU itself just do that during boot?

Edit: Oh wait, you need decrypted data to dump ksud, so that's too late to then use it to set up the overlays, of course! 🤦‍♂️🙃

osm0sis added a commit to osm0sis/AnyKernel3 that referenced this issue Sep 13, 2023
- KernelSU currently requires the Manager app be run after first rooted to dump /data/adb/ksud, and then it will process any pending modules_update.img on the next reboot
- the above is problematic since some custom kernels providing KernelSU support will require a working module system to overlay .ko kernel modules needed for feature support and sometimes the ROM won't boot without these matching
- work around this KernelSU behavior by dumping ksud ourselves as-needed during the AK3 helper module installation, allowing seamless initial KernelSU kernel support installation with AK3 helper module .ko support

See: tiann/KernelSU#945
@tiann
Copy link
Owner

tiann commented Sep 14, 2023

@tiann, I'm confused though.. if I can dump ksud before first install and the KernelSU app only needs to have been installed (and not even run) for me to dump that, and then it'll process the modules_update.img like normal, then couldn't KernelSU itself just do that during boot?

This is of course possible, but we didn't know this was the case at the time; we are considering embedding ksud into the kernel image without relying on the manager. #130 #929

kibria5 pushed a commit to kibria5/AnyKernel3 that referenced this issue Sep 15, 2023
- KernelSU currently requires the Manager app be run after first rooted to dump /data/adb/ksud, and then it will process any pending modules_update.img on the next reboot
- the above is problematic since some custom kernels providing KernelSU support will require a working module system to overlay .ko kernel modules needed for feature support and sometimes the ROM won't boot without these matching
- work around this KernelSU behavior by dumping ksud ourselves as-needed during the AK3 helper module installation, allowing seamless initial KernelSU kernel support installation with AK3 helper module .ko support

See: tiann/KernelSU#945
clarencelol pushed a commit to clarencelol/AnyKernel3 that referenced this issue Sep 16, 2023
- KernelSU currently requires the Manager app be run after first rooted to dump /data/adb/ksud, and then it will process any pending modules_update.img on the next reboot
- the above is problematic since some custom kernels providing KernelSU support will require a working module system to overlay .ko kernel modules needed for feature support and sometimes the ROM won't boot without these matching
- work around this KernelSU behavior by dumping ksud ourselves as-needed during the AK3 helper module installation, allowing seamless initial KernelSU kernel support installation with AK3 helper module .ko support

See: tiann/KernelSU#945
candyceline pushed a commit to Danda420/kernel_xiaomi_sm8250 that referenced this issue Sep 18, 2023
- KernelSU currently requires the Manager app be run after first rooted to dump /data/adb/ksud, and then it will process any pending modules_update.img on the next reboot
- the above is problematic since some custom kernels providing KernelSU support will require a working module system to overlay .ko kernel modules needed for feature support and sometimes the ROM won't boot without these matching
- work around this KernelSU behavior by dumping ksud ourselves as-needed during the AK3 helper module installation, allowing seamless initial KernelSU kernel support installation with AK3 helper module .ko support

See: tiann/KernelSU#945
diphons pushed a commit to diphons/D8G_Kernel_Marble that referenced this issue Sep 21, 2023
- KernelSU currently requires the Manager app be run after first rooted to dump /data/adb/ksud, and then it will process any pending modules_update.img on the next reboot
- the above is problematic since some custom kernels providing KernelSU support will require a working module system to overlay .ko kernel modules needed for feature support and sometimes the ROM won't boot without these matching
- work around this KernelSU behavior by dumping ksud ourselves as-needed during the AK3 helper module installation, allowing seamless initial KernelSU kernel support installation with AK3 helper module .ko support

See: tiann/KernelSU#945
Danda420 pushed a commit to Danda420/kernel_xiaomi_sm8250 that referenced this issue Sep 23, 2023
- KernelSU currently requires the Manager app be run after first rooted to dump /data/adb/ksud, and then it will process any pending modules_update.img on the next reboot
- the above is problematic since some custom kernels providing KernelSU support will require a working module system to overlay .ko kernel modules needed for feature support and sometimes the ROM won't boot without these matching
- work around this KernelSU behavior by dumping ksud ourselves as-needed during the AK3 helper module installation, allowing seamless initial KernelSU kernel support installation with AK3 helper module .ko support

See: tiann/KernelSU#945
ArbitraryFox pushed a commit to ArbitraryFox/AnyKernel3 that referenced this issue Oct 14, 2023
- KernelSU currently requires the Manager app be run after first rooted to dump /data/adb/ksud, and then it will process any pending modules_update.img on the next reboot
- the above is problematic since some custom kernels providing KernelSU support will require a working module system to overlay .ko kernel modules needed for feature support and sometimes the ROM won't boot without these matching
- work around this KernelSU behavior by dumping ksud ourselves as-needed during the AK3 helper module installation, allowing seamless initial KernelSU kernel support installation with AK3 helper module .ko support

See: tiann/KernelSU#945
Kyuofox pushed a commit to Kyuofox/AnyKernel3 that referenced this issue Oct 15, 2023
- KernelSU currently requires the Manager app be run after first rooted to dump /data/adb/ksud, and then it will process any pending modules_update.img on the next reboot
- the above is problematic since some custom kernels providing KernelSU support will require a working module system to overlay .ko kernel modules needed for feature support and sometimes the ROM won't boot without these matching
- work around this KernelSU behavior by dumping ksud ourselves as-needed during the AK3 helper module installation, allowing seamless initial KernelSU kernel support installation with AK3 helper module .ko support

See: tiann/KernelSU#945
Alone0316 pushed a commit to Alone0316/anykernel that referenced this issue Oct 21, 2023
- KernelSU currently requires the Manager app be run after first rooted to dump /data/adb/ksud, and then it will process any pending modules_update.img on the next reboot
- the above is problematic since some custom kernels providing KernelSU support will require a working module system to overlay .ko kernel modules needed for feature support and sometimes the ROM won't boot without these matching
- work around this KernelSU behavior by dumping ksud ourselves as-needed during the AK3 helper module installation, allowing seamless initial KernelSU kernel support installation with AK3 helper module .ko support

See: tiann/KernelSU#945
Alone0316 pushed a commit to Alone0316/anykernel that referenced this issue Oct 21, 2023
- KernelSU currently requires the Manager app be run after first rooted to dump /data/adb/ksud, and then it will process any pending modules_update.img on the next reboot
- the above is problematic since some custom kernels providing KernelSU support will require a working module system to overlay .ko kernel modules needed for feature support and sometimes the ROM won't boot without these matching
- work around this KernelSU behavior by dumping ksud ourselves as-needed during the AK3 helper module installation, allowing seamless initial KernelSU kernel support installation with AK3 helper module .ko support

See: tiann/KernelSU#945
zeta96 pushed a commit to zeta96/AnyKernel3 that referenced this issue Oct 22, 2023
- KernelSU currently requires the Manager app be run after first rooted to dump /data/adb/ksud, and then it will process any pending modules_update.img on the next reboot
- the above is problematic since some custom kernels providing KernelSU support will require a working module system to overlay .ko kernel modules needed for feature support and sometimes the ROM won't boot without these matching
- work around this KernelSU behavior by dumping ksud ourselves as-needed during the AK3 helper module installation, allowing seamless initial KernelSU kernel support installation with AK3 helper module .ko support

See: tiann/KernelSU#945
NitroGear504 pushed a commit to NitroGear504/anykernel3 that referenced this issue Nov 11, 2023
- KernelSU currently requires the Manager app be run after first rooted to dump /data/adb/ksud, and then it will process any pending modules_update.img on the next reboot
- the above is problematic since some custom kernels providing KernelSU support will require a working module system to overlay .ko kernel modules needed for feature support and sometimes the ROM won't boot without these matching
- work around this KernelSU behavior by dumping ksud ourselves as-needed during the AK3 helper module installation, allowing seamless initial KernelSU kernel support installation with AK3 helper module .ko support

See: tiann/KernelSU#945
LeCmnGend pushed a commit to LeCmnGend/AnyKernel3 that referenced this issue Jan 14, 2024
- KernelSU currently requires the Manager app be run after first rooted to dump /data/adb/ksud, and then it will process any pending modules_update.img on the next reboot
- the above is problematic since some custom kernels providing KernelSU support will require a working module system to overlay .ko kernel modules needed for feature support and sometimes the ROM won't boot without these matching
- work around this KernelSU behavior by dumping ksud ourselves as-needed during the AK3 helper module installation, allowing seamless initial KernelSU kernel support installation with AK3 helper module .ko support

See: tiann/KernelSU#945
LeCmnGend pushed a commit to LeCmnGend/AnyKernel3 that referenced this issue Jan 14, 2024
- KernelSU currently requires the Manager app be run after first rooted to dump /data/adb/ksud, and then it will process any pending modules_update.img on the next reboot
- the above is problematic since some custom kernels providing KernelSU support will require a working module system to overlay .ko kernel modules needed for feature support and sometimes the ROM won't boot without these matching
- work around this KernelSU behavior by dumping ksud ourselves as-needed during the AK3 helper module installation, allowing seamless initial KernelSU kernel support installation with AK3 helper module .ko support

See: tiann/KernelSU#945
zeta96 pushed a commit to zeta96/AnyKernel3 that referenced this issue Mar 1, 2024
- KernelSU currently requires the Manager app be run after first rooted to dump /data/adb/ksud, and then it will process any pending modules_update.img on the next reboot
- the above is problematic since some custom kernels providing KernelSU support will require a working module system to overlay .ko kernel modules needed for feature support and sometimes the ROM won't boot without these matching
- work around this KernelSU behavior by dumping ksud ourselves as-needed during the AK3 helper module installation, allowing seamless initial KernelSU kernel support installation with AK3 helper module .ko support

See: tiann/KernelSU#945
unknownbaka pushed a commit to unknownbaka/AnyKernel3 that referenced this issue Mar 9, 2024
- KernelSU currently requires the Manager app be run after first rooted to dump /data/adb/ksud, and then it will process any pending modules_update.img on the next reboot
- the above is problematic since some custom kernels providing KernelSU support will require a working module system to overlay .ko kernel modules needed for feature support and sometimes the ROM won't boot without these matching
- work around this KernelSU behavior by dumping ksud ourselves as-needed during the AK3 helper module installation, allowing seamless initial KernelSU kernel support installation with AK3 helper module .ko support

See: tiann/KernelSU#945
nekoprjkt pushed a commit to nekoprjkt/Anykernel3 that referenced this issue Mar 15, 2024
- KernelSU currently requires the Manager app be run after first rooted to dump /data/adb/ksud, and then it will process any pending modules_update.img on the next reboot
- the above is problematic since some custom kernels providing KernelSU support will require a working module system to overlay .ko kernel modules needed for feature support and sometimes the ROM won't boot without these matching
- work around this KernelSU behavior by dumping ksud ourselves as-needed during the AK3 helper module installation, allowing seamless initial KernelSU kernel support installation with AK3 helper module .ko support

See: tiann/KernelSU#945
shygosh pushed a commit to shygosh/AnyKernel3 that referenced this issue Apr 24, 2024
- KernelSU currently requires the Manager app be run after first rooted to dump /data/adb/ksud, and then it will process any pending modules_update.img on the next reboot
- the above is problematic since some custom kernels providing KernelSU support will require a working module system to overlay .ko kernel modules needed for feature support and sometimes the ROM won't boot without these matching
- work around this KernelSU behavior by dumping ksud ourselves as-needed during the AK3 helper module installation, allowing seamless initial KernelSU kernel support installation with AK3 helper module .ko support

See: tiann/KernelSU#945
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants