mikey

Btsync With Systemd On Linux Doesn't Connect On Startup

Recommended Posts

Hi,

 

I've tried setitng up BTSync with systemd on Linux (Fedora 20). I followed the instructions here:

 

http://forum.bittorrent.com/topic/23948-btsync-fedora-at-startup-and-working-start-stop-service/?p=68468

 

Which I've got loading for my user on boot OK but when it loads it always fails to connect to any peers until I reboot the service. It always almost immediately connects to a local peer once I've restarted the service.

 

Here is the log where it fails to connect:

Nov 03 07:01:38 nixon btsync[657]: By using this application, you agree to our Privacy Policy, Terms of Use and End User License Agreement.Nov 03 07:01:38 nixon btsync[657]: http://www.bittorrent.com/legal/privacyNov 03 07:01:38 nixon btsync[657]: http://www.bittorrent.com/legal/terms-of-useNov 03 07:01:38 nixon btsync[657]: http://www.bittorrent.com/legal/eulaNov 03 07:01:38 nixon btsync[657]: [20141103 07:01:31.577] total physical memory 536870912 max disk cache 2097152Nov 03 07:01:38 nixon btsync[657]: [20141103 07:01:32.677] Loading config file version 1.4.99Nov 03 07:01:38 nixon btsync[657]: [20141103 07:01:33.684] SF[A10C]: Loaded folder /home/michael/Documents/Work/ObsidianIRNov 03 07:01:38 nixon btsync[657]: [20141103 07:01:34.173] SF[E8BC]: Loaded folder /home/michael/.common/commonNov 03 07:01:49 nixon btsync[657]: [20141103 07:01:49.286] KickSocketObj::set_error(err=101, socket_error=false): : Network is unreachableNov 03 07:01:49 nixon btsync[657]: [20141103 07:01:49.287] Using IP address 192.168.0.2Nov 03 07:01:53 nixon btsync[657]: [20141103 07:01:53.293] UPnP: Could not map UPnP Port on this pass, retrying.Nov 03 07:01:58 nixon btsync[657]: [20141103 07:01:58.315] UPnP: Could not map UPnP Port on this pass, retrying.Nov 03 07:02:01 nixon btsync[657]: [20141103 07:02:01.317] NAT-PMP: Unable to map port with NAT-PMP.Nov 03 07:02:03 nixon btsync[657]: [20141103 07:02:03.319] UPnP: Could not map UPnP Port on this pass, retrying.Nov 03 07:02:08 nixon btsync[657]: [20141103 07:02:08.326] UPnP: Unable to map port 192.168.0.2:59543 with UPnP.

And here is the log after I reboot the service:

Nov 03 07:10:56 nixon btsync[2111]: By using this application, you agree to our Privacy Policy, Terms of Use and End User License Agreement.Nov 03 07:10:56 nixon btsync[2111]: http://www.bittorrent.com/legal/privacyNov 03 07:10:56 nixon btsync[2111]: http://www.bittorrent.com/legal/terms-of-useNov 03 07:10:56 nixon btsync[2111]: http://www.bittorrent.com/legal/eulaNov 03 07:10:56 nixon btsync[2111]: [20141103 07:10:56.420] total physical memory 536870912 max disk cache 2097152Nov 03 07:10:56 nixon btsync[2111]: [20141103 07:10:56.420] Using IP address 192.168.0.2Nov 03 07:10:56 nixon btsync[2111]: [20141103 07:10:56.422] Loading config file version 1.4.99Nov 03 07:10:56 nixon btsync[2111]: [20141103 07:10:56.423] SF[A10C]: Loaded folder /home/michael/Documents/Work/ObsidianIRNov 03 07:10:56 nixon btsync[2111]: [20141103 07:10:56.424] SF[E8BC]: Loaded folder /home/michael/.common/commonNov 03 07:11:00 nixon btsync[2111]: [20141103 07:11:00.434] UPnP: Could not map UPnP Port on this pass, retrying.Nov 03 07:11:05 nixon btsync[2111]: [20141103 07:11:05.424] UPnP: Could not map UPnP Port on this pass, retrying.Nov 03 07:11:10 nixon btsync[2111]: [20141103 07:11:10.426] UPnP: Could not map UPnP Port on this pass, retrying.Nov 03 07:11:15 nixon btsync[2111]: [20141103 07:11:15.471] UPnP: Unable to map port 192.168.0.2:24073 with UPnP.

I notice that there is always a network unreachabel message on the failed connection attempt at boot. And I've noticed now that there also seems to be a NAT-PMP error message as well.

 

I have told it to wait for networking in a couple of ways in the systemd service file: "After=network.target" and "After=network-online.target". But neither has helped.

 

Here is the current state of my service file:

[Unit]Description=BitTorrent Sync for %iAfter=network-online.target[Service]Type=simpleUser=%iExecStart=/usr/local/bin/btsync --nodaemon --config %h/.sync/sync.confRestart=on-abortWorkingDirectory=%h[Install]WantedBy=multi-user.target

And I have it enabled on boot for my user with:

 

systemctl enable btsync@michael

Share this post


Link to post
Share on other sites

Hi,

 

I had looked at that service file on the AUR. I've tried versions of it that do the same thing. The service file I posted is very similar but waits on a slightly more advanced neworking target and specifies the multi-user target for its WantedBy condition rather than the default target which I believe will be the same thing on arch.

 

I've put in place a workaround from here:

 

https://github.com/rodolpheh/nm-dispatcher-btsync

 

I installed the 50-btsync file into my /etc/NetworkManager/dispatcher.d/ folder and ran:

sudo -ichmod +x /etc/NetworkManager/dispatcher.d/50-btsyncgroupadd btsync-usersusermod -a -G btsync-users "<MY-USERNAME>"

This method of starting the systemd service has the advantage that it handles things like VPNs better.
It does seem like a problem though that this is necessary on some systems.

 

Using this method I no longer get the error message about

NAT-PMP: Unable to map port with NAT-PMP.

Share this post


Link to post
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.