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

runsv not running #10

Open
dsche-cyber opened this issue Jul 17, 2020 · 5 comments
Open

runsv not running #10

dsche-cyber opened this issue Jul 17, 2020 · 5 comments
Labels
bug Something isn't working

Comments

@dsche-cyber
Copy link

On lineageos17.1

After install and restart and command

sv-enable tor

I get:

fail: tor: runsv not running
@Grimler91
Copy link
Member

If runsv is not running then $PREFIX/etc/profile.d/start-services.sh has not been sourced. Did you open a new shell rather than restarting termux after installing termux-services?

Try source $PREFIX/etc/profile.d/start-services.sh or restart termux and try again.

If it still does not work please give output of pstree.

@dsche-cyber
Copy link
Author

dsche-cyber commented Jul 30, 2020

I really restarted termux. I even rebootet multiple times. I tried sourcing, still doesn't work.

pstree output in tmux:

?─┬─?───bash───tmux: client
     └─tmux: server─┬─4*[bash]
                 └─bash───pstree

pstree output:

?─┬─?───bash───pstree
  └─tmux: server───4*[bash]

@Grimler91
Copy link
Member

What's your output of termux-info?

Does source $PREFIX/etc/profile.d/start-services.sh give you an error?

@dsche-cyber
Copy link
Author

dsche-cyber commented Nov 21, 2020

termux-info:
Linux localhost 3.4.113 armv71 Android
Device Model: SM-9005

source $PREFIX/etc/profile.d/start-services.sh
gives nothing

Now sv-enable tor gives:
warning: tor: unable to open supervise/ok: file does not exist

Still just tor works.

In $PREFIX/etc/profile.d/start-services.sh

export SVDIR=$PREFIX/var/service
export LOGDIR=$PREFIX/var/log
(service-daemon start >/dev/null 2>&1 & )

In $PREFIX/var/service is a directory, within a run (script), which starts tor (./run)

@Grimler91
Copy link
Member

After looking into this a bit (finally) it seem to happen when something goes wrong when runsv starts. If we delete the supervise folder for a running service then sv status gives this error, but the service continues to run without issues, so it is not quite the same as here.

I can somewhat reliably create the issue for a log service by setting up a service + script, but adding some well-crafted sleep statements in the middle of the script. Running this:

cd $PREFIX/var/service
echo -e "#!/data/data/com.termux/files/usr/bin/bash\necho 1\nsleep 3" > foo/run
chmod u+x foo/run
sleep 2
mkdir foo/log
sleep 1
ln -s $PREFIX/share/termux-services/svlogger $PREFIX/var/service/$sv/log/run

sv status foo then gives run: foo: (pid 28148) 3s; warning: foo/log: unable to open supervise/ok: file does not exist occasionally, so I guess there is some sort of race condition happening.

It can be fixed quite easily by killing the runsv process (check PID with ps aux | grep runsv), it then restarts and creates the supervise folder and everything works. Rebooting the phone also works, but I think that did not work when this situation happened "naturally" after installing with apt? Need to look into it more I guess

@Grimler91 Grimler91 added the bug Something isn't working label Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants