How to debug btsync under Linux?


Vince42

Recommended Posts

Hi,


 


I managed to install btsync on my Ubuntu 12.04 LTS server and created a config file based on the samples provided.


 


However, when I start btsync with



/etc/init.d/btsync start

it fails and consequently



/etc/init.d/btsync status
* BTSYNC 'username' is not running

is displayed (where 'username' is mentally to be displayed by the user that I am running the config for).


 


So I am stuck at this point as there is no sync.log, nor did it help to provide "FFFF" in debug.txt in the user's .btsync folder.


 


Where can I start to debug why btsync won't start the daemon?


 


Cheers


Vince


 

Link to comment
Share on other sites

Execute the following command as root user:

/usr/lib/btsync/btsync-daemon --nodaemon --config /etc/btsync/debconf-default.conf

and look at the error message you get. If you have created no default instance, you should replace the name of the config file with the name of your manually created config file.

Link to comment
Share on other sites

Hi,

 

now I finally got an error message:

Error while parsing config file: Unexpected end of config file (are you missing '}') ?

(I really wish we had XML config files ... *sigh*)

 

My config file reads like this:

 

//!/usr/sbin/btsync-daemon --configDAEMON_UID=username// DAEMON_GID=usergroupDAEMON_UMASK=0002{"device_name": "BT","listening_port": 12345,"storage_path": "/home/username/.btsync","check_for_updates": false,"use_upnp": false,"download_limit": 0,"upload_limit": 0,"disk_low_priority": true,"lan_encrypt_data": true,"lan_use_tcp": false,"rate_limit_local_peers": false,"folder_rescan_interval": 600,//"sync_max_time_diff": 600,//"max_file_size_diff_for_patching": 1000,//"max_file_size_for_versioning": 1000,//"sync_trash_ttl": 30,"webui": {},"shared_folders": [{"secret": "SECRET1","dir": "/home/username/sync/first","use_relay_server": true,"use_dht": false,"search_lan": false,"use_sync_trash": true},{"secret": "SECRET2","dir": "/home/username/sync/second","use_relay_server": true,"use_dht": false,"search_lan": false,"use_sync_trash": true}]}

I also tried a variant that I found here in forums with

"shared_folders" : [{ ... }],"shared_folders" : [{ ... }]

but that one did not work either (and does not really make sense either).

 

I am able to launch the daemon with sample/simple.config and sample/complex.config. I tried to adjust complex.config, but once I entered my details I got the error message again. The config file is owned by username:usergroup and is chmod 600 (recommended in a bittorrent blog post). All specified folders exist and are for the time being set to 777 (later on 700 for .btsync and 600 for sync should suffice, I guess?)

 

Thank you very much in advance for any help ...

 

Cheers

Vince

Link to comment
Share on other sites

//!/usr/sbin/btsync-daemon --configDAEMON_UID=username// DAEMON_GID=usergroupDAEMON_UMASK=0002

The solution to your problem is REALLY EASY:

You have removed the comment slashes before DAEMON_UID and DAEMON_UMASK. If you had read carefully the initial posting, you would have seen the following phrase: "Configuration parameters not parsed by BitTorrent Sync but by the daemon scripts can be supplied as comments in the configuration file."

Add the comment slashes before DAEMON_UID and DAEMON_UMASK and everything will work as desired. If you do not want to set the DAEMON_GID, remove the line.

Link to comment
Share on other sites

Okay, my bad ... but might I add that this is at best a really weird config file format?

Why not use some validating XML? That would save a lot of irritation ...

I know, this applies to linux daemon users mainly, but still ... 

 

Thank you very much for the help though!

 

Cheers

Vince

Link to comment
Share on other sites

Okay, my bad ... but might I add that this is at best a really weird config file format?

Why not use some validating XML? That would save a lot of irritation ...

I know, this applies to linux daemon users mainly, but still ... 

 

I think that I'm the wrong person to discuss this. The configuration file format is defined by the developers of BitTorrent and they decided to use the JSON format (that is a totally standardised format like XML but length more concise and human-readable) with the very useful extension to permit comments. I see no reason to blame them for this decision.

 

When writing my scripts for deploying and operating btsync on linux servers, I had to decide, if the additional instance related information would be stored in an additional configuration file per instance or embedded in the configuration file. Since the configuration file of btsync permitted to add comments, I decided to keep everything in one configuration file, that is the more practical solution. Everything is well documented (see initial posting).

Link to comment
Share on other sites

I just wanted to share my thoughts about the config file format.

 

JSON is standardized, yes, so is XML.

 

It's as lengthy as XML, allows comments as XML, is human-readable like XML.

 

It is not validatable, has qotes, equal signs, curly and square brackets, commas, semicolons - a definte drawback.

 

Besides all that: I don't know a single server software, which would use JSON as config file format.

 

All this being said, it seems very reasonable to overthink the idea of configuring btsync with a JSON-comment-mix-file.

 

Just my two thoughts ...

Link to comment
Share on other sites

I think that the biggest problems with the JSON file are basically two:

  1. The format is very very strict. One wrong comma or parenthesis, and nothing works any more
  2. The parser unfortunately returns error messages that make it really difficult for the user to find what is really wrong

I think that the developers have not spent very much time in this part of the software, since the main usage (Windows and Mac) does not require users to write a configuration file in order to get a working installation. Internally the configuration file is probably only the serialisation of internal data structures that are subsequently maintained in the internal database (that's the reason you can start btsync also without any configuration file, since there are decent defaults for standard user centric operation (but only if the executable is always started from the same directory).

 

That's the reason I tried the help the user as most as possible NOT to deal with the configuration file... but since the UID/GID stuff has a lot of implications with user rights and accessibility, I preferred to leave the user in full control of it.

Link to comment
Share on other sites

Hi,

 

don't misunderstand me: I am not blaming you for anything - you did and are doing an awesome job!

 

The point is: if you don't question the existing flaws, you will not improve anything. Therefore - from my personal experience - arguing like "it's JSON" is distracting.

 

Let's end this discussion here ... one fine day the developers will realize that a JSON file is not the way to configure a server software.

 

Cheers

Vince

Link to comment
Share on other sites

don't misunderstand me: I am not blaming you for anything - you did and are doing an awesome job!

 

The point is: if you don't question the existing flaws, you will not improve anything. Therefore - from my personal experience - arguing like "it's JSON" is distracting.

 

No problem. The only thing I wanted, was to explain, what was the situation I found, the presumed motivation of the BitTorrent Developers and my motivation to decide to put the additional parameters regarding the startup into the configuration file.

I think that it is a good thing to discuss about the inherent problems, and I would also like to find a better solution. Unfortunately I'm not in the position to do anything regarding the format of the configuration file. Perhaps you have any Idea, what I can do to improve the overall experience?

 

p.S.: I'm not a BitTorrent developer. I say this because I noticed that a lot of people thinks so....

Link to comment
Share on other sites

  • 2 weeks later...

 

 

Besides all that: I don't know a single server software, which would use JSON as config file format.

 

 

 

But really, that's just you. Lots of server software uses JSON for configuration. For example Chef uses json. And Node.js uses it of course quite a lot as well; yes, Node.js is no server software, but a language - as an example for a server software in Node.js with JSON, have a look at SDC by Joyent.

 

I'm not a big fan of JSON, but stating that no server uses JSON is plain wrong.

 

Alexander

Link to comment
Share on other sites

Okay, the original statement was maybe misleadingly formulated.

 

I meant popular productive server software like databases, web servers, bind, postfix, dovecot - basically software a typical server is running and that is provided by any Linux system out of the box.

 

This means, that I am not talking about JavaScript libraries like Node.js, which might use JSON of course.

 

Thank you for giving me the chance to clarify this.

Link to comment
Share on other sites

If you ldd btsync from a linux system, you can see that btsync petty much DOES NOT depend on any 3rd party packages.

 

Using XML requires some XML parser, such as libxml, many embedded systems don't include it because it's quite big.

 

This is just a config file, please don't make it so complicated, or even suggest doing that, thanks.

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.