Debian And Ubuntu Server Unofficial Packages For Bittorrent Sync


Recommended Posts

That's really interesting. I am trying to reproduce the error, but I am not able to do so. It seems that the decomposition of the name does not work correctly:

pi btsync 1.0.134-4~wheezy i386 Private network P2P file synchronisation daemon(s)

root@fileserver:~# service btsync stop

[ ok ] Stopping P2P file synchronisation daemon(s)...[....] Stopping btsync instance 'btsync':.

[....] Stopping btsync instance 'debconf-default.pid':rm: cannot remove `/var/run/btsync.debconf-default.pid.pid': No such file or directory

root@fileserver:~# ls -la /etc/btsync

total 16

drwxr-xr-x 3 root root 4096 May 26 19:39 .

drwxr-xr-x 70 root root 4096 May 26 21:44 ..

-rw-r--r-- 1 root root 1185 May 26 19:39 btsync.sierink.conf

drwxr-xr-x 2 root root 4096 May 26 19:30 samples

Your upgrade is on ubuntu, mine on debian jessie, with the btsync wheezy package (there seems to be no jessie package yet).

Link to comment
Share on other sites

root@fileserver:~# service btsync stop

[ ok ] Stopping P2P file synchronisation daemon(s)...[....] Stopping btsync instance 'btsync':.

[....] Stopping btsync instance 'debconf-default.pid':rm: cannot remove `/var/run/btsync.debconf-default.pid.pid': No such file or directory

...

Your upgrade is on ubuntu, mine on debian jessie, with the btsync wheezy package (there seems to be no jessie package yet).

OK. As I can see, the stop routine is trying to stop two intances (one named 'btsync', the other named 'debconf-default.pid'), but according to your config files, you should only have the instance named 'btsync' running. Can you please show me the contents of your /var/run directory?

I need the output of two commands:


ls -la /var/run
ls -la /var/run/btsync.*.pid

We are now very near to find a solution.

Link to comment
Share on other sites

OK. As I can see, the stop routine is trying to stop two intances (one named 'btsync', the other named 'debconf-default.pid'), but according to your config files, you should only have the instance named 'btsync' running. Can you please show me the contents of your /var/run directory?

root@fileserver:~# ls -la /var/run

lrwxrwxrwx 1 sierink sierink 4 Apr 8 21:49 /var/run -> /run

root@fileserver:~# ls -la /var/run/btsync.*.pid

-rw-r--r-- 1 root root 5 May 26 19:14 /var/run/btsync.debconf-default.pid

Link to comment
Share on other sites

root@fileserver:~# ls -la /var/run

lrwxrwxrwx 1 sierink sierink 4 Apr 8 21:49 /var/run -> /run

root@fileserver:~# ls -la /var/run/btsync.*.pid

-rw-r--r-- 1 root root 5 May 26 19:14 /var/run/btsync.debconf-default.pid

One more please:


ls -la /var/run/

I suppose, that your instance of btsync was not running when you entered the command?

Link to comment
Share on other sites

One more please:


ls -la /var/run/

I suppose, that your instance of btsync was not running when you entered the command?

root@fileserver:~# ls -la /var/run/

total 48

drwxr-xr-x 12 root root 540 May 27 08:05 .

drwxr-xr-x 21 root root 4096 May 26 21:16 ..

-rw-r--r-- 1 root root 5 May 26 16:50 atd.pid

-rw-r--r-- 1 root root 5 May 26 19:14 btsync.debconf-default.pid

-rw-r--r-- 1 root root 5 May 26 16:50 crond.pid

---------- 1 root root 0 May 26 16:50 crond.reboot

drwxr-xr-x 2 messagebus messagebus 80 May 26 16:50 dbus

prw------- 1 root root 0 May 26 16:50 initctl

drwxrwxrwt 2 root root 60 May 26 21:20 lock

-rw-r--r-- 1 root root 73 May 26 16:50 motd.dynamic

drwxr-xr-x 2 root root 80 May 26 21:29 mount

drwxr-xr-x 2 root root 60 May 26 16:50 network

drwxr-xr-x 2 root root 60 May 26 22:28 pound

-rw------- 1 root root 6 May 26 22:28 pound.pid

drwxr-xr-x 2 root root 80 May 26 16:50 rpcbind

-r--r--r-- 1 root root 0 May 26 16:50 rpcbind.lock

-rw-r--r-- 1 root root 4 May 26 16:50 rpcbind.pid

srw-rw-rw- 1 root root 0 May 26 16:50 rpcbind.sock

-rw-r--r-- 1 statd nogroup 6 May 26 21:29 rpc.statd.pid

-rw-r--r-- 1 root root 5 May 26 16:50 rsyslogd.pid

drwxr-xr-x 2 root root 340 May 27 06:25 samba

drwxr-xr-x 2 root root 100 May 26 21:29 sendsigs.omit.d

drwxrwxrwt 2 root root 60 May 26 16:50 shm

-rw------- 1 root root 5 May 26 16:50 sm-notify.pid

drwxr-xr-x 2 root root 40 May 26 16:50 sshd

-rw-r--r-- 1 root root 5 May 26 16:50 sshd.pid

-rw-rw-r-- 1 root utmp 2304 May 27 13:07 utmp

Sorry, don't know if it runs. There is no webinterface.

Link to comment
Share on other sites

Sorry, don't know if it runs. There is no webinterface.

Thanks. You can find out if it runs by entering the command:


sudo ps ax | grep btsync

If the result show up more than the grep command, you entered, than the instance is running:


yeasoft-gate2 ~ # ps ax | grep btsync
1963 ? Sl 2:25 /usr/lib/btsync/btsync-daemon --nodaemon --config /etc/btsync/debconf-default.conf
4932 pts/1 S+ 0:00 grep --color=auto btsync

Basically there are some problems that I'm trying to understand:

  1. There is a PID file in your /var/run directory that should not exist, because according to your config file(s) in the /etc/btsync directory, you have no default config created by debconf. You have a file called /etc/btsync/btsync.sierink.conf and so i would expect only a PID file related to that configuration in the /var/run directory. Its name should be btsync.btsync.pid - so I'm asking myself: where does this file come from? Probably it is a "cadaver" from a previous installation but also in that case it should be possible to delete it...
  2. The daemon script /etc/init.d/btsync does the following when stopping: it looks for all files in /var/run according to the pattern 'btsync.*.pid'. After stopping the daemon with the PID supplied by the file, the file will be deleted. Since there is no btsync.btsync.pid file in your /var/run/directory, I suppose that you already have stopped your btsync instance. In your case the script tries also to stop the 'debconf-default' instance. The only strange thing is, that the instance name is not detected correctly: instead of 'debconf-default' the instance name is detected as 'debconf-default.pid'. And for that reason the script tries to delete a pid file, that does not exist: /var/run/btsync.debconf-default.pid.pid

Now let's try this fast workaround to help you with your real problem. Please delete the wrong PID-File:


sudo rm /var/run/btsync.debconf-default.pid

Now try to start the daemon and then stop it:


sudo service btsync start
sudo service btsync stop

Please tell me if this has solved your problem. In the meantime I will try to find out, why the script tries to delete the wrong pid-file under certain circumstances.

Link to comment
Share on other sites

Please tell me if this has solved your problem. In the meantime I will try to find out, why the script tries to delete the wrong pid-file under certain circumstances.

I can now start and stop it, the pidfile can be from another instance of btsync i used before installing your package.

I guess btsync was not running because the grep command gave:

root@fileserver:~# ps ax | grep btsync

31175 pts/0 S+ 0:00 grep btsync

Link to comment
Share on other sites

Sorry, don't know if it runs. There is no webinterface.

One thing more: please send me the result of executing the following commands (sorry - I have no jessie installed):


basename /var/run/btsync.debconf-default.pid | cut -c8-
BASENAME=$(basename /var/run/btsync.debconf-default.pid | cut -c8-); echo ${BASENAME%%.pid}

Link to comment
Share on other sites

One thing more: please send me the result of executing the following commands (sorry - I have no jessie installed):


basename /var/run/btsync.debconf-default.pid | cut -c8-
BASENAME=$(basename /var/run/btsync.debconf-default.pid | cut -c8-); echo ${BASENAME%%.pid}

root@fileserver:~# basename /var/run/btsync.debconf-default.pid | cut -c8-

debconf-default.pid

root@fileserver:~# BASENAME=$(basename /var/run/btsync.debconf-default.pid | cut -c8-); echo ${BASENAME%%.pid}

debconf-default

Link to comment
Share on other sites

Ok, the upgrade to Debian Jessie has succeeded, but i can not reinstall Btsync because of a dependency problem:

The following packages have unmet dependencies:

btsync : Depends: libc6 (< 2.14) but 2.17-3 is to be installed

Maybe when you have time you can make btsync available on jessie as well?

Link to comment
Share on other sites

Ok, the upgrade to Debian Jessie has succeeded, but i can not reinstall Btsync because of a dependency problem:

The following packages have unmet dependencies:

btsync : Depends: libc6 (< 2.14) but 2.17-3 is to be installed

Maybe when you have time you can make btsync available on jessie as well?

OK. I found the bug! Thank you for your valuable help! I will make the fixed version available in the next few hours. I didn't knew that jessie was already available as a defined version name. I will try to setup a build environment in order to produce also packages for jessie. In the meantime: have you tried to use the sid repository instead of the wheezy repository?

Link to comment
Share on other sites

SID installs btsync fine.

Now my last question, how to run it as user and make it available with gui.

I made following config file in /etc/btsync with name user.sierink.conf



//!/usr/sbin/btsync-daemon --config
//
// (c) 2013 YeaSoft Int'l - Leo Moll
//
// This btsync configuration file shows how to configure a btsync
// instance running under specific user credentials.
// Credentials can be embeded in the filename of the configuration
// file:
//
// filename.conf - no credential specified. The
// instance will run as root:root
// filename.<user>.conf - Instance will run as <user> with
// the primary group of <user>
// filename.<user>.<group>.conf - Instance will run as user:group
//
// This example will launch an instance running under the credentials
// of the user "jdoe"
// The internal data of the btsync daemon will be written in
// /home/jdoe/.btsync
// Since the web gui is disabled, the user cannot configure anything.
// The instance offers one replicated directory located in
// /home/jdoe/syncdir
//
{
"device_name": "fileserver",
"listening_port" : 0,
"storage_path" : "/home/sierink/.btsync",
"check_for_updates" : false,
"use_upnp" : true,
"download_limit" : 0,
"upload_limit" : 0,
"webui" :
{
"listen" : "192.168.1.17:9999"
}
}


Link to comment
Share on other sites

SID installs btsync fine.

That's great, since I was not able to create a builder environment for jessie (there is still an error with debootstrap).

Now my last question, how to run it as user and make it available with gui.

I made following config file in /etc/btsync with name user.sierink.conf


...
"webui" :
{
"listen" : "192.168.1.17:9999"
}

That should be fine, and if 192.168.1.17 is the TCP/IP Address of your server, it should work without asking you for credentials. In any case you can also specify:


"webui" :
{
"listen" : "0.0.0.0:9999"
}

In that case, btsync listens on all interfaces of the server in case the server has more than one IP address defined. If you specify an IP address there, it must be one of the addresses of the server. Obviously you must also make sure, that no other process listens on that port.

You can verify that btsync listens on port 9999 by entering the following command:


sudo netstat -tlpen | grep btsync

You should get an output similar to mine:



yeasoft-gate2 /etc/btsync # sudo netstat -tlpen | grep btsync
tcp 0 0 10.65.0.16:8888 0.0.0.0:* LISTEN 0 950175 30970/btsync-daemon
tcp 0 0 0.0.0.0:26185 0.0.0.0:* LISTEN 0 950162 30970/btsync-daemon

Here you can see, that my btsync daemon listens on 10.65.0.16 with port number 8888 (as configured in my config file)

If you are still not able to connect to the server, perhaps there is a firewall configured, that prevents accepting connections to port 9999

In this case you should configure the firewall accordingly.

Another question: Is that machine a server or your workstation? In that case perhaps it would make more sense to install the desktop version of the packages.

Link to comment
Share on other sites

That's great, since I was not able to create a builder environment for jessie (there is still an error with debootstrap).

It runs on a headless server. I use the desktop version on my pc's running LMDE without issues.

I restarted btsync and it seems to run fine but no return on netsat command:

root@fileserver:~# service btsync restart

[....] Stopping P2P file synchronisation daemon(s)...[....] Stopping btsync in[ ok e 'debconf-default':.

[ ok ] Stopping btsync instance 'user':.

[....] Starting P2P file synchronisation daemon(s)...[....] Autostarting btsync instance 'debconf-default':[....] Autostarting btsync instance 'user':root@fileserver:~# netstat -tlpen | grep btsync

root@fileserver:~#

Link to comment
Share on other sites

root@fileserver:~# service btsync restart

[....] Stopping P2P file synchronisation daemon(s)...[....] Stopping btsync in[ ok e 'debconf-default':.

[ ok ] Stopping btsync instance 'user':.

[....] Starting P2P file synchronisation daemon(s)...[....] Autostarting btsync instance 'debconf-default':[....] Autostarting btsync instance 'user':root@fileserver:~# netstat -tlpen | grep btsync

root@fileserver:~#

Sorry, but it seems to me, that you now have a great mess on your system. The output you sent me, seems to have no relationship with all the information you sent me before: it seems that you now have two configuration files in your /etc/btsync directory: the default file created by debconf, and a user specific file created by you named user.conf or similar. Since I have no idea, what are the contents of this new configuration files, I cannot give you any explanation. The worst problem, is that you now have recreated the same situation as before: the bug we have found, manifests itself, when more than one instance of btsync is running and that's exactly what you have done now.

One thing is known: if the netstat command did not return anything, no instance of btsync is currently running. This is probably due to conflicts in both configurations you have created. The reason why you do not see any error message, is that the BitTorrent btsync executable unfortunately still does not return any meaningful return code, if it encounters any error situation during startup.

Now please do the following:

  • Take a decision if you want a default debconf managed instance, running as root, on your system. If not, please do not install one as you have done now. And please do not remove the configuration by simply deleting debconf-default.conf from /etc/btsync. After any update, it will be automatically recreated because IT IS MANAGED BY DEBCONF (this is also written inside the file). If you do not want such a system managed instance, you have to answer "No" during the initial configuration when being asked if you want a default instance to be created. If you want to change things specified during the installation in the installation dialogs, you must issue the dpkg-reconfigure command. THIS IS A GENERAL RULE OF BEHAVIOUR FOR ANY DEBIAN PACKAGE. In your specific case, you have to issue the command "sudo dpkg-reconfigure btsync"
  • Please let's test your issues with only one configuration file. And please do not change things that stay in no relationship with what we are testing, like the name of the configuration file. And since the bug we found affects the functionality when operating btsync with more than one configuration file, you should now try to have a simple configuration that does exactly what you want.

Link to comment
Share on other sites

Restarted btsync with the user.sierink.conf file as in the previous post but still no luck.

OK: and now we will see if btsync is running at all:

Test if btsync is running:


sudo pgrep btsync-daemon

If the command prints a number, btsync is running (the number is the pid)

If btsync is not running, you must find out why. Probably there is an error in your configuration file. To find out, what is the error, you have to start btsync manually under the credentials of the user under which you want it to run. In this case, make sure you have a shell running under the users credentials and execute the following command:


/usr/lib/btsync/btsync-daemon --nodaemon --config /etc/btsync/user.sierink.conf

If btsync refuses to run, you will now see some error messages.

If instead btsync is running, you can test if it is listening on the internal connection port and for the web ui. Test it by the following command:


sudo netstat -tlpen | grep btsync

You should get two strings: one showing the listening information for the web ui, the other showing the listening information for the synchronization function.

Link to comment
Share on other sites

Version 1.0.134-5 is now online for Debian Intel builds. Ubuntu builds are on the way. Debian ARM Builds will follow this evening.

- Fixed: btsync did not start if web gui was configured to

operate with no credentials

- Fixed: btsync did not stop under certain circumstances

if there is more than one btsync.*.pid file in /var/run

Link to comment
Share on other sites

OK: and now we will see if btsync is running at all:

Test if btsync is running:

It is not running and this is the reason:

sierink@fileserver:~$ /usr/lib/btsync/btsync-daemon --nodaemon --config /etc/btsync/user.sierink.conf

Can't open pid file /home/sierink/.btsync/sync.pid. Permission denied

I created the pid file with the correct rights and now it works!

Thanks for your patience.

Link to comment
Share on other sites

I created the pid file with the correct rights and now it works!

Wait a minute! This is probably not sufficient to solve the problem, since there must be reason for this. If the process is running as sierink and was not able to create a file in /home/sierink/.btsync/ there can be only two explanations:

Either the user sierink has no suitable rights to the directory /home/sierink/.btsync/ (that would be very strange) or btsync was executed with this configuration file for the first time with other credentials. In that case the directory may have been created by the other users credentials or at least the files in it.

Please make sure that both the directory and all the files in it belong to the user sierink. Du this with the following command:


sudo chown -R sierink:sierink /home/sierink/.btsync/

BTW - Please update your btsync version. The new packages are online now.

Link to comment
Share on other sites

Is it possible that this packaged version of btsync does not support inotify? when I start btsync by hand it recognizes file changes as they happen, while the packed version with the init script does not. Also, the debug log does not mention any OnFileChange (?) events.

EDIT: So, replacing btsync-daemon with btsync from the tar.gz archive fixed this problem it seems.

Link to comment
Share on other sites

^ I have exactly the same problem, the server only syncs on the 10 min fallback interval, not on folder change.

I am running btsync-user_1.0.134-5~precise_amd64.deb on Ubuntu 12.04.2 LTS.

Testing sync between a windows7 machine and my server:

- Startup sync and 10 min fallback sync from server to local windows machine: OK

- Startup and immediate sync from windows machine to server : OK

- Immediate sync from server to windows machine: NOT OK

Link to comment
Share on other sites

Is it possible that this packaged version of btsync does not support inotify?

...

EDIT: So, replacing btsync-daemon with btsync from the tar.gz archive fixed this problem it seems.

Testing sync between a windows7 machine and my server:

Hi!

Yes. As I wrote in this post, when creating the packages I was in doubt, which version of btsync would be the right one and it seems that I took the wrong decision. My intention was to fix this upon the next release of btsync, but now I think that the guys from BitTorrent are working hard on making lots of changes and so it will probably take some more time until the next version will be released. Instead of waiting, I will try to create a new version today...

Link to comment
Share on other sites

Released Version 1.0.134.1-1 only for i386 and amd64. Debian builds are available, Ubuntu builds are on the way.

btsync (1.0.134.1-1~sid) sid; urgency=low

- Fixed: Replaced binary version for i386 and amd64 with

versions that support the current libc

-- Leo Moll <leo.moll@yeasoft.com> Sun, 02 June 2013 00:51:12 +0200

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.