termux / TermuxAm

Android Oreo-compatible am command reimplementation.
Apache License 2.0
107 stars 33 forks source link

[Bug] /bin/am: 45: echo: echo: I/0 error on API call and android 14 #10

Closed ScienceKyle closed 1 year ago

ScienceKyle commented 1 year ago

Problem description API calls appear to work correctly but an error message is displaying over next command line prompt. I'm not sure if this is originating from API, API_script, AM, or my installation.


~ $ termux-api-start
Starting service: Intent { cmp=com.termux.api/.KeepAliveService }
~ $ termux-battery-status
{
  "health": "GOOD",
  "percentage": 59,
  "plugged": "UNPLUGGED",
  "status": "DISCHARGING",
  "temperature": 26.899999618530273,
  "current": -262756
}
~ $ /data/data/com.termux/files/usr/bin/am: 45: echo: echo: I/O error
termux-battery-status
{
  "health": "GOOD",
  "percentage": 59,
  "plugged": "UNPLUGGED",
  "status": "DISCHARGING",
  "temperature": 26.899999618530273,
  "current": -338745
}
~ $ /data/data/com.termux/files/usr/bin/am: 45: echo: echo: I/O error
termtermux-api-stop
Stopping service: Intent { cmp=com.termux.api/.KeepAliveService }
Service stopped
~ $ termux-battery-status
{
  "health": "GOOD",
  "percentage": 59,
  "plugged": "UNPLUGGED",
  "status": "DISCHARGING",
  "temperature": 26.899999618530273,
  "current": -293274
}
~ $ /data/data/com.termux/files/usr/bin/am: 45: echo: echo: I/O error
termcd $PREFIX
.../files/usr $ 
.../files/usr $ stat $PREFIX/libexec/termux-am/am.apk
  File: /data/data/com.termux/files/usr/libexec/termux-am/am.apk
  Size: 23939           Blocks: 48         IO Block: 4096   regular file
Device: 253,42  Inode: 54993       Links: 1
Access: (0400/-r--------)  Uid: (10278/ u0_a278)   Gid: (10278/ u0_a278)
Access: 2023-09-05 19:25:25.000000000 -0400
Modify: 2023-09-01 23:25:25.000000000 -0400
Change: 2023-09-05 20:48:23.167969459 -0400
 Birth: -

Steps to reproduce Android 14 Termux-API call

Additional information termux-info

Termux Variables:
TERMUX_API_APP__VERSION_NAME=0.50.1
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP__AM_SOCKET_SERVER_ENABLED=true
TERMUX_APP__APK_PATH=/data/app/~~KhgMXBBBO8GQnjDlzCILpg==/com.termux-GVvDPOsasmwAtQeYwQv74g==/base.apk
TERMUX_APP__APK_RELEASE=GITHUB
TERMUX_APP__FILES_DIR=/data/user/0/com.termux/files
TERMUX_APP__IS_DEBUGGABLE_BUILD=true
TERMUX_APP__IS_INSTALLED_ON_EXTERNAL_STORAGE=false
TERMUX_APP__PACKAGE_MANAGER=apt
TERMUX_APP__PACKAGE_NAME=com.termux
TERMUX_APP__PACKAGE_VARIANT=apt-android-7
TERMUX_APP__PID=6681
TERMUX_APP__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c22,c257,c512,c768
TERMUX_APP__SE_INFO=default:targetSdkVersion=28:complete
TERMUX_APP__SE_PROCESS_CONTEXT=u:r:untrusted_app_27:s0:c22,c257,c512,c768
TERMUX_APP__TARGET_SDK=28
TERMUX_APP__UID=10278
TERMUX_APP__USER_ID=0
TERMUX_APP__VERSION_CODE=118
TERMUX_APP__VERSION_NAME=0.118.0+eef5ac4
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0+eef5ac4
Packages CPU architecture:
aarch64
Subscribed repositories:
sources.list
deb https://packages.termux.dev/apt/termux-main stable main
Updatable packages:
All packages up to date
termux-tools version:
1.39.0
Android version:
14
Kernel build information:
Linux localhost 4.19.278-g1f0f7f323824-ab10266313 #1 SMP PREEMPT Mon Jun 5 09:09:30 UTC 2023 aarch64 Android
Device manufacturer:
Google
Device model:
Pixel 5
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.api versionCode:51
com.termux.tasker versionCode:6

logcat from issue report

09-07 00:32:42.667 16036 16036 W bash    : type=1400 audit(0.0:26596): avc:  granted  { execute } for  name="termux-api-start" dev="dm-42" ino=101004 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:32:42.667 16036 16036 W bash    : type=1400 audit(0.0:26597): avc:  granted  { execute } for  name="termux-api-start" dev="dm-42" ino=101004 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:32:42.667 16036 16036 W bash    : type=1400 audit(0.0:26598): avc:  granted  { execute_no_trans } for  path="/data/data/com.termux/files/usr/bin/termux-api-start" dev="dm-42" ino=101004 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:32:42.667 16036 16036 W bash    : type=1400 audit(0.0:26599): avc:  granted  { execute } for  name="dash" dev="dm-42" ino=66614 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:32:42.667 16036 16036 W termux-api-star: type=1400 audit(0.0:26600): avc:  granted  { execute } for  path="/data/data/com.termux/files/usr/bin/dash" dev="dm-42" ino=66614 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:32:42.766 16037 16037 W libc    : Access denied finding property "ro.debuggable"
09-07 00:32:42.767 16037 16037 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 10278 <<<<<<
09-07 00:32:42.767 16037 16037 W libc    : Access denied finding property "ro.debuggable"
09-07 00:32:42.771 16037 16037 I AndroidRuntime: Using default boot image
09-07 00:32:42.771 16037 16037 I AndroidRuntime: Leaving lock profiling enabled
09-07 00:32:42.771 16037 16037 W libc    : Access denied finding property "odsign.verification.success"
09-07 00:32:42.771 16037 16037 W libc    : Access denied finding property "ro.debuggable"
09-07 00:32:42.773 16037 16037 W app_process: ART APEX data files are untrusted.
09-07 00:32:42.773 16037 16037 I app_process: Using CollectorTypeCC GC.
09-07 00:32:42.840 16037 16037 D nativeloader: InitDefaultPublicLibraries for_preload=1: libandroid.so:libaaudio.so:libamidi.so:libbinder_ndk.so:libc.so:libcamera2ndk.so:libdl.so:libEGL.so:libGLESv1_CM.so:libGLESv2.so:libGLESv3.so:libicu.so:libicui18n.so:libicuuc.so:libjnigraphics.so:liblog.so:libmediandk.so:libm.so:libnativehelper.so:libnativewindow.so:libOpenMAXAL.so:libOpenSLES.so:libRS.so:libstdc++.so:libsync.so:libvulkan.so:libwebviewchromium_plat_support.so:libz.so
09-07 00:32:42.852 16037 16037 D app_process: Time zone APEX ICU file found: /apex/com.android.tzdata/etc/icu/icu_tzdata.dat
09-07 00:32:42.852 16037 16037 D app_process: I18n APEX ICU file found: /apex/com.android.i18n/etc/icu/icudt72l.dat
09-07 00:32:42.857 16037 16037 W ziparchive: Unable to open '/data/data/com.termux/files/usr/libexec/termux-am/am.dm': No such file or directory
09-07 00:32:42.876 16037 16037 W libc    : Access denied finding property "ro.product.name_for_attestation"
09-07 00:32:42.876 16037 16037 W libc    : Access denied finding property "ro.product.brand_for_attestation"
09-07 00:32:42.876 16037 16037 W libc    : Access denied finding property "ro.product.model_for_attestation"
09-07 00:32:42.876 16037 16037 W libc    : Access denied finding property "ro.debuggable"
09-07 00:32:42.877 16037 16037 D AndroidRuntime: Calling main entry com.termux.termuxam.Am
09-07 00:32:42.887 16037 16037 I app_process: System.exit called, status: 0
09-07 00:32:42.887 16037 16037 I AndroidRuntime: VM exiting with result code 0.
09-07 00:32:52.780 16063 16063 W bash    : type=1400 audit(0.0:26648): avc:  granted  { execute } for  name="termux-battery-status" dev="dm-42" ino=101234 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:32:52.780 16063 16063 W bash    : type=1400 audit(0.0:26649): avc:  granted  { execute } for  name="termux-battery-status" dev="dm-42" ino=101234 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:32:52.780 16063 16063 W bash    : type=1400 audit(0.0:26650): avc:  granted  { execute_no_trans } for  path="/data/data/com.termux/files/usr/bin/termux-battery-status" dev="dm-42" ino=101234 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:32:52.783 16063 16063 W bash    : type=1400 audit(0.0:26651): avc:  granted  { execute } for  name="dash" dev="dm-42" ino=66614 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:32:52.783 16063 16063 W termux-battery-: type=1400 audit(0.0:26652): avc:  granted  { execute } for  path="/data/data/com.termux/files/usr/bin/dash" dev="dm-42" ino=66614 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:32:55.183 16074 16074 W bash    : type=1400 audit(0.0:26696): avc:  granted  { execute } for  name="termux-battery-status" dev="dm-42" ino=101234 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:32:55.183 16074 16074 W bash    : type=1400 audit(0.0:26697): avc:  granted  { execute } for  name="termux-battery-status" dev="dm-42" ino=101234 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:32:55.183 16074 16074 W bash    : type=1400 audit(0.0:26698): avc:  granted  { execute_no_trans } for  path="/data/data/com.termux/files/usr/bin/termux-battery-status" dev="dm-42" ino=101234 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:32:55.183 16074 16074 W bash    : type=1400 audit(0.0:26699): avc:  granted  { execute } for  name="dash" dev="dm-42" ino=66614 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:32:55.183 16074 16074 W termux-battery-: type=1400 audit(0.0:26700): avc:  granted  { execute } for  path="/data/data/com.termux/files/usr/bin/dash" dev="dm-42" ino=66614 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:33:05.870 16093 16093 W bash    : type=1400 audit(0.0:26744): avc:  granted  { execute } for  name="termux-api-stop" dev="dm-42" ino=100189 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:33:05.870 16093 16093 W bash    : type=1400 audit(0.0:26745): avc:  granted  { execute } for  name="termux-api-stop" dev="dm-42" ino=100189 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:33:05.870 16093 16093 W bash    : type=1400 audit(0.0:26746): avc:  granted  { execute_no_trans } for  path="/data/data/com.termux/files/usr/bin/termux-api-stop" dev="dm-42" ino=100189 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:33:05.870 16093 16093 W bash    : type=1400 audit(0.0:26747): avc:  granted  { execute } for  name="dash" dev="dm-42" ino=66614 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:33:05.873 16093 16093 W termux-api-stop: type=1400 audit(0.0:26748): avc:  granted  { execute } for  path="/data/data/com.termux/files/usr/bin/dash" dev="dm-42" ino=66614 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:33:05.983 16094 16094 W libc    : Access denied finding property "ro.debuggable"
09-07 00:33:05.984 16094 16094 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 10278 <<<<<<
09-07 00:33:05.984 16094 16094 W libc    : Access denied finding property "ro.debuggable"
09-07 00:33:05.989 16094 16094 I AndroidRuntime: Using default boot image
09-07 00:33:05.989 16094 16094 I AndroidRuntime: Leaving lock profiling enabled
09-07 00:33:05.989 16094 16094 W libc    : Access denied finding property "odsign.verification.success"
09-07 00:33:05.989 16094 16094 W libc    : Access denied finding property "ro.debuggable"
09-07 00:33:05.992 16094 16094 W app_process: ART APEX data files are untrusted.
09-07 00:33:05.993 16094 16094 I app_process: Using CollectorTypeCC GC.
09-07 00:33:06.080 16094 16094 D nativeloader: InitDefaultPublicLibraries for_preload=1: libandroid.so:libaaudio.so:libamidi.so:libbinder_ndk.so:libc.so:libcamera2ndk.so:libdl.so:libEGL.so:libGLESv1_CM.so:libGLESv2.so:libGLESv3.so:libicu.so:libicui18n.so:libicuuc.so:libjnigraphics.so:liblog.so:libmediandk.so:libm.so:libnativehelper.so:libnativewindow.so:libOpenMAXAL.so:libOpenSLES.so:libRS.so:libstdc++.so:libsync.so:libvulkan.so:libwebviewchromium_plat_support.so:libz.so
09-07 00:33:06.095 16094 16094 D app_process: Time zone APEX ICU file found: /apex/com.android.tzdata/etc/icu/icu_tzdata.dat
09-07 00:33:06.095 16094 16094 D app_process: I18n APEX ICU file found: /apex/com.android.i18n/etc/icu/icudt72l.dat
09-07 00:33:06.100 16094 16094 W ziparchive: Unable to open '/data/data/com.termux/files/usr/libexec/termux-am/am.dm': No such file or directory
09-07 00:33:06.121 16094 16094 W libc    : Access denied finding property "ro.product.name_for_attestation"
09-07 00:33:06.121 16094 16094 W libc    : Access denied finding property "ro.product.brand_for_attestation"
09-07 00:33:06.121 16094 16094 W libc    : Access denied finding property "ro.product.model_for_attestation"
09-07 00:33:06.121 16094 16094 W libc    : Access denied finding property "ro.debuggable"
09-07 00:33:06.122 16094 16094 D AndroidRuntime: Calling main entry com.termux.termuxam.Am
09-07 00:33:06.131 16094 16094 I app_process: System.exit called, status: 0
09-07 00:33:06.131 16094 16094 I AndroidRuntime: VM exiting with result code 0.
09-07 00:33:09.140 16112 16112 W bash    : type=1400 audit(0.0:26796): avc:  granted  { execute } for  name="termux-battery-status" dev="dm-42" ino=101234 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:33:09.140 16112 16112 W bash    : type=1400 audit(0.0:26797): avc:  granted  { execute } for  name="termux-battery-status" dev="dm-42" ino=101234 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:33:09.140 16112 16112 W bash    : type=1400 audit(0.0:26798): avc:  granted  { execute_no_trans } for  path="/data/data/com.termux/files/usr/bin/termux-battery-status" dev="dm-42" ino=101234 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:33:09.140 16112 16112 W bash    : type=1400 audit(0.0:26799): avc:  granted  { execute } for  name="dash" dev="dm-42" ino=66614 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:33:09.140 16112 16112 W termux-battery-: type=1400 audit(0.0:26800): avc:  granted  { execute } for  path="/data/data/com.termux/files/usr/bin/dash" dev="dm-42" ino=66614 scontext=u:r:untrusted_app_27:s0:c22,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c22,c257,c512,c768 tclass=file app=com.termux.api
09-07 00:33:38.827  6681 10371 W Parcel  : Expecting binder but got null!
09-07 00:33:38.846  6681 10372 W Parcel  : Expecting binder but got null!
09-07 00:33:38.889  6681 10371 W Parcel  : Expecting binder but got null!
09-07 00:33:38.921  6681 10357 E OpenGLRenderer: Unable to match the desired swap behavior.
09-07 00:33:38.941  6681 10357 E OpenGLRenderer: Unable to match the desired swap behavior.
09-07 00:33:38.970  6681 10357 E OpenGLRenderer: Unable to match the desired swap behavior.
09-07 00:33:39.890  6681  6681 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=falsecallback=android.view.ViewRootImpl$$ExternalSyntheticLambda17@e57de3d
09-07 00:33:39.897  6681  6681 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=falsecallback=android.view.ViewRootImpl$$ExternalSyntheticLambda17@ce92139
09-07 00:33:39.971  6681 10371 W Parcel  : Expecting binder but got null!
09-07 00:33:40.085  6681 10357 E OpenGLRenderer: Unable to match the desired swap behavior.
09-07 00:33:40.256  6681  6681 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=falsecallback=android.view.ViewRootImpl$$ExternalSyntheticLambda17@eb197f5
09-07 00:33:40.265  6681 10357 D OpenGLRenderer: endAllActiveAnimators on 0x76ce952be0 (RippleDrawable) with handle 0x766e7380d0
09-07 00:33:41.813  6681 10371 W Parcel  : Expecting binder but got null!
09-07 00:33:41.825  6681  6681 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=falsecallback=android.view.ViewRootImpl$$ExternalSyntheticLambda17@8e34d5
09-07 00:33:41.832  6681 10357 D OpenGLRenderer: endAllActiveAnimators on 0x76ce97a2c0 (AlertController$RecycleListView) with handle 0x766e76a6b0
09-07 00:33:41.845  6681  6681 W InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed.
09-07 00:33:41.876  6681 10357 E OpenGLRenderer: Unable to match the desired swap behavior.
09-07 00:33:41.891  6681  6681 E Termux  : dialog
09-07 00:33:44.049  6681  6681 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=falsecallback=android.view.ViewRootImpl$$ExternalSyntheticLambda17@fad3baa
09-07 00:33:44.054  6681 10357 D OpenGLRenderer: endAllActiveAnimators on 0x76ce9bdc40 (RippleDrawable) with handle 0x766e6fb920
agnostic-apollo commented 1 year ago

Thanks for the report. Should be fixed with termux-am package v0.6.0 via e10de22. Update with pkg install termux-am after switching to default mirror with termux-change-repo or wait till your mirror syncs with it or install deb from https://packages.termux.dev/apt/termux-main/pool/main/t/termux-am/

ScienceKyle commented 1 year ago

Thank you, Confirmed fixed the issue with termux-am package v0.6.0

~ $ termux-battery-status
{
  "health": "GOOD",
  "percentage": 99,
  "plugged": "UNPLUGGED",
  "status": "DISCHARGING",
  "temperature": 30.0,
  "current": -169372
}
~ $
agnostic-apollo commented 1 year ago

Great. You are welcome.