-
Notifications
You must be signed in to change notification settings - Fork 224
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:boot fails on android 10 #58
Comments
Have you opened the termux-boot app at least once on the android 10 device? A Something else that might be worth looking at is if some sort of battery optimization is active for termux/termux-boot, as mentioned here |
Grimler91, thank you for your reply!
Is running logcat from adb any different than from termux (where I have been running it)? Since testing and retesting, I have now noticed that Android 8 works/fails intermittently, and that sometimes it pops up a notice "Android setup has stopped" (no idea if it is related). On Android 10 I have not gotten it to work once! On Android 8, when it works, I get a little ">_" icon notice in the notification bar saying "termux wake lock held" (which is the first thing run in my script). But no output from logcat in any case... Are you running Android 10 on anything? Thanks again for your help! |
Furthermore... I attached via adb shell and ran the following:
Does "NativeCrash" mean it crashed? It opened the termux:boot instruction page on the tablet, but a reboot still failed to launch termux:boot. Can anyone suggest a way to debug termux:boot to determine why it is not launching at boot time? |
Can anyone summarize how termux:boot works? I would like to look at the source code and see if I can find what is wrong... But it would be helpful to have an outline of what it does and how it does it. Thanks! |
Running
I am using lineage os 17.1 (i.e. android 10) on my phone and termux-boot works there. What brand and so on is your tablet? Please post output of Also, make sure shebang of the script(s) being run are correct (but if the same script works on android 8 then it is probably alright), I am not familiar with monkey so don't know what to make of the log, and I am not too familiar with the termux-boot code so cannot give a good outline of that either |
Thanks again for your help!
It wouldn't, if termux:boot is not even launching at all which is my theory. In googling around I found this:
which is not clear to me but make it sound like there is some issue with android 10. But if you have it working, it must not be android 10... Here is the termux-info output:
From looking at the source, it looks like this file "AndroidManifest.xml"is what is supposed to cause termux:boot to run at boot time... in case anyone sees anything wrong here.
|
This comment was marked as spam.
This comment was marked as spam.
I'm on android 11 with a rooted moto g phone. Having similar problems as everyone else in this thread, specifically that termux:boot does not seem to run my sshd script. My goal is to get sshd to start upon booting the phone, and I just can't get it to work. No useful info from logcat. UPDATE: I discovered by accident that maybe 15minutes later, suddenly sshd was working, so the script must have run. I then concocted a test loop with timestamps and discovered that it took just about 2 minutes before the sshd script ran. So what is going on here? Is there a cron job that runs 2 minutes after boot or something like that? A delay of 2 min otherwise seems rather bizarre. |
$ monkey -p com.termux.boot 1 bash arg: -p Network stats: elapsed time=5033ms (0ms mobile, 0ms wifi, 5033ms not connected) |
I looked up that "monkey" (above) is an "application exerciser". Does the above mean that an error was found with the application com.termux.boot? |
I might be mistaken but believe this is from misunderstanding. Even I was completely confused here until I started looking at the code verses the instructions since no where does it say root is required and the older target should allow read/write to Android storage. The logcat showed "termux: No files to execute at boot" which meant it wasn't finding the script in ".termux/boot/". Initially, I thought that meant termux boot was starting termux, but I happened to just search for it in termux boot git, and it was termux boot failing to find the file. The boot receiver has a hard coded path of:
That is not a path that can be used from a non-rooted device file manager! The Termux boot instructions simply say the following and I quote "create a file at ~/.termux/boot/start-sshd". That is completely wrong unless you look at this from possibly inside Termux app itself. However, we are talking about a different app and the meaning there is 100% lost unless someone just happens to think "Oh! The other part of that path is Termux /data/data/... even though I don't know that." By chance would someone try from Termux. Inside Termux app, you can copy your file to the location inside the /data/data folder... Something like You can validate its there with something like On Android 12 with no root ability and it works fine for me after this. My script currently is as a first test:
This does start ssh (with previous test setup) after boot and allows connection. You should not need to do anything else if you do it inside Termux. Addition: This can be improved by one or more of the following examples:
Also, any further issues should probably be with termux boot or termux itself if you do it as I did above. You should view verbose in logcat with it filtered for "termux" and then compare that with the code. If you see nothing in the code then they may not have an error or log entry for it. |
I''m not sure I understand the xavron comment. I have a different problems. First there is the time delay (minutes), and 2nd there is the fact that I have to start the termux app manually or else it seems termux-boot will not run at all. I thought it should run even if the app itself is not started, I also noticed that there exists a differently Termux-boot (note the capital T), and I am not sure which one I am running. The code for capital Termux-boot is just a shellscript, not java code, and it does have a 300 sec (5 min) delay in it. I'm not even sure how to tell which version I am running. Does anyone have ideas? Is there anything suspect about capital Termux-boot? |
There should be a delay of Termux boot to start roughly after Android has settled. This has been a choice that apps using start on boot can choose as immediately on start of the OS there's a lot going on already. You should use f-droid Termux build apk and the f-droid Termux boot build apk together. You install both. And enable storage perm for Termux in Android settings. Also disable battery optimizations that may kill apps. Some devices have difficult to find one in addition to the app one. Run Termux and eg install ssh, etc and test it to make sure its working. In Termux, you also deal with the script at the required location as that location is a folder directly used by that app and no other. Its app private space. You can open Termux boot and look at the instructions before finishing the script or you can open it after. Think I got everything. Once all of that is done, reboot. Termux boot will run the script and start Termux app. I probably can't make it any clearer. If you deviate, the results will be unknown or probably just not work. This is the minimum to get it working. Anything else from someone else like the linked whatever is going to change the variables. The Termux boot here is linked to f-droid anymore as far as I can see unless you built it yourself from this repo. If you choose something else like that linked thing, it has its own instructions and differences that you need to follow instead. |
That was a non-answer , Aditya. |
Sorry, for not being able to answer your question. But you seems to be confused between Termux:Boot android app and script that you linked. We can only solve issues regarding app, not that script (we do not maintain that). Termux:Boot app will function as explained by @Xavron . If you have any other problem regarding this, you may ask. |
You are the "confused" one, Aditya. I didn't say I "linked some script". I have not linked ANYTHING. I said there EXISTS a package on github with a capitalized same name, and in it there is a script called Termux-boot with an explicit delay of 300 sec. I was concerned (not confused) that there was some monkey-business going on with the packaging or even a Trojan horse. But enough of this. |
Okay, I am the "confused" one. Now, cool down! I just wrote thinking it might help you, but it went some another way. Sorry! |
There exists ~40 repos just on github if I search for termux.boot, but only stuff in the github.com/termux/ namespace are official. Not sure why you suspect that you have the "Termux-boot" script from github.com/AbdullahM0hamed/Termux-boot on your device, but I would in any case trust scripts from AbdullahM0hamed, considering that he has made multiple contributions to termux-api over the years |
I'll attempt to take step back and try to summarize/identify what the main issues are:
For me the big bugaboo is the long wait, not even knowing the value of the wait/delay timer, not being able to see script start/exit status in the log. It all seems solvable, but I am not in any way an android/java programmer and cannot contribute anything meaningful to Termux:Boot except suggestions that MIGHT be helpful :). Note to self (poor man's wait for wifi doable using ip command, but built-in java would be so much better): |
There is no significant delay in Moreover, A manual delay could be considered as well when |
The above post I think is highly informative. Could this be in the documentation, please? BUT: Having to wait for the user to unlock a screen seems suboptimal for many uses cases,. including mine. I did some digging into android and I found there exists also the event/intent LOCKED_BOOT_COMPLETED, which seems to do what I need. Can we please have LOCKED_BOOT_COMPLETED as the start criterion for Termux:Boot? Or at least an option to use it instead of BOOT_COMPLETED? |
As the linked article says the normal app data is stored under credential encrypted ( The https://developer.android.com/training/articles/direct-boot#run |
Wow, good detail, @agnostic-apollo!! I see why using LOCKED_BOOT_COMPLETED may not yield the desired result. I'm still observing a long delay before termux:boot does its thing, AFTER unlocking the screen:
I'm looping the ssh attempts every 5 seconds to check when sshd got started by termux:boot I need to do some more adb logcat stuff, maybe that will give some clues. |
That should just simply be the time it takes for that device to get to starting the app. Android and delayed start of apps are just a normal thing. Its actually good and fine as many things need to start. If being offline for a few minutes is a problem then should be doing something different :-) I'd advise giving up on the delay and just be happy it starts. Starting is the important point. |
Unfortunately i am not able to copy files from /storage because i have no permissions, its weird because u said that ure not using rooted device. -- |
i successfully ran termux:boot on android 9 for 3+ years. i have just upgraded to android 13 and termux:boot fails to install. i have followed instructions at |
@picgla termux-app and all addons need to be installed from the same place so that they are signed with the same key. Builds on google play are outdated as you noted, it is recommended to install from fdroid (or possible to install debug builds from here on github), see https://github.com/termux/termux-boot/#installation |
thank you. now working as expected.
--
|
I'm sorry, if the my problem is not related to it. Thought of commenting here as it looks same. If not, I'll raise a separate ticket. On Firestick, I have used a But, on reboot the script is not getting triggered. When I open Termux, I'm getting a message:
And upon clicking the menu button (≡), the script is getting run (without that it doesn't run) I'm using standalone Termux and Termux:Boot from F-Droid (without F-Droid):
Any suggestion/solution is much appreciated Edit (2023-10-20): It works now. Looks like after a couple of manual triggers, the auto boot option works. Not sure how many times, we have to manually do that |
And now I understand why this isn't doing what I thought it would. :-) I set it up to start sshd and use autossh to open a connection to my server that carries a tunnel back to itself, so I could ssh into my phone wherever it is as long as it can reach a cell data connection or known wifi network. Kind of a command line version of "Find My Phone". Sadly, this connection is only live after the phone has been unlocked and now I understand why. I may be being naive, but couldn't this be solved by building Termux:boot to use LOCKED_BOOT_COMPLETED, then installing Termux and Termux:boot as system apps? |
I have also problem with termux-boot on Xiaomi Redmi 7A with Android 10. But it is better to use Android 9. It has much less restrictions than Android 10. |
I have two tablets, one running android 8 and the another running android 10. I have installed termux and termux:boot (v 0.7) from f-droid exactly the same on both systems. termux:boot works (runs the boot script) on the android 8 tablet, but fails (does not run the script) on the android 10 tablet.
I know everything is correctly configured because the same configuration works on android 8.
If anyone could look into this, I will gladly provide any details, files, debug output etc... needed.
Someone please help (my project cannot move forward without termux:boot).
The text was updated successfully, but these errors were encountered: