Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Termux:TermuxService: Failed to execute new TermuxTask command #151

Open
alpert1 opened this issue Mar 23, 2023 · 7 comments
Open

Termux:TermuxService: Failed to execute new TermuxTask command #151

alpert1 opened this issue Mar 23, 2023 · 7 comments

Comments

@alpert1
Copy link

alpert1 commented Mar 23, 2023

Problem description
The commands in ~/.termux/boot are not executed. This is the logcat output:

user@terminal:~$ adb logcat --pid=3535
--------- beginning of main
03-23 13:58:45.078  3535  3535 E com.termux.boo: Not starting debugger since process cannot load the jdwp agent.
03-23 13:58:45.143  3535  3535 D ApplicationLoaders: Returning zygote-cached class loader: /system/framework/android.test.base.jar
03-23 13:58:45.183  3535  3535 D NetworkSecurityConfig: No Network Security Config specified, using platform default
03-23 13:58:45.183  3535  3535 D NetworkSecurityConfig: No Network Security Config specified, using platform default
03-23 13:58:45.189  3535  3535 W com.termux.boot: type=1400 audit(0.0:154): avc: granted { execute } for name="start-sshd" dev="mmcblk0p23" ino=630413 scontext=u:r:untrusted_app_27:s0:c105,c256,c512,c768 tcontext=u:object_r:app_data_file:s0:c105,c256,c512,c768 tclass=file app=com.termux.boot
03-23 13:58:45.208  3535  3535 I termux  : Executed files at boot: start-sshd
03-23 13:58:45.233  3535  3535 I termux  : Executing job 1000.
^C
user@terminal:~$ adb logcat --pid=3577
--------- beginning of main
03-23 13:58:45.407  3577  3577 E com.termux: Not starting debugger since process cannot load the jdwp agent.
03-23 13:58:45.482  3577  3577 D ApplicationLoaders: Returning zygote-cached class loader: /system/framework/android.test.base.jar
03-23 13:58:45.554  3577  3577 D NetworkSecurityConfig: No Network Security Config specified, using platform default
03-23 13:58:45.555  3577  3577 D NetworkSecurityConfig: No Network Security Config specified, using platform default
03-23 13:58:45.774  3577  3577 E Termux:TermuxService: Failed to execute new TermuxTask command for:
03-23 13:58:45.774  3577  3577 E Termux:TermuxService: (1000) Execution Intent Command
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: (1000) Execution Intent Command:
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: Previous State: `Executing`
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: Current State: `Failed`
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: Exit Code: -
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: Error Code: `2`
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: Error Message:
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: ```
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: Failed to execute "(1000) Execution Intent Command" termux task command
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: ```
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: StackTraces:
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: ```
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: java.io.IOException: Cannot run program "/data/data/com.termux/files/home/.termux/boot/start-sshd" (in directory "/data/data/com.termux/files/home"): error=2, No such file or directory
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1050)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at java.lang.Runtime.exec(Runtime.java:699)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at com.termux.shared.shell.TermuxTask.execute(TermuxTask.java:96)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at com.termux.app.TermuxService.createTermuxTask(TermuxService.java:432)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at com.termux.app.TermuxService.executeTermuxTaskCommand(TermuxService.java:408)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at com.termux.app.TermuxService.actionServiceExecute(TermuxService.java:392)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at com.termux.app.TermuxService.onStartCommand(TermuxService.java:150)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4326)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at android.app.ActivityThread.access$1800(ActivityThread.java:237)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1951)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at android.os.Handler.dispatchMessage(Handler.java:106)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at android.os.Looper.loop(Looper.java:223)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at android.app.ActivityThread.main(ActivityThread.java:7656)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at java.lang.reflect.Method.invoke(Native Method)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: Caused by: java.io.IOException: error=2, No such file or directory
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at java.lang.UNIXProcess.forkAndExec(Native Method)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at java.lang.UNIXProcess.<init>(UNIXProcess.java:133)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at java.lang.ProcessImpl.start(ProcessImpl.java:141)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	... 15 more
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: ```
03-23 13:58:45.801  3577  3577 W System  : ClassLoader referenced unknown path: 
03-23 13:58:46.112  3577  3577 D CompatibilityChangeReporter: Compat change id reported: 147798919; UID 10105; state: DISABLED
03-23 13:58:49.647  3577  3622 W libEGL  : EGLNativeWindowType 0xe81cb068 disconnect failed

This is the latest start-sshd-file:

#!/data/data/com.termux/files/usr/bin/sh
date +'%a %F %T %Z' >> /data/data/com.termux/files/home/log.txt
date +'%a %F %T %Z' >> ~/log.txt

The file and its parent directories are all owned by the user. I don't know what else I can try.

Steps to reproduce

  1. Install Termux and Termux:Boot from F-Droid
  2. Add a script to ~/.termux/boot/
  3. Reboot

Expected behavior

The script is executed.

Additional information

  • Termux application version: 0.118.0
  • Android OS version: 11
  • Device model: Homatics Box R 4K Plus
@Thanhhuufoods
Copy link

Problem description
The commands in ~/.termux/boot are not executed. This is the logcat output:

user@terminal:~$ adb logcat --pid=3535
--------- beginning of main
03-23 13:58:45.078  3535  3535 E com.termux.boo: Not starting debugger since process cannot load the jdwp agent.
03-23 13:58:45.143  3535  3535 D ApplicationLoaders: Returning zygote-cached class loader: /system/framework/android.test.base.jar
03-23 13:58:45.183  3535  3535 D NetworkSecurityConfig: No Network Security Config specified, using platform default
03-23 13:58:45.183  3535  3535 D NetworkSecurityConfig: No Network Security Config specified, using platform default
03-23 13:58:45.189  3535  3535 W com.termux.boot: type=1400 audit(0.0:154): avc: granted { execute } for name="start-sshd" dev="mmcblk0p23" ino=630413 scontext=u:r:untrusted_app_27:s0:c105,c256,c512,c768 tcontext=u:object_r:app_data_file:s0:c105,c256,c512,c768 tclass=file app=com.termux.boot
03-23 13:58:45.208  3535  3535 I termux  : Executed files at boot: start-sshd
03-23 13:58:45.233  3535  3535 I termux  : Executing job 1000.
^C
user@terminal:~$ adb logcat --pid=3577
--------- beginning of main
03-23 13:58:45.407  3577  3577 E com.termux: Not starting debugger since process cannot load the jdwp agent.
03-23 13:58:45.482  3577  3577 D ApplicationLoaders: Returning zygote-cached class loader: /system/framework/android.test.base.jar
03-23 13:58:45.554  3577  3577 D NetworkSecurityConfig: No Network Security Config specified, using platform default
03-23 13:58:45.555  3577  3577 D NetworkSecurityConfig: No Network Security Config specified, using platform default
03-23 13:58:45.774  3577  3577 E Termux:TermuxService: Failed to execute new TermuxTask command for:
03-23 13:58:45.774  3577  3577 E Termux:TermuxService: (1000) Execution Intent Command
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: (1000) Execution Intent Command:
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: Previous State: `Executing`
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: Current State: `Failed`
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: Exit Code: -
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: Error Code: `2`
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: Error Message:
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: ```
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: Failed to execute "(1000) Execution Intent Command" termux task command
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: ```
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: StackTraces:
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: ```
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: java.io.IOException: Cannot run program "/data/data/com.termux/files/home/.termux/boot/start-sshd" (in directory "/data/data/com.termux/files/home"): error=2, No such file or directory
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1050)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at java.lang.Runtime.exec(Runtime.java:699)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at com.termux.shared.shell.TermuxTask.execute(TermuxTask.java:96)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at com.termux.app.TermuxService.createTermuxTask(TermuxService.java:432)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at com.termux.app.TermuxService.executeTermuxTaskCommand(TermuxService.java:408)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at com.termux.app.TermuxService.actionServiceExecute(TermuxService.java:392)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at com.termux.app.TermuxService.onStartCommand(TermuxService.java:150)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4326)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at android.app.ActivityThread.access$1800(ActivityThread.java:237)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1951)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at android.os.Handler.dispatchMessage(Handler.java:106)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at android.os.Looper.loop(Looper.java:223)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at android.app.ActivityThread.main(ActivityThread.java:7656)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at java.lang.reflect.Method.invoke(Native Method)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: Caused by: java.io.IOException: error=2, No such file or directory
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at java.lang.UNIXProcess.forkAndExec(Native Method)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at java.lang.UNIXProcess.<init>(UNIXProcess.java:133)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at java.lang.ProcessImpl.start(ProcessImpl.java:141)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 	... 15 more
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: 
03-23 13:58:45.778  3577  3577 E Termux:TermuxService: ```
03-23 13:58:45.801  3577  3577 W System  : ClassLoader referenced unknown path: 
03-23 13:58:46.112  3577  3577 D CompatibilityChangeReporter: Compat change id reported: 147798919; UID 10105; state: DISABLED
03-23 13:58:49.647  3577  3622 W libEGL  : EGLNativeWindowType 0xe81cb068 disconnect failed

This is the latest start-sshd-file:

#!/data/data/com.termux/files/usr/bin/sh
date +'%a %F %T %Z' >> /data/data/com.termux/files/home/log.txt
date +'%a %F %T %Z' >> ~/log.txt

The file and its parent directories are all owned by the user. I don't know what else I can try.

Steps to reproduce

  1. Install Termux and Termux:Boot from F-Droid
  2. Add a script to ~/.termux/boot/
  3. Reboot

Expected behavior

The script is executed.

Additional information

  • Termux application version: 0.118.0
  • Android OS version: 11
  • Device model: Homatics Box R 4K Plus

@agnostic-apollo
Copy link
Member

agnostic-apollo commented Apr 26, 2023

What's the output for /system/bin/ls -ldZ "/data/data/com.termux/files/home/.termux/boot/start-sshd" "/data/data/com.termux"

Edit:

03-23 13:58:45.189 3535 3535 W com.termux.boot: type=1400 audit(0.0:154): avc: granted { execute } for name="start-sshd" dev="mmcblk0p23" ino=630413 scontext=u:r:untrusted_app_27:s0:c105,c256,c512,c768 tcontext=u:object_r:app_data_file:s0:c105,c256,c512,c768 tclass=file app=com.termux.boot

Actually, probably not ownership issue. What's the output for stat /data/data/com.termux/files/usr/bin/sh and how are you creating the script file?

@termux termux deleted a comment from Omoase Apr 19, 2024
@odoral
Copy link

odoral commented Jul 7, 2024

Is it possible to be related to UNIXProcess#forkAndExec not supported?

I'm getting same error while trying to run gradle:

$ gradle --stacktrace
Starting a Gradle Daemon (subsequent builds will be faster)
This command is not for general use and should only be run as the result of a call to
ProcessBuilder.start() or Runtime.exec() in a java application

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred starting process 'Gradle build daemon'

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

* Exception is:
org.gradle.process.internal.ExecException: A problem occurred starting process 'Gradle build daemon'
        at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:241)
        at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:218)
        at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:396)
        at org.gradle.process.internal.ExecHandleRunner.lambda$run$3(ExecHandleRunner.java:102)
        at org.gradle.internal.operations.CurrentBuildOperationRef.with(CurrentBuildOperationRef.java:80)
        at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:101)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: net.rubygrapefruit.platform.NativeException: Could not start '/data/data/com.termux/files/usr/lib/jvm/java-21-openjdk/bin/java'
        at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
        at org.gradle.process.internal.ExecHandleRunner.startProcess(ExecHandleRunner.java:122)
        at org.gradle.process.internal.ExecHandleRunner.lambda$run$0(ExecHandleRunner.java:80)
        at org.gradle.internal.operations.CurrentBuildOperationRef.with(CurrentBuildOperationRef.java:80)
        at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:79)
        ... 5 more
Caused by: java.io.IOException: Cannot run program "/data/data/com.termux/files/usr/lib/jvm/java-21-openjdk/bin/java" (in directory "/data/data/com.termux/files/home/.gradle/daemon/8.8"): error=0,
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1170)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1089)
        at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
        ... 9 more
Caused by: java.io.IOException: error=0,
        at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
        at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:295)
        at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:225)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1126)
        ... 11 more

@sylirre
Copy link
Member

sylirre commented Jul 7, 2024

@odoral Your error doesn't look same. JDK-21 and Termux:Boot can't share runtime issues either, you are comparing a package with Android application.

@odoral
Copy link

odoral commented Jul 7, 2024

I understand @sylirre but I'm pointing the fact that both issues have the same root cause:

Caused by: java.io.IOException: error=0,
        at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)

Is it maybe possible that forks are not supported/allowed by any reason?

@sylirre
Copy link
Member

sylirre commented Jul 7, 2024

fork() is a critical functionality to run shell and command line tools. Termux app would be useless if that function would be forbidden.

ForkAndExec will fail if the executable file can't run for whatever reason, e.g. linking error for binaries or wrong shebang for scripts.

Termux installed from Google Play also could be a reason.

@odoral
Copy link

odoral commented Jul 12, 2024

In my case @sylirre, I installed it from Google Play. Thanks for your comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants