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-job-scheduler hangs without any message #80

Open
Noexpert opened this issue Aug 16, 2019 · 20 comments
Open

termux-job-scheduler hangs without any message #80

Noexpert opened this issue Aug 16, 2019 · 20 comments
Labels

Comments

@Noexpert
Copy link

Hi,

I'm trying to schedule a job as follows: termux-job-scheduler --period-ms 86400000 --script /storage/emulated/0/Backup/rsync.sh --network any

The script is simply a small rsync job to sync some photos.
When I issue the command, nothing happens.

I thought it might be related to #78 or termux/termux-api#276 but it doesn't seem so.

Thanks

@xalexalex
Copy link
Collaborator

What is the output of your termux-job-scheduler command? What is the output of termux-job-scheduler -p? Did you chmod +x that script? Also, I might be wrong but I remember that you can't have executable files on /storage/emulated. Try moving the script somewhere in your $HOME, chmod +x ~/rsync.sh and try again.

@Noexpert
Copy link
Author

Hi,

both termux-job-scheduler and termux-job-scheduler -p simply hang with no message whatsoever.

The script is executable and I can run it with no issues when I call it from the command line.

Thank you.

@xalexalex
Copy link
Collaborator

Okay. Can we have the output of termux-info and a logcat? Instructions are available if you try to open a new issue, select bug report, and read the template. Thanks!

@Noexpert
Copy link
Author

Hi,

here's the output of termux-info:

Updatable packages:
All packages up to date
Subscribed repositories:
https://dl.bintray.com/grimler/science-packages-24 science/stable
https://dl.bintray.com/grimler/game-packages-24 games/stable
https://dl.bintray.com/termux/termux-packages-24 stable/main
System information:
Linux localhost 3.18.71-perf+ #1 SMP PREEMPT Wed Jul 10 13:36:48 KST 2019 aarch64 Android
Termux-packages arch:
aarch64
Android version:
8.0.0
Device manufacturer:
LGE
Device model:
LG-H870

I don't have a way to capture a logcat now (not rooted), but what I can say is that I tried a clean installation on a Galaxy S6 and the result was the same.

Thanks.

@xalexalex xalexalex added the bug label Aug 19, 2019
@pimsierhuis
Copy link
Contributor

pimsierhuis commented Mar 6, 2020

I have the same problem on a Samsung S9. logcat only says:

03-06 10:48:09.646 30883 30883 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 10035 <<<<<<

A few months ago it still worked, so it seems to have something to do with an update.

@pimsierhuis
Copy link
Contributor

pimsierhuis commented Mar 6, 2020

Oh and it's running Android 10. It looks like the whole termux-api doesn't work anymore (For example termux-battery-status hangs too). See also termux/termux-api#330.

Can I help debugging this issue?

@xalexalex
Copy link
Collaborator

Very interesting, although I don't have any android 10 device for testing.
First, a few checks: you were already on Android 10 when it last worked, right? Or did updating to Android 10 break termux-api? And please check that everything is updated (termux, termux:api, and pkg up in termux).

Anyway, because you say it used to work and then it stopped working, it would surely help to bisect and identify the bad version/commit. If you know how to do this you can skip the rest of the message, otherwise pick an old version and install it and see if it works.

  • The oldest available on F-Droid is Version 0.37 (2019-09-19).
  • If you're using Google Play, I think you might be able to find an apk with the same signature on one of those apk repositories.
  • If you're building your own termux-api, I don't need to tell you how to do this :D

After doing that, you can identify the version that introduced the change by bisecting (i.e. if v0.37 works, try v0.39. If that works, try v0.40, else try v0.38 ...)

@pimsierhuis
Copy link
Contributor

I'm not completely sure, but I think updating to Android 10 broke it. I want to use termux for backing up the phones of my family to a NAS via rsync. When I was working on that a few months ago, I was using a self-built version (with the --persisted option added to termux-job-scheduler) and that worked. Yesterday, I tried to set this up on my wife's phone with the packages from play store and noticed that my Ansible job (I use to set it up) was hanging on termux-job-scheduler. When I tried it on my own phone, on which it worked a few months ago, it didn't work anymore either (I tried that without updating termux). I think somewhere last month my phone was upgraded from Android 9 to 10, as there have been quite a few differences in the user interface (I'm not really paying attention what the updates from Samsung actually do).

Now, when I mentioned Ansible above, I realized that I only tried running stuff via ssh (as I like my full size keyboard better than the thing on the phone :) ). I tried it on the phone and that did work! For the sake of clarity, it also worked via ssh last time I checked (as my Ansible job did work).

@pimsierhuis
Copy link
Contributor

Trying to debug a bit more, what I noticed is that when I run:

export CLASSPATH=/data/data/com.termux/files/usr/libexec/termux-am/am.apk
/system/bin/app_process / com.example.termuxam.Am

On my phone, I get the usage. When I do exactly the same via ssh, it returns the prompt without any message.

@mroark1m
Copy link

mroark1m commented Mar 15, 2020

Same problem on a Moto Z2 phone with android 8.

termux-info also hangs and I couldn't see any new message in logcat when the commands hang.

<edit> this was user error... I didn't have termux:api installed, only the pkg

@JosephSBoyle
Copy link

I experienced this behaviour.

Turn's out I didn't have termux:api installed from Google Play (or F-droid, for that matter).

Installing the APK solved for me.

@dummifiedme
Copy link

I experienced this behaviour.

Turn's out I didn't have termux:api installed from Google Play (or F-droid, for that matter).

Installing the APK solved for me.

So pkg install termux-api isn't enough?
We need to install another apk to get this to work?

@Grimler91
Copy link
Member

@dummifiedme yes, see README and installation instructions

@Noexpert
Copy link
Author

Noexpert commented Jan 19, 2022

Is there any update to this?
I've changed devices and reinstalled both termux as well as termux-api but the issue persists.

I also placed the executable script in the home directory and even called it with the full path /data/data/com.termux/files/home/test.sh with no luck.

It simply hangs with no error message or response.

@Grimler91
Copy link
Member

@Noexpert no one has posted any logs (from adb logcat or root shell) so hard to know what is happening.

Possibly same issue as in termux/termux-api#466, problem is that none of the developers seem to be able to reproduce it so hard to investigate the issue

@Noexpert
Copy link
Author

Unfortunately, I don't have a rooted device.
I'll investigate another way, but last time I tried I didn't have any luck.

@Grimler91
Copy link
Member

@Noexpert you can get a logcat without root with adb, after enabling developer settings. See for example https://developer.android.com/studio/debug/am-logcat for info about the logcat command

@T-3B
Copy link

T-3B commented Feb 25, 2022

Hello there!

Posting a comment here as I have a problem related to this issue, and I have a rooted device so I'll be able to produce a log. Every thing in Termux is up-to-date.
I'm not an expert, so could someone explain (or link) the steps to do to create the needed log? Also, as I'm facing the problem and have a rooted device, don't hesitate to ask me further tests.

My problem:
I tried termux-job-scheduler to run a script every ~16 minutes (termux-job-scheduler -s ~/test.sh --period-ms 1000000), and worked when I was using the phone (but unfortunately not when locked... Still digging in there to know if I have to do more than "Acquire wakelock" - and exit Termux after).

Since it did not always run, I overwritten the job (close-all then new one) with the same script with only one more param : --network none (I thought - still don't know - --network any only runs when connected to a network, while I want it to be run in any conditions).
termux-job-scheduler showed litteraly nothing during 2~3 minutes so I hit [Ctrl+C].
No more response for others command of the job-scheduler, such as --pending --close-all. (Other packages of termux-api still worked, such as battery status.)
Could not get rid of the issue, I needed to delete termux:API apk cache and personal data (in Android settings).

TL;DR : adding --network none to the params of the job did break the jobScheduler.

Application version:
0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://termux.mentality.rip/termux-main/ stable main
# game-repo (sources.list.d/game.list)
deb https://termux.mentality.rip/game-packages-24 games stable
# science-repo (sources.list.d/science.list)
deb https://termux.mentality.rip/science-packages-24 science stable
# sources.list.d/pointless.list
deb https://its-pointless.github.io/files/24  termux extras
# root-repo (sources.list.d/root.list)
deb https://termux.mentality.rip/termux-root-packages-24 root stable
Updatable packages:
util-linux/stable 2.37.4 aarch64 [upgradable from: 2.37.2-1]
Android version:
11
Kernel build information:
Linux localhost 4.14.237-AliKernel-V0.8.13-Stable #2 SMP PREEMPT Mon Jun 21 22:25:42 CEST 2021 aarch64 Android
Device manufacturer:
Xiaomi
Device model:
Mi Note 10

@alensiljak
Copy link

Is there any update to this? I've changed devices and reinstalled both termux as well as termux-api but the issue persists.

Perhaps I'm nitpicking but did you also install the app below?

https://f-droid.org/en/packages/com.termux.api/

@Steve-Newcomb
Copy link

termux-job-scheduler is still broken. Job runs once and never again. Meanwhile, termux-job-scheduler never exits. Here's termux-info:

240418 13:53 ~ u0_a271@glynn% termux-info
Termux Variables:
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=9557
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_PREFIX=/data/data/com.termux/files
TERMUX_TMPPATH=/data/data/com.termux/files/usr/tmp
TERMUX_VERSION=0.118.0
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:

sources.list

deb https://mirror.quantum5.ca/termux/termux-main stable main
Updatable packages:
proot/stable 5.1.107-64 aarch64 [upgradable from: 5.1.107-63]
termux-tools version:
1.42.0
Android version:
14
Kernel build information:
Linux localhost 5.10.189-android13-4-00012-g1217bb583cc5-ab11174560 #1 SMP PREEMPT Mon Dec 4 18:59:42 UTC 2023 aarch64 Android
Device manufacturer:
Google
Device model:
Pixel 7a
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.boot versionCode:7
240418 13:59 ~ u0_a271@glynn%

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

No branches or pull requests

10 participants