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:boot fails on android 10 #58

Open
tunerooster opened this issue Jan 21, 2021 · 32 comments
Open

termux:boot fails on android 10 #58

tunerooster opened this issue Jan 21, 2021 · 32 comments

Comments

@tunerooster
Copy link

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).

@Grimler91
Copy link
Member

Have you opened the termux-boot app at least once on the android 10 device?

A logcat (from adb or even termux) can show if there is some error when the app tries to run the boot script(s).

Something else that might be worth looking at is if some sort of battery optimization is active for termux/termux-boot, as mentioned here

@tunerooster
Copy link
Author

tunerooster commented Jan 22, 2021

Grimler91, thank you for your reply!

  • Yes, I have opened the termux:boot app many times. It never indicates it does/did anything, just display instructions...
  • logcat -s termux:* shows nothing on either system (even though on android 8 termux:boot works) What could than mean?
  • Android 8 battery optimizations were already off. On Android 10, there are four separate battery optimizations. I turned them all off. (They are hard to find... not where they are on Android 8). Still no soup for me...

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!

@tunerooster
Copy link
Author

Furthermore...

I attached via adb shell and ran the following:

$ monkey -p com.termux.boot 1                                                                                                                                                                                         bash arg: -p
  bash arg: com.termux.boot
  bash arg: 1
args: [-p, com.termux.boot, 1]
 arg: "-p"
 arg: "com.termux.boot"
 arg: "1"
data="com.termux.boot"
// Monkey Version Informations:  
// Build Label: TECLAST/M40_EEA/M40_EEA:10/QP1A.190711.020/35666:user/release-keys
// Build Time: 1605254446000
// Build Type: user
// Build Tags: release-keys
// Build Debugable: false
// Build Changelist: 35666
// Monkey Start Time : 2111537; Monkey Start Calendar Time : 2021-01-22 04:35:14.826 
** New tombstone found: /data/tombstones/tombstone_00, size: 289390
** New tombstone found: /data/tombstones/tombstone_01, size: 291180
** New tombstone found: /data/tombstones/tombstone_02, size: 290677
** New tombstone found: /data/tombstones/tombstone_03, size: 289407
** New tombstone found: /data/tombstones/tombstone_04, size: 288839
// First NativeCrash Time : 2116542; First NativeCrash Calendar Time : 2021-01-22 04:35:19.831 
Events injected: 1
## Network stats: elapsed time=5033ms (0ms mobile, 0ms wifi, 5033ms not connected)

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?
Is there a flag/file somewhere in android that tells it to run?

@tunerooster
Copy link
Author

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!

@Grimler91
Copy link
Member

Is running logcat from adb any different than from termux (where I have been running it)?

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...

Running logcat from an adb shell gives you log output from all apps, while running it in termux only gives you output from the termux app. I thought logcat from termux would show termux-boot entries as well, but if you do not see them even on android 8 then maybe not, maybe adb shell (or a root shell) is required.

Are you running Android 10 on anything?

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 termux-info.

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), #!/usr/bin/foo needs to be #!/data/data/com.termux/files/usr/bin/foo for it to work.

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

@tunerooster
Copy link
Author

tunerooster commented Jan 22, 2021

Thanks again for your help!

  • I got no output from logcat via adb either. It appears termux:boot is simply not running at boot.
  • termux-info output is below.
  • I had no shebang at all (as there is none on android 8 script) but I added one now, and it makes no difference:
#!/data/data/com.termux/files/usr/bin/sh
exec > ~/boot.log 2>&1
set -x
termux-wake-lock && sshd

It wouldn't, if termux:boot is not even launching at all which is my theory.

In googling around I found this:

https://stackoverflow.com/questions/64642362/android-10-0-application-startup-on-boot

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:

Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://termux.org/packages/ 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:
emacs/stable 27.1-2 aarch64 [upgradable from: 27.1-1]
Android version:
10
Kernel build information:
Linux localhost 4.14.133 #1 SMP PREEMPT Fri Nov 13 14:49:11 CST 2020 aarch64 Android
Device manufacturer:
TECLAST
Device model:
M40_EEA

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.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.termux.boot"
    android:sharedUserId="com.termux">

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <application
        android:allowBackup="false"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        tools:ignore="GoogleAppIndexingWarning">
        <activity android:name=".BootActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <receiver
            android:name=".BootReceiver"
            android:exported="false">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>
        <service
            android:name=".BootJobService"
            android:permission="android.permission.BIND_JOB_SERVICE" />
    </application>

</manifest>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.termux.boot"
    android:sharedUserId="com.termux">

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <application
        android:allowBackup="false"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        tools:ignore="GoogleAppIndexingWarning">
        <activity android:name=".BootActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <receiver
            android:name=".BootReceiver"
            android:exported="false">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>
        <service
            android:name=".BootJobService"
            android:permission="android.permission.BIND_JOB_SERVICE" />
    </application>

</manifest>

@FossPrime

This comment was marked as spam.

@termux termux deleted a comment from ronaldinzkie Apr 4, 2021
@reikred
Copy link

reikred commented Oct 24, 2021

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.

@Jalal-FF
Copy link

$ monkey -p com.termux.boot 1 bash arg: -p
bash arg: com.termux.boot
bash arg: 1
args: [-p, com.termux.boot, 1]
arg: "-p"
arg: "com.termux.boot"
arg: "1"
data="com.termux.boot"
// Monkey Version Informations:
// Build Label: TECLAST/M40_EEA/M40_EEA:10/QP1A.190711.020/35666:user/release-keys
// Build Time: 1605254446000
// Build Type: user
// Build Tags: release-keys
// Build Debugable: false
// Build Changelist: 35666
// Monkey Start Time : 2111537; Monkey Start Calendar Time : 2021-01-22 04:35:14.826
** New tombstone found: /data/tombstones/tombstone_00, size: 289390
** New tombstone found: /data/tombstones/tombstone_01, size: 291180
** New tombstone found: /data/tombstones/tombstone_02, size: 290677
** New tombstone found: /data/tombstones/tombstone_03, size: 289407
** New tombstone found: /data/tombstones/tombstone_04, size: 288839
// First NativeCrash Time : 2116542; First NativeCrash Calendar Time : 2021-01-22 04:35:19.831
Events injected: 1

Network stats: elapsed time=5033ms (0ms mobile, 0ms wifi, 5033ms not connected)

@reikred
Copy link

reikred commented Nov 24, 2021

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?

@Xavron
Copy link

Xavron commented May 14, 2022

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:

@SuppressLint("SdCardPath") final String BOOT_SCRIPT_PATH = "/data/data/com.termux/files/home/.termux/boot";
        final File BOOT_SCRIPT_DIR = new File(BOOT_SCRIPT_PATH);

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 cp /storage/emulated/0/.termux/boot/start-sshd $HOME/.termux/boot/ and reboot and it will be found.

You can validate its there with something like ls $HOME/.termux/boot/

On Android 12 with no root ability and it works fine for me after this.

My script currently is as a first test:

#!/data/data/com.termux/files/usr/bin/sh
/data/data/com.termux/files/usr/bin/sshd -p 1234 -D

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:

  • Improving the wording in the termux boot app instructions.

  • Adding a toast or other message and checking the proper folder for files on opening the termux boot app and telling the user if files were or were not found.

  • Checking files at both locations

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.

@reikred
Copy link

reikred commented May 19, 2022

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.
Capital Termux-boot is in https://github.com/AbdullahM0hamed/Termux-boot

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?

@MrAdityaAlok
Copy link
Member

@reikred Termux-boot is an add on Android app (officially packaged), not some shell script. Also it does not require root as your mentioned script does.

You may get it from fdroid.

@Xavron
Copy link

Xavron commented May 19, 2022

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 shopuld run even if the app itself is not started,

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.

@reikred
Copy link

reikred commented May 19, 2022

That was a non-answer , Aditya.

@MrAdityaAlok
Copy link
Member

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.

@reikred
Copy link

reikred commented May 19, 2022

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.

@MrAdityaAlok
Copy link
Member

MrAdityaAlok commented May 19, 2022

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!

@Grimler91
Copy link
Member

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.

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

@reikred
Copy link

reikred commented May 19, 2022

@Grimler91,

I'll attempt to take step back and try to summarize/identify what the main issues are:

  1. The delay timer with the unknown value makes Termux:Boot difficult to understand and debug. Some possible improvements would be to add some documentation, to explain where in the code the delay is set (I could not find it), to make the delay user-programmable, and to log some status of the delay starting and ending (logcat).

  2. Better than a (long) delay timer would in my case be to wait and detect when the network (wifi) is up. Some ideas on relevant android java code is here https://stackoverflow.com/questions/3841317/how-do-i-see-if-wi-fi-is-connected-on-android. That might not be the right criterion for all boot scripts, though. Maybe some termux app-level user-selection of criteria (delay timer and value, wifi connected , can ping some IP address, ...)?

  3. It would be helpful if the start/exit status of each boot/script was logged. That would give an idea on where to look when problems arise (e.g. script bombed (might guess there was no #! shebang but one was needed in some particular version of android), syntax errors, script has not finished/exited, etc etc etc). I realize now that I could attempt to run each boot/script manually and look for signs of trouble (assuming running script twice would not break anything, that is a possibility).

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):
$ ip a | grep wlan0 | grep UP
31: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 3000

@agnostic-apollo
Copy link
Member

There is no significant delay in termux-boot or termux-app itself and a job is scheduled to immediately execute scripts within next 3 seconds when Android sends the ACTION_BOOT_COMPLETED event. The event is sent after user unlocks the screen for the first time and can be sent after a few seconds to few minutes depending on the device and android os build and how many things need to be set up after boot on a specific device. Time would vary across different boots too on same device. Android may possibly delay executing the job too and communication between apps via intents is slow too under heavy system load.

Moreover, termux-boot does not execute the scripts. It just sends and intent to the termux-app to do it. You can check logcat log after setting Verbose log level to see all the details of execution, including start and end time and any errors.

A manual delay could be considered as well when termux-boot is merged with termux-app but that likely will take time, since lot of other designing and coding needs to be done first.

https://github.com/termux/termux-boot/blob/master/app/src/main/java/com/termux/boot/BootReceiver.java

https://github.com/termux/termux-boot/blob/master/app/src/main/java/com/termux/boot/BootJobService.java

https://github.com/termux/termux-app#Debugging

@reikred
Copy link

reikred commented May 20, 2022

There is no significant delay in termux-boot or termux-app itself and a job is scheduled to immediately execute scripts within next 3 seconds when Android sends the ACTION_BOOT_COMPLETED event. The event is sent after user unlocks the screen for the first time and can be sent after a few seconds to few minutes depending on the device and android os build and how many things need to be set up after boot on a specific device. Time would vary across different boots too on same device. Android may possibly delay executing the job too and communication between apps via intents is slow too under heavy system load.

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?

Reference:
https://stackoverflow.com/questions/43144921/android-boot-completed-doesnt-fire-until-user-has-gone-past-lock-screen

@agnostic-apollo
Copy link
Member

As the linked article says the normal app data is stored under credential encrypted (CE) storage and is not available to apps before first unlock (BFU). So boot scripts won't be accessible to termux app.

The LOCKED_BOOT_COMPLETED receiver apps instead use device encrypted (DE) storage to store data which is available before BFU too, so one can define boot scripts in DE, but since boot scripts and termux rely on $PREFIX to actually be accessible to execute bash, python and all other termux package commands, which obv isn't decrypted before BFU, your requested feature cannot be implemented, since it's not of much use. Even termux terminal session won't be able to run. Boot scripts running background tasks that only use /system/bin binaries could be implemented, but that's not of much use.

https://developer.android.com/training/articles/direct-boot#run

https://source.android.com/security/encryption/file-based

@reikred
Copy link

reikred commented May 21, 2022

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:

  1. 0 sec reboot (10:26:00)
  2. 55 sec reached unlock screen
  3. 65 sec screen unlocked
  4. 257 sec sshd responds to ssh login request looped at 5 sec intervals

I'm looping the ssh attempts every 5 seconds to check when sshd got started by termux:boot
...
...
2022-05-20T10:30:07-07:00
ssh: connect to host moto-g8p port 8022: Connection refused
2022-05-20T10:30:12-07:00
ssh: connect to host moto-g8p port 8022: Connection refused
2022-05-20T10:30:17-07:00
username@moto-g8p's password:

I need to do some more adb logcat stuff, maybe that will give some clues.

@Xavron
Copy link

Xavron commented May 30, 2022

257 sec sshd responds to ssh login request looped at 5 sec intervals

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.

@TaraJura
Copy link

TaraJura commented Nov 25, 2022

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 am Using Android 11 that could be also the case.
And maybe even manufacturer can block that access mby (my phone Honor 9X)

--
I am thinking about automatically open lockscreen after restart, to run background jobs, I hope that i will find this option. It would be solution for the problem about the initial interaction after reboot.

@picgla
Copy link

picgla commented Feb 9, 2023

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
https://support.google.com/googleplay/answer/7513003?hl=en
and install still fails. according to play store, termux:boot has not been updated since 2017. are there any known alternatives?

@Grimler91
Copy link
Member

@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

@picgla
Copy link

picgla commented Feb 9, 2023 via email

@termux termux deleted a comment from N-mh07 Feb 28, 2023
@termux termux deleted a comment from N-mh07 Feb 28, 2023
@rrjanbiah
Copy link

rrjanbiah commented Oct 15, 2023

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 termux-wake-lock (exact code is in https://gitlab.com/-/snippets/3611198#LC40 )

But, on reboot the script is not getting triggered. When I open Termux, I'm getting a message:

1 session, 1 task (wake lock held)
Launch (≡)

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

@us3r1d
Copy link

us3r1d commented Jan 27, 2024

The LOCKED_BOOT_COMPLETED receiver apps instead use device encrypted (DE) storage to store data which is available before BFU too, so one can define boot scripts in DE, but since boot scripts and termux rely on $PREFIX to actually be accessible to execute bash, python and all other termux package commands, which obv isn't decrypted before BFU, your requested feature cannot be implemented, since it's not of much use. Even termux terminal session won't be able to run. Boot scripts running background tasks that only use /system/bin binaries could be implemented, but that's not of much use.

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?

@AntonSamokat
Copy link

AntonSamokat commented Mar 3, 2024

I have also problem with termux-boot on Xiaomi Redmi 7A with Android 10.
Prepared fix in the following pull request. It helped me.
#195

But it is better to use Android 9. It has much less restrictions than Android 10.

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