mywalkb / LSPosed_mod

My changes to LSPosed
GNU General Public License v3.0
3.65k stars 170 forks source link

cli does not work on kernelsu #69

Closed kiber-io closed 7 months ago

kiber-io commented 7 months ago

Steps to reproduce

  1. Install LSPosed_mod in kernelsu manager
  2. Reboot
  3. Enable cli in manager
  4. Try to run cli from /data/adb/lspd/bin

Expected behaviour

Cli works fine

Actual behaviour

Cli throw an error

/system/bin/sh: magisk: inaccessible or not found

Xposed Module List

-

Magisk Module List

-

LSPosed version

1.9.3 (7244) Zygisk

Android version

14

Magisk version

KernelSU 11682

Riru version

N/A

Version requirement

Logs

-

kiber-io commented 7 months ago

I apologize for ignoring some points, they are just unimportant in this case because the error is only in the cli script and it's not fixed in the debug build either.

mywalkb commented 7 months ago

does anything appear beyond the error?

emu64xa:/ # /data/adb/lspd/bin/cli                                                                                                                                                                                
/data/adb/lspd/bin/cli[13]: magisk: inaccessible or not found
Missing required subcommand
Usage: cli [-hV] [COMMAND]
  -h, help, --help         display this help message
  -V, version, --version   display version info
Commands:
  log
  backup
  modules
  restore
  scope
  status
2|emu64xa:/ # /data/adb/lspd/bin/cli status                                                                                                                                                                       
/data/adb/lspd/bin/cli[13]: magisk: inaccessible or not found
Enter pin code: 
API version: 100
Injection Interface: Zygisk
Framework version: 1.9.3_mod(7271)
System version: 14 (API 34)
Device: Google Google sdk_gphone64_x86_64 
System ABI: x86_64
mywalkb commented 7 months ago

When I corrected this issue I didn't have a physical or virtual device with kernelsu, and no one reported this issue to me, but now I have an avd so I can check. But you should have output beyond the error, if not there is another issue. As far as I know the path of the modules is fixed to /data/adb/modules

kiber-io commented 7 months ago

Oh, it turned out to be a double bug :D

cli does not issue anything when running through the Termux environment (when located in tsu). Therefore, I was given only an error about magisk and nothing more. Later I discovered that it does not work only in the termux environment and when working through the system shell (su) everything works. IMG_20240407_185559

kiber-io commented 7 months ago

So, there is indeed an error with magisk, but it does not affect the work, the script is working. The problem is running through Termux

mywalkb commented 7 months ago

Ok better, I will try also with Termux.

If you want hide that error you can replace /data/adb/lspd/bin/cli with

#!/system/bin/sh

dex_path=""
for DEXDIR in /data/adb/modules $(magisk --path 2>/dev/null)/.magisk/modules
do
    if [ -d "$DEXDIR/riru_lsposed" ]; then
        dex_path="$DEXDIR/riru_lsposed"
        break
    elif [ -d "$DEXDIR/zygisk_lsposed" ]; then
        dex_path="$DEXDIR/zygisk_lsposed"
        break
    fi
done

if [ -z "$dex_path" ]
then
    echo "No lsposed module path found"
    exit 1
fi

dex_path="$dex_path/daemon.apk"

java_potions="-Djava.class.path=$dex_path"

exec app_process $java_potions /system/bin org.lsposed.lspd.cli.Main "$@"

Anyway, I'll send a commit with the fix shortly

mywalkb commented 7 months ago

I haven't found a solution for termux sudo/tsu, the app_process starts without problems but then stops without errors and without continuing, I tried to set the environment variables BOOTCLASSPATH and other without success. I will try in the future to understand if there is a solution at the moment only su is supported.