Skip to content

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

Description

@h4ckm310n

Please check before submitting an issue

  • I have searched the issues and haven't found anything relevant
  • I will upload bugreport file in KernelSU Manager - Settings - Report log
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions