I wrote a simple guide for setting up Resilio Sync on FreeBSD as root &/or user


jdrch

Recommended Posts

I wrote a simple guide on how to do the above. It works on FuryBSD too and can also be used to switch an installation from being run under root to being run under user without resinstalling.

For distributions such as GhostBSD that have an rslsync package available in their repos: the only thing in the instructions that might change is you install & update from the repo using your package manager instead of manually from the archive.

Thanks @Alex. for the assistance.

Link to comment
Share on other sites

  • Helen pinned this topic
2 minutes ago, eltopo said:

I suggest that do NOT run rslsync as root. run it as a normal user with webui's listening port > 1024.

It's standard Unix(-like) practice not to, but TBH I haven't seen any major case of compromised root process KOing a Unix(-like) OS in a very long time.

The biggest reason not to, IMO, is that rslsync as root makes the user's own synced files read-only to them, which is problematic.

Link to comment
Share on other sites

I have never seen Resilio run as root. However, as a hidden admin in the admins group no rights need to be assigned specifically for individual directories, since the admin group generally has access everywhere.

I cannot judge where the difference is to a user Resilio, to whom the rights to directories should be assigned individually.

Link to comment
Share on other sites

  • 1 month later...

@PacketMan A couple things about that:

  1. There is no package available in the FreeBSD repos. To see for yourself, run
    pkg search rslsync
    on FreeBSD 12.1-RELEASE-p4. You'll get no results.
  2. The FreshPorts listing literally says there's no package available:
Quote
A package is not available for ports marked as: Forbidden / Broken / Ignore / Restricted
PKGNAME: there is no package for this port: _LICENSE_RESTRICTED = delete-package delete-distfiles
  1. You can't compile it yourself either because it's closed source so there's nothing to compile from
  2. Besides all of that, the most recent version in the FreeBSD repos is 2.6.3, which is a version behind the current stable release

Now, there are some other FreeBSD-based distros such as GhostBSD that have rslsync in their repos, but I suspect that's because they also use the TrueOS repos, which are a superset of FreeBSD's. I would not suggest anyone use TrueOS' downstream repos on raw FreeBSD unless they want to run into package state/dependency problems.

Link to comment
Share on other sites

Well I'll be dammed. I guess you could use portmaster to install it then. I've been using Synth to keep my repo up to date, but I am way over due for an upgrade.  After I get everything moved over to Syncthing I will see if Synth will still build its own package. Looks like that will break now. That is a real shame.

https://www.freshports.org/ports-mgmt/synth/

/usr/ports/ports-mgmt/synth

 

If the folks at Resilio want to maximize the potential user base of their product they have to include it in the FreeBSD ports/packages tree. Please don't anyone turn this into a "no one uses FreeBSD" rant; lots of people use it; a lot more than people may realize.  When the product was "BTSync" before they implemented the "selective sync" it heavy duty rock solid on FreeBSD (and other OSs I add) and then it got ghostly buggy after selective sync, imho.

 

Best wishes everyone.

 

 

 

Link to comment
Share on other sites

AFAIK FreeBSD repos contain open source packages only, but I could be wrong.

I actually do use FreeBSD, which is why I wrote the post 😛 Resilio Sync works perfectly for me, but then again I don't use the Selective Sync feature.

Link to comment
Share on other sites

  • 5 weeks later...

So as I mentioned earlier I use a program call Synth which downloads code and builds the packages on the machine. So I am not downloading pre-built packages, but am downloading the code, and Synth builds the packages on my machine. Similar to another program called Poudriere.

Anyway, I finally got around to updating my machine, using Synth, which will re-build any required packages. 

Portmaster, which I only use to easily show which programs have updates available:

===>>> rslsync-2.6.3
        ===>>> New version available: rslsync-2.7.1


And then I ran Synth and got this:

00:03:15 [02] success  net-p2p/rslsync

 

So it looks like Synth users can still build on the 2.7.1 version.  That just said, for me however I have finished up migrating all my stuff to Synchthing, and will actually be uninstalling the net-p2p/rslsync package soon.

 

 

 

 

 

 

Link to comment
Share on other sites

I don´t understand, what is your claim or issue. On all my Synology servers, Windows clients, Android devices I also use Syncthing in parallel to Resilio to learn, what are the differences, advantages etc. of both. If I have any problems with Resilio (as with Android APP in the past), I switch to Syncthing and try to solve the problem and switch back or not.

Link to comment
Share on other sites

@Andy+ Over the years of discussing things online I've found it's not particularly useful to question the basis of a decision a user makes for themselves. Whatever reasons @PacketMan has for switching, they work for him, and I think we should do him the courtesy of assuming he's thoroughly researched the topic and knows what's best for his use case.

Link to comment
Share on other sites

4 hours ago, jdrch said:

@Andy+ Over the years of discussing things online I've found it's not particularly useful to question the basis of a decision a user makes for themselves. Whatever reasons @PacketMan has for switching, they work for him, and I think we should do him the courtesy of assuming he's thoroughly researched the topic and knows what's best for his use case.

 Sorry guys looks like I have mixed two points together thus confusing my 'position' or 'claim'.  Really all I was saying is that using Synth with FreeBSD you can still install a Resilio package, no custom 'set up' required. Jdrch is correct in saying that a pre-built package is no longer available, but I am saying Synth will create the package and install it for you....all you need to do is add the appropriate /etc/rc.conf line so that it starts up automatically if you require that.

Then I confused the issue, when I said I have abandoned Resilio for Synchthing; and that comment should have been in another post. Sorry guys I did not mean to 'mix' the two.

Jdrch, yes I am very familiar with Resiio and Synchthing and have made the decision.  I am a big fan of the power and potential of the bittorrent protocol (for legitimate applications, especially commercial/enterprise applications), and I am still a fan of Resilio, but at this point in time I simply cannot keep using Resilio for various reasons.

Link to comment
Share on other sites

No problem, all partie are understood. For me is the same since approx. a year. Before I test Syncthing only, because was not so good as Resilio. Now, for me, Syncthing is good as Resilio and only feature thing, because both have Bugs. But Support of Syncthing is much better and also the Update cycles.

Link to comment
Share on other sites

  • 3 months later...

I run it (2.6.3) via the included jail/plugin on my FreeNAS... 

But I also run the FreeBSD "binary" (2.6.2 - I guess I should update it - but it works) on its own, in my shell account on my FreeNAS - something like  :

./rslsync --config ./rsl-config.json --webui.listen 0.0.0.0:8888

I only have one sync folder with this method for my shell account, that's my shell scripts I use nearly everywhere, that fit nearly everywhere (e.g. in 4 GB NAND SBC's running debian).

 

Link to comment
Share on other sites

  • 1 month later...

Hello!

I can't say that your instruction works for me, but I still have a question, how do I run resilio as a user at system startup? I've tried system crontab, user crontab and it's not working.

Only placing the script with the command in /etc/rc.d / solves my problem, but running as root is not what I need. Thanks.

 

P.S. I want to build a very reliable backup server for myself, because FreeBSD + is a new experience for me, it is still very different from Linux, at least in the examples of documentation of real cases. And yes, I am studying the handbook for the second day, but there are no examples that I need. More precisely they do not work in FreeBSD 12.2

 

Link to comment
Share on other sites

16 hours ago, Dima Nirox said:

Hello!

I can't say that your instruction works for me, but I still have a question, how do I run resilio as a user at system startup? I've tried system crontab, user crontab and it's not working.

Only placing the script with the command in /etc/rc.d / solves my problem, but running as root is not what I need. Thanks.

 

P.S. I want to build a very reliable backup server for myself, because FreeBSD + is a new experience for me, it is still very different from Linux, at least in the examples of documentation of real cases. And yes, I am studying the handbook for the second day, but there are no examples that I need. More precisely they do not work in FreeBSD 12.2

 

Which part of the guide are you having trouble with?

And yeah I can empathize with the troubles getting Resilio to run as a service under FreeBSD, as I've always found init incredibly confusing.

Does Step 6) here not do what you want?

Link to comment
Share on other sites

10 hours ago, jdrch said:

Does Step 6) here not do what you want?

yes, the problem is in autostart of the service on load like user, not root. I added this and other strings (options for running the script) to the user crontab and system, even tried options with sudo username but the service does not start at system startup.

Link to comment
Share on other sites

8 hours ago, Dima Nirox said:

yes, the problem is in autostart of the service on load like user, not root. I added this and other strings (options for running the script) to the user crontab and system, even tried options with sudo username but the service does not start at system startup.

We may just be arguing semantics here, but technically I don't think my implementation is a service in the FreeBSD sense of the word. It's a background process that starts at reboot explicitly from a crontab entry. A true service is managed by FreeBSD init, which quite honestly I've spent years trying to understand - at least for apps like Resilio Sync that are delivered as FreeBSD binaries and not packages - to no avail.

The other problem with setting up the binary as a service is - IMO - it makes updating it a much bigger PITA, because now you have to tangle with manually stopping and starting the service instead of just killing and then launching the process.*

I have no actual idea how to set up a FreeBSD service from scratch using only a binary; I've never been able to find any documentation that explains it fully and the FreeBSD Handbook is almost incomprehensible on the topic. Ironically, I got my method from the Handbook itself, which admits that it's easier in most cases to use crontab to get something to start at boot without user interaction. If you're able to figure it out, please by all means share it with me and I'll add it to my writeup.

IIRC one thing you'll want to look into is your user rc.d directory. I do believe that's where services that run under users live, but I'm not 100% sure. You can also ask at r/freebsd, r/bsd, or the FreeBSD forums.

Sorry I'm not able to be of further assistance!

*Soapbox: This is why I laugh when folks complain about systemd on Linux. Systemd is the greatest thing to happen to Linux ever, because it makes service management much less of a barely comprehensible CF as it is with init (as you're experiencing now). Services.msc (Windows) is still the best service management system in existence, period. Click to stop, start, restart, disable, enable, set to manual or automatic, etc. all through a single UI.

Link to comment
Share on other sites

1 hour ago, jdrch said:

We may just be arguing semantics here, but technically I don't think my implementation is a service in the FreeBSD sense of the word. It's a background process that starts at reboot explicitly from a crontab entry. A true service is managed by FreeBSD init, which quite honestly I've spent years trying to understand - at least for apps like Resilio Sync that are delivered as FreeBSD binaries and not packages - to no avail.

The other problem with setting up the binary as a service is - IMO - it makes updating it a much bigger PITA, because now you have to tangle with manually stopping and starting the service instead of just killing and then launching the process.*

I have no actual idea how to set up a FreeBSD service from scratch using only a binary; I've never been able to find any documentation that explains it fully and the FreeBSD Handbook is almost incomprehensible on the topic. Ironically, I got my method from the Handbook itself, which admits that it's easier in most cases to use crontab to get something to start at boot without user interaction. If you're able to figure it out, please by all means share it with me and I'll add it to my writeup.

IIRC one thing you'll want to look into is your user rc.d directory. I do believe that's where services that run under users live, but I'm not 100% sure. You can also ask at r/freebsd, r/bsd, or the FreeBSD forums.

Sorry I'm not able to be of further assistance!

*Soapbox: This is why I laugh when folks complain about systemd on Linux. Systemd is the greatest thing to happen to Linux ever, because it makes service management much less of a barely comprehensible CF as it is with init (as you're experiencing now). Services.msc (Windows) is still the best service management system in existence, period. Click to stop, start, restart, disable, enable, set to manual or automatic, etc. all through a single UI.

All fine. You've already helped me. 
 

For me, it is more an experiment to understand from personal experience whether FreeBSD is really so "good and reliable" for my purposes. So far, I doubt it very much. The documentation does not correspond to reality, most of the applications that I use in Linux are just  not available for FreeBSD, there is no virtualization as a guest system (qemu agent is absent in nature, not counting the ported version with limited functionality). Something tells me that I will play with this system for a while and go back to Linux, because everything just works there. And I do not want to start swearing about Linux vs FreeBSD, but to study the problem for more than two weeks.... It's not even funny :)

Link to comment
Share on other sites

1 hour ago, Dima Nirox said:

All fine. You've already helped me. 
 

For me, it is more an experiment to understand from personal experience whether FreeBSD is really so "good and reliable" for my purposes. So far, I doubt it very much. The documentation does not correspond to reality, most of the applications that I use in Linux are just  not available for FreeBSD, there is no virtualization as a guest system (qemu agent is absent in nature, not counting the ported version with limited functionality). Something tells me that I will play with this system for a while and go back to Linux, because everything just works there. And I do not want to start swearing about Linux vs FreeBSD, but to study the problem for more than two weeks.... It's not even funny :)

Fair. The only reason I run FreeBSD is so I can accurately comment on all major OS families (except macOS, which I'm planning to add sometime this year) from firsthand experience. OSes are a hobby of mine. However, I ran into the same frustrations you are with FreeBSD, to the point of making a list of reasons why I might stop running it in the future.

As for stability, I also run Debian and in my experience its the most stable useful OS I have on hand (the others being 3 release channels of Windows, Raspberry Pi OS, FreeBSD, OpenIndiana, Ubuntu, and Android.) I emphasize "useful" because OpenIndiana is also stable but the documentation, hardware support, and package support are so bad it's really not worth using for something serious unless you're migrating from Solaris and don't want to learn anything new. OI also doesn't support UEFI boot. In 2020. Yikes.

As for virtualization, are you saying running FreeBSD as a VM is difficult, or that it's difficult to run VMs on FreeBSD? AFAIK bhyve is the preferred solution for the latter, and I've seen folks achieve the former using Proxmox. However, I have no personal experience with either solution.

If I were in your shoes, I'd pick whichever OS works best for what you want and just run the other on used/less important hardware. That way you can keep up with developments without having to dogfood them. But that's just me. Cheers :)

Link to comment
Share on other sites

Yes I did it :) I reinstalled my old server and now it runs Proxmox and it already runs Ubuntu 20.04.1 and FreeBSD 12.2

Surprisingly, the network speed test shows a big difference. FreeBSD does not hang 500-600mb/s at the same time in Ubuntu the speed is not lower than 800-900mb/s all this on one server, in one data center :) but I'm still working on it.

Link to comment
Share on other sites

2 minutes ago, Dima Nirox said:

Yes I did it :) I reinstalled my old server and now it runs Proxmox and it already runs Ubuntu 20.04.1 and FreeBSD 12.2

Surprisingly, the network speed test shows a big difference. FreeBSD does not hang 500-600mb/s at the same time in Ubuntu the speed is not lower than 800-900mb/s all this on one server, in one data center :) but I'm still working on it.

Are you using Intel, Mellanox, or Chelsio NIC(s)? FreeBSD frequently has trouble with NICs that aren't 1 of those 3. My FreeBSD has a Realtek NIC and the wired connection crashes every now and then.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.