termux-api features hangs on Android 11 when executed from ssh session
txoof opened this issue · 2 comments
Problem description
Termux-API implementations hang on execution under Android 11 and do not complete when executed from ssh process
Steps to reproduce
start ssh service:
#!/data/data/com.termux/files/usr/bin/bash
termux-wake-lock
/data/data/com.termux/files/usr/bin/sshd &
ssh to termux device
execute on remote remote host
ssh -p 8022 termux@XXX.XXX.XXX.XXX
from within ssh session
Execute any termux-api command:
$ termux-wifi-connectioninfo
>> no output
$ termux-battery-status
>> no output
$ termux-call-log
>> no output
$ termux-battery-status -h
Usage: termux-battery-status
Get the status of the device battery.
The executables do appear to work when executed from the ssh session and do not crash -- executing them with the -h option produces output as expected.
Expected behavior
Expect to see output from API process
Additional information
$ termux-info (master) ✗
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://main.termux-mirror.ml/ stable main
# game-repo (sources.list.d/game.list)
deb https://dl.bintray.com/grimler/game-packages-24 games stable
# science-repo (sources.list.d/science.list)
deb https://dl.bintray.com/grimler/science-packages-24 science stable
Updatable packages:
All packages up to date
Android version:
11
Kernel build information:
Linux localhost 4.9.223-g5bded8e40b62-ab6647920 #0 SMP PREEMPT Thu Jul 2 03:22:48 UTC 2020 aarch64 Android
If you are rooted or have access to adb then capture a logcat with logcat -d "*:W"
, from a adb or root shell.
I am not rooted - Stock android 11 on a Google Pixel 3
When run from the device, and not over SSH, termux-wifi-connectioninfo was returning
"ssid": "<unknown ssid>"
from the device, I executed
$ termux-wifi-scaninfo
and was prompted to permit Termux access to location data by Android 11 - I gave the app permissoin "all the time" and now
termux-wifi-connecitioninfo
returns the proper SSID information as expected.
Perhaps this is a permissions issue?
Try unlocking your phone, or even just turning on the screen.
I noticed slowdowns and hangups while working with filesystem, but method above worked for me.
Wakelock may be helpful too