Syncthing Jail

Status
Not open for further replies.

George51

Contributor
Joined
Feb 4, 2014
Messages
126
I would like to create a generic jail and use wget to install syncthing from source.
I know (and currently doing so) that there is a syncthing plugin - but I have moved away from plugins, and like the ability to control my own updates etc with generic jails. I've done the same with plex, moved away from the plugin to a generic jail.

I can install wget, and use it to pull syncthing down into a jail. And I am happy adding storage, and sorting my permissions out. But what I am struggling with, is getting syncthing to start, running as the user I choose (created a user called syncthing) and have it automatically restart if the jail is restarted.

I know for transmission and plex I have added an entry into /etc/rc.conf that works to restart it. But I am struggling with syncthing - I have done some research but it hasn't led me anywhere useful, please could someone give me a kick in the right direction?
 

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
Install syncthing from ports.
Code:
portsnap fetch extract
cd /usr/ports/net/syncthing
make config-recursive
make install

All the hard work is done for you, then all you need to do is add an entry to rc.conf in your jail.
 

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
Install syncthing from ports.
Code:
portsnap fetch extract
cd /usr/ports/net/syncthing
make config-recursive
make install

All the hard work is done for you, then all you need to do is add an entry to rc.conf in your jail.
I went this route recently. There is no reason to wget source and mess with that when ports works brilliantly
 

George51

Contributor
Joined
Feb 4, 2014
Messages
126
Thank you both - interesting. Couple of questions, when I occasionally go into jails and do pkg update pkg upgrade, does that upgrade the port too? Or is that a separate command?
And secondly, does this port allow syncthing to update itself? Or has that been disabled?
 

George51

Contributor
Joined
Feb 4, 2014
Messages
126
Interestingly I ran into a problem with those four simple commands.
Code:
(long list of ports from the "portsnap fetch extract" command)
...
...
/usr/ports/x11/yeahconsole/
/usr/ports/x11/yelp/
/usr/ports/x11/zenity/
Building new INDEX files... done.
root@Syncthing:/ # cd /usr/ports/net/syncthing
root@Syncthing:/usr/ports/net/syncthing # make config-recursive
WARNING: number of probes fixed does not match the number of defined probes (16 != 18, respectively)
WARNING: some probes might not fire or your program might crash
===> Setting user-specified options for syncthing-0.14.18 and dependencies

Now I have seen that WARNING before - in an emailed out put of a CRON Job I used to run (PMS_Updater script). To mitigate that error I decided it was about time I stopped using the update script (I had modified it anyway to suit my needs) and just use the pkg update to update plex.
But to see the same problem in a separate jail? And a google doesn't help me much with this error.

Any pointers?
 

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
Thank you both - interesting. Couple of questions, when I occasionally go into jails and do pkg update pkg upgrade, does that upgrade the port too? Or is that a separate command?
And secondly, does this port allow syncthing to update itself? Or has that been disabled?
I want to say yes, but that wouldn't be the case for the majority. If there is a package, you can just do pkg install net/syncthing. Otherwise you have to update the ports tree and reinstall.
 

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
I found the PKG version to be an older version than the port snap for some reason.

But running PKG upgrade doesn't touch your ports.
 

George51

Contributor
Joined
Feb 4, 2014
Messages
126
Yep I just found the same - PKG is a incremental version behind the ports. Is the setting for the built in updater configurable in either of them? Or has it been disabled?

Is there any benefit from using one over the other? And do I need to be concerned with the warning above?
 

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
So when I was redoing my jails recently, I didn't install the syncthing plugin. I did a PKG install in a jail. After learning that the PKG version was different than my Fedora boxes and causing conflicts with syncing symlinks, I just ran a make in the ports, and copied the binary over to replace the binary from PKG
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
The auto-update function is disabled in the port (and package). Here's how I work around it for the FreeNAS plugin
https://github.com/josh4trunks/free...ins/syncthing/scripts/post-install.sh#L19-L22

You could implement yourself, like so.
  1. Edit the port's 'Makefile' and change the "-no-upgrade" flag from true to false, and build the port.
  2. Create the folder /usr/local/bin/ST with "syncthing" as the owner.
  3. move /usr/local/bin/syncthing to /usr/local/bin/ST/syncthing
  4. edit /usr/local/etc/rc.d/syncthing to execute the syncthing binary at the new location
  5. Never update the syncthing package or auto-updating will stop working.
 

George51

Contributor
Joined
Feb 4, 2014
Messages
126
Thank you - I went back got the port and followed your steps Joshua - worked like a charm. Now I need to wait and see if the updates work next time there is an update pushed.

I assume I am fine leaving the syncthing file itself as root:wheel?
I've set the folder it is (/usr/local/bin/ST) as you said to syncthing:syncthing

Whilst doing the jails again I got the spurious warning

Code:
root@Syncthing:/usr/ports/net/syncthing # make config-recursive
WARNING: number of probes fixed does not match the number of defined probes (16 != 18, respectively)
WARNING: some probes might not fire or your program might crash


Any pointers on where I can look into that?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Thank you - I went back got the port and followed your steps Joshua - worked like a charm. Now I need to wait and see if the updates work next time there is an update pushed.

I assume I am fine leaving the syncthing file itself as root:wheel?
I've set the folder it is (/usr/local/bin/ST) as you said to syncthing:syncthing

Whilst doing the jails again I got the spurious warning

Code:
root@Syncthing:/usr/ports/net/syncthing # make config-recursive
WARNING: number of probes fixed does not match the number of defined probes (16 != 18, respectively)
WARNING: some probes might not fire or your program might crash


Any pointers on where I can look into that?
oh, that file also needs to be writable by the syncthing user, so it can be replaced on its own.

I'm not sure what the probe warning is about
 

rio236

Dabbler
Joined
Aug 19, 2016
Messages
38
I would greatly appreciate if one of you that got Syncthing installed in a jail can provide a step-by-step on how I can preform my own installation.
Thanks.
 

Oldman

Cadet
Joined
Feb 8, 2017
Messages
4
Install syncthing from ports.
Code:
portsnap fetch extract
cd /usr/ports/net/syncthing
make config-recursive
make install

All the hard work is done for you, then all you need to do is add an entry to rc.conf in your jail.
Hi m0nkey_, would appreciate your help with instructions on the rc.conf. I used

sysrc syncthing_enable=YES

But it did not work.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Hi m0nkey_, would appreciate your help with instructions on the rc.conf. I used

sysrc syncthing_enable=YES

But it did not work.
did you start the service or restart the jail
 

Oldman

Cadet
Joined
Feb 8, 2017
Messages
4
Tried starting and restarting. I used to run the syncthing plugin. I installed using the instructions above in a fresh jail, stopped the plugin and restarted the new jail. Could not connect through the syncthing WebGUI using port 8384.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Tried starting and restarting. I used to run the syncthing plugin. I installed using the instructions above in a fresh jail, stopped the plugin and restarted the new jail. Could not connect through the syncthing WebGUI using port 8384.
what does 'service syncthing status' show in the jail? What about 'sockstat'?
stopping the plugin is completely unrelated to your jail package install, it doesn't matter what you do with it.
 

Oldman

Cadet
Joined
Feb 8, 2017
Messages
4
status.png
Sockstat below. What did I do wrong?

Sockstat.png
 
Last edited:

Oldman

Cadet
Joined
Feb 8, 2017
Messages
4
Got it working. For the benefit of anyone facing the same problem, the following are the steps in the new syncthing jail:

Code:
portsnap fetch extract
cd /usr/ports/net/syncthing
make config-recursive
make install
sysrc syncthing_enable=YES
ee /var/db/syncthing/config.xml


Look for the following section
Code:
    <gui enabled="true" tls="false" debugging="false">                         
        <address>127.0.0.1:8384</address>                                         


Change the address from 127.0.0.1:8384 to 0.0.0.0:8384

You can now access the WebGUI through the jail's address:8384.

I hope this helps.
 

TrashKing

Dabbler
Joined
Feb 15, 2018
Messages
28
I went this route recently. There is no reason to wget source and mess with that when ports works brilliantly

Could you please explain why this is happening.

Code:
root@syncthing:/usr/ports/net/syncthing # uname -a
FreeBSD syncthing 11.1-STABLE FreeBSD 11.1-STABLE #2 r321665+366f54a78b2(freenas/11.1-stable): Wed Mar 21 23:04:13 UTC 2018



Code:
root@syncthing:/usr/ports/net/syncthing # make config-recursive
===> Setting user-specified options for syncthing-0.14.45 and dependencies
===> Building/installing dialog4ports as it is required for the config dialog
===>  Cleaning for dialog4ports-0.1.6
/!\ ERROR: /!\

Ports Collection support for your FreeBSD version has ended, and no ports are
guaranteed to build on this system. Please upgrade to a supported release.
 
Status
Not open for further replies.
Top