Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] syncthing-s6 does not bring the service up (Read 2064 times) previous topic - next topic
0 Members and 3 Guests are viewing this topic.

[SOLVED] syncthing-s6 does not bring the service up

Hello everybody. I have a problem with the service syncthing. I installed and the software is working ok. The problem is when I try to start the service with s6.

When I execute the command:

Code: [Select]
$sudo s6-rc -v 6 -u change syncthing

s6-rc: info: bringing selected services up
s6-rc: info: processing service syncthing: starting
s6-rc: info: service syncthing started successfully

About s6 the service started ok, but I don't see the service up.

Code: [Select]
ps aux | grep sync
chucho    9746  0.0  0.0   6604  2320 pts/0    S+   12:42   0:00 grep --color=auto sync
root     17816  0.0  0.0   2784  1704 ?        S    09:56   0:00 s6-supervise syncthing

Also anything is listening on port 8384 when I execute:

Code: [Select]
ss -putan | grep 8384

Everything changes when I execute syncthing manually:

Code: [Select]
 ps aux | grep syncthing
chucho   11389  0.6  0.2 1323180 26764 pts/0   Sl+  12:44   0:00 syncthing
chucho   11397 35.1  0.5 1620248 65244 pts/0   SNl  12:44   0:03 syncthing
chucho   11701  0.0  0.0   6604  2264 pts/1    S+   12:44   0:00 grep --color=auto syncthing
root     17816  0.0  0.0   2784  1704 ?        S    09:56   0:00 s6-supervise syncthing

Code: [Select]
ss -putan | grep 8384
tcp   LISTEN     0      4096       127.0.0.1:8384          0.0.0.0:*     users:(("syncthing",pid=11397,fd=24))
tcp   ESTAB      0      0          127.0.0.1:8384        127.0.0.1:35586 users:(("syncthing",pid=11397,fd=28))

I checked the file /etc/s6/sv/syncthing/run and I don't see anything strange.

Code: [Select]
#!/usr/bin/execlineb -P
exec syncthing -logflags 0

I would like to help more but at the moment init scripts, especially s6, is quite difficult for me. Do you know what's going on?

Best regards.
Artix Linux Colombia

Re: syncthing-s6 does not bring the service up

Reply #1
I ran the command:

Code: [Select]
#s6-rc -v 6 -pu change syncthing

And after I f*** up everything I saw an error about $HOME variable is not defined. So I read about this and it's something about running the service as an user.

https://wiki.archlinux.org/index.php/Syncthing#Autostarting_Syncthing

I'm going to check more about getting something similar in s6 and I'll tell you.
Artix Linux Colombia

Re: syncthing-s6 does not bring the service up

Reply #2
I've been reading the configurations of other inits and all of them configure the user somewhere.

For example. The runit script is something like this:

Code: [Select]
#!/bin/sh
[ -r conf ] && . ./conf

exec 2>&1
exec chpst -u "$USER" syncthing -logflags 0

Where $USER is read by conf file.

And OpenRC has something similar in /etc/conf.d/syncthing

Code: [Select]
# User and group as which to run
#SYNCTHING_USER="syncthing"
#SYNCTHING_GROUP="syncthing"

I'm still checking.

Best regards.


Artix Linux Colombia

Re: syncthing-s6 does not bring the service up

Reply #3
Looks like I just need to fix the script then. I probably wrote this one before I knew what s6-setuidgid was for. :P

Edit: Looks like runit runs with the "root" user by default and actually running it via root should work even if it's not recommended.

Re: syncthing-s6 does not bring the service up

Reply #4
Okay I just pushed a new version of syncthing-s6 that should work (I'll double check syncthing-relaysrv-s6 as well; might have a similar issue). By default, it will run as the root user (which appears to not be recommend by the daemon but it's the only sane default user to assume). I'm not really sure why the openrc attempts to run as the "syncthing" user. This isn't created by the syncthing package. Maybe openrc automatically creates it; dunno how it works.

You can change the daemon to run as your user if you edit the /etc/s6/sv/syncthing-srv/conf file (also change the HOMEDIR to your home directory of course). If you bring it up with "s6-rc -u change syncthing", it should be in working order. Also logs are conveniently in /var/log/syncthing now.

Re: syncthing-s6 does not bring the service up

Reply #5
Hello. Now it's working. Thank you very much.

PS: I also have the same idea, I tried to edit the run file by myself but I couldn't. I guess I need to learn more about execlineb, it's not an easy language for me.
Artix Linux Colombia