Open ushu3323 opened 3 weeks ago
Please provide a full output of env
. Later may ask for other stuff, but environment variables is the first thing that may affect how Termux API commands work inside proot-distro.
Sure! here's the output inside a proot-distro session
localhost:~# env
USER=root
EXTERNAL_STORAGE=/sdcard
SHLVL=1
HOME=/root
OLDPWD=/etc
PAGER=less
BOOTCLASSPATH=/system/framework/telephony-ext.jar:/system/framework/core-oj.jar:/system/framework/core-libart.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/apache-xml.jar:/system/framework/org.apache.http.legacy.boot.jar
COLORTERM=
TMPDIR=/tmp
PULSE_SERVER=127.0.0.1
TERM=xterm-256color
ANDROID_DATA=/data
LC_COLLATE=C
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/data/data/com.termux/files/usr/bin:/system/bin:/system/xbin
ANDROID_ROOT=/system
LANG=en_US.UTF-8
PWD=/root
CHARSET=UTF-8
MOZ_FAKE_NO_SANDBOX=1
and here is outside a proot-distro session (termux enviroment) just in case
~ $ env
SHELL=/data/data/com.termux/files/usr/bin/bash
HISTCONTROL=ignoreboth
PREFIX=/data/data/com.termux/files/usr
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
PWD=/data/data/com.termux/files/home
LOGNAME=u0_a60
TERMUX_VERSION=0.118.1
EXTERNAL_STORAGE=/sdcard
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
HOME=/data/data/com.termux/files/home
TERMUX_API_VERSION=0.50.1
LANG=en_US.UTF-8
TERMUX_APK_RELEASE=F_DROID
TMPDIR=/data/data/com.termux/files/usr/tmp
SSH_CONNECTION=192.168.1.103 51680 192.168.1.101 8022
ANDROID_DATA=/data
TERM=xterm-256color
USER=u0_a60
SHLVL=1
ANDROID_ROOT=/system
BOOTCLASSPATH=/system/framework/telephony-ext.jar:/system/framework/core-oj.jar:/system/framework/core-libart.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/apache-xml.jar:/system/framework/org.apache.http.legacy.boot.jar
SSH_CLIENT=192.168.1.103 51680 8022
TERMUX_APP_PID=3604
PATH=/data/data/com.termux/files/usr/bin
SSH_TTY=/dev/pts/2
OLDPWD=/data/data/com.termux/files/home
_=/data/data/com.termux/files/usr/bin/env
Sorry to bother, but I've just discovered that the issue is not limited to termux-api; it affects every executable/command that is previously installed in the Termux environment, unless it’s in proot-distro.
Variables look good for Android 7.x.
If you are saying that all Termux commands do not work in proot-distro, try to run this:
proot pwd
termux-chroot pwd
Instead of pwd
you can put any other command, whatever known to fail under proot-distro. Report whether commands work or not.
Also you can try to start just termux-chroot
and try to run Termux api under its interactive shell.
Hi, I just tried what you suggested, and it seems to work fine. I think it might be related to Alpine Linux running the commands differently (just a guess). I’ll keep you updated if I find anything that doesn’t work. Here’s the output from the tests based on your suggestion:
~ $ proot pwd
/data/data/com.termux/files/home
~ $ termux-chroot pwd
/data/data/com.termux/files/home
~ $ echo "trying one of the termux-api commands using proot and termux-chroot"
trying one of the termux-api commands using proot and termux-chroot
~ $ proot termux-battery-status
WARNING: linker: /system/vendor/lib/hw/memtrack.clovertrail.so: unused DT entry: type 0xf arg 0x130
WARNING: linker: /system/vendor/lib/libsrv_um.so: unused DT entry: type 0xf arg 0xbe3
WARNING: linker: /system/vendor/lib/hw/memtrack.clovertrail.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
WARNING: linker: /system/vendor/lib/libsrv_um.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
WARNING: linker: /system/vendor/lib/hw/gralloc.clovertrail.so: unused DT entry: type 0xf arg 0x62a
WARNING: linker: /system/vendor/lib/libpvr2d.so: unused DT entry: type 0xf arg 0x79b
WARNING: linker: /system/vendor/lib/hw/gralloc.clovertrail.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
WARNING: linker: /system/vendor/lib/libpvr2d.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
{
"health": "GOOD",
"percentage": 40,
"plugged": "UNPLUGGED",
"status": "DISCHARGING",
"temperature": 25.899999618530273,
"current": -6
}
~ $ termux-chroot termux-battery-status
WARNING: linker: /vendor/lib/hw/memtrack.clovertrail.so: unused DT entry: type 0xf arg 0x130
WARNING: linker: /vendor/lib/libsrv_um.so: unused DT entry: type 0xf arg 0xbe3
WARNING: linker: /vendor/lib/hw/memtrack.clovertrail.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
WARNING: linker: /vendor/lib/libsrv_um.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
WARNING: linker: /vendor/lib/hw/gralloc.clovertrail.so: unused DT entry: type 0xf arg 0x62a
WARNING: linker: /vendor/lib/libpvr2d.so: unused DT entry: type 0xf arg 0x79b
WARNING: linker: /vendor/lib/hw/gralloc.clovertrail.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
WARNING: linker: /vendor/lib/libpvr2d.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
{
"health": "GOOD",
"percentage": 40,
"plugged": "UNPLUGGED",
"status": "DISCHARGING",
"temperature": 25.899999618530273,
"current": -14
}
~ $ echo "Starting termux-chroot and running termux-api commands"
Starting termux-chroot and running termux-api commands
~ $ termux-chroot
~ $ termux-battery-status
WARNING: linker: /vendor/lib/hw/memtrack.clovertrail.so: unused DT entry: type 0xf arg 0x130
WARNING: linker: /vendor/lib/libsrv_um.so: unused DT entry: type 0xf arg 0xbe3
WARNING: linker: /vendor/lib/hw/memtrack.clovertrail.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
WARNING: linker: /vendor/lib/libsrv_um.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
WARNING: linker: /vendor/lib/hw/gralloc.clovertrail.so: unused DT entry: type 0xf arg 0x62a
WARNING: linker: /vendor/lib/libpvr2d.so: unused DT entry: type 0xf arg 0x79b
WARNING: linker: /vendor/lib/hw/gralloc.clovertrail.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
WARNING: linker: /vendor/lib/libpvr2d.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
{
"health": "GOOD",
"percentage": 40,
"plugged": "UNPLUGGED",
"status": "DISCHARGING",
"temperature": 25.799999237060547,
"current": -3
}
~ $
Problem description I can't run succesfully termux-api commands inside proot-distro (using alpine linux), it causes segmentation fault. Works fine on default termux enviroment. I've tested the following commands: "termux-battery-status" "termux-brightness" "termux-volume"
Steps to reproduce
pkg update && pkg upgrade
termux-api
package:pkg add termux-api
pkg install proot-distro
proot-distro install alpine
proot-distro login alpine
Expected behavior Expected to run normally (in this case, termux-battery-status should return a JSON containing info of the device's battery) as shown in the section "Problem Description"
Additional information