KernelSU icon indicating copy to clipboard operation
KernelSU copied to clipboard

KSU does not work in AVD in LKM mode by manually patching ramdisk.img

Open h4ckm310n opened this issue 1 year ago • 0 comments

Please check before submitting an issue

  • [X] I have searched the issues and haven't found anything relevant
  • [X] I will upload bugreport file in KernelSU Manager - Settings - Report log
  • [X] I know how to reproduce the issue which may not be specific to my device

Describe the bug

I am trying to install KernelSU into AVD on MacOS through LKM mode, since there is not boot.img, I manually patched ramdisk.img according to https://github.com/tiann/KernelSU/blob/main/userspace/ksud/src/boot_patch.rs. AVD can boot as usual, but the APP still shows "Not installed". Set SELinux to permissive mode does not work as well. Is it a compatibility issue or is there something wrong in my patching steps?

To Reproduce

Patching steps:

magiskboot decompress ramdisk.img ramdisk.cpio
magiskboot cpio ramdisk.cpio "mv init init.real"
magiskboot cpio ramdisk.cpio "add 0755 init ksuinit"
magiskboot cpio ramdisk.cpio "add 0755 kernelsu.ko android14-6.1_kernelsu.ko"
magiskboot compress=lz4_legacy ramdisk.cpio ramdisk.img

Where "ksuinit" is from https://github.com/tiann/KernelSU/blob/main/userspace/ksud/bin/aarch64/ksuinit and "android14-6.1_kernelsu.ko" is from https://github.com/tiann/KernelSU/releases/download/v1.0.1/android14-6.1_kernelsu.ko.

Boot AVD:

emulator -avd Medium_Desktop_API_34 -no-snapshot-save -no-snapshot-load -selinux permissive -verbose -show-kernel |& grep -i -e 'kernelsu\|ksu'
[    0.231606][    T1] ksuinit::init[1]: Hello, KernelSU!
[    0.232119][    T1] ksuinit::init[1]: KernelSU version: 0
[    0.232632][    T1] ksuinit::init[1]: Loading kernelsu.ko..
[    0.292229][    T1] kernelsu: no symbol version for module_layout
[    0.292968][    T1] kernelsu: module verification failed: signature and/or required key missing - tainting kernel
[    0.297516][    T1] ksuinit::init[1]: init is init.real

Expected behavior

KernelSU is installed and works.

Screenshots

Screenshot

Logs

[    0.231606][    T1] ksuinit::init[1]: Hello, KernelSU!
[    0.232119][    T1] ksuinit::init[1]: KernelSU version: 0
[    0.232632][    T1] ksuinit::init[1]: Loading kernelsu.ko..
[    0.292229][    T1] kernelsu: no symbol version for module_layout
[    0.292968][    T1] kernelsu: module verification failed: signature and/or required key missing - tainting kernel
[    0.297516][    T1] ksuinit::init[1]: init is init.real

Device info

  • Device: Android Virtual Device
  • OS Version: 14
  • KernelSU Version: v1.0.1
  • Kernel Version: 6.1.23-android14-4-00257-g7e35917775b8-ab9964412

Additional context

No response

h4ckm310n avatar Sep 25 '24 02:09 h4ckm310n