termux / termux-boot

Termux add-on app allowing programs to be run at boot.
https://f-droid.org/en/packages/com.termux.boot
973 stars 224 forks source link

Not running #19

Closed liubo-chongqing closed 5 years ago

liubo-chongqing commented 6 years ago

I create a folder cd /data/data/com.termux/files/home/ mkdir .termux/boot nano start-sshd

content: termux-wake-lock sshd

Restart termux sshd Not started

I am planning to start UBUNTU File Directory: cd /data/data/com.termux/files/home/termux-ubuntu/ start up : ./start-ubuntu.sh

liubo-chongqing commented 6 years ago

Always running termux-boot cp /data/data/com.termux/files/usr/bin/sshd /data/data/com.termux/files/home/.termux/boot/ Follow the instructions to do everything,Still not started。 Google paid $1.99。Why is this happening?

liubo-chongqing commented 6 years ago

$ logcat -s termux --------- beginning of crash --------- beginning of main

Grimler91 commented 6 years ago

Might be because you don't have a shebang, try setting first line to need to #!/data/data/com.termux/files/usr/bin/sh.

You have to restart the device for anything to happen, not restart termux. And you need to open the termux-boot app at least once but I guess you've done that.

liubo-chongqing commented 6 years ago

I am configured this way in this directory. data/data/com.termux/files/home/.termux / boot nano start-sshd

!/data/data/com.termux/files/usr/bin/sh

termux-wake-lock sshd restart cellphone,turn on termux ,Computer running ssh,Can't find this device。 enter:sshd Normal connection

Grimler91 commented 6 years ago

Make sure the script is executable as well, chmod u+x start-sshd.

jody-frankowski commented 5 years ago

I was bit by this too. Make sure you set the right selinux context if you created the files through adb:

Before:

j3xnlte:/data/data/com.termux/files/home # ls -laZ
total 20
drwx------ 4 u0_a10 u0_a10 u:object_r:app_data_file:s0:c512,c768 4096 2019-04-10 20:22 .
drwx------ 4 u0_a10 u0_a10 u:object_r:app_data_file:s0:c512,c768 4096 2019-04-10 17:48 ..
-rw------- 1 u0_a10 u0_a10 u:object_r:app_data_file:s0:c512,c768   13 2019-04-10 16:59 .bash_history
drwx------ 2 u0_a10 u0_a10 u:object_r:app_data_file:s0:c512,c768 4096 2019-04-10 16:53 .ssh
drwxr-xr-x 3 root   root   u:object_r:app_data_file:s0           4096 2019-04-10 20:23 .termux

After:

chcon -R u:object_r:app_data_file:s0:c512,c768 .termux
j3xnlte:/data/data/com.termux/files/home # ls -laZ
total 20
drwx------ 4 u0_a10 u0_a10 u:object_r:app_data_file:s0:c512,c768 4096 2019-04-10 20:22 .
drwx------ 4 u0_a10 u0_a10 u:object_r:app_data_file:s0:c512,c768 4096 2019-04-10 17:48 ..
-rw------- 1 u0_a10 u0_a10 u:object_r:app_data_file:s0:c512,c768   13 2019-04-10 16:59 .bash_history
drwx------ 2 u0_a10 u0_a10 u:object_r:app_data_file:s0:c512,c768 4096 2019-04-10 16:53 .ssh
drwxr-xr-x 3 root   root   u:object_r:app_data_file:s0:c512,c768 4096 2019-04-10 20:23 .termux

termux-boot probably could output a more appropriate error when the file truly isn't readable: https://github.com/termux/termux-boot/blob/9dd220ec8dfe21634229c9e95db2d5300a0f29a3/app/src/main/java/com/termux/boot/BootReceiver.java#L62 A mention of this in the docs would be nice too.

Also, I can confirm that the shebang isn't necessary.