Does not always sync

Hello! After suffering data loss, hair loss, and weight loss with Bittorrent Sync, I decided there is nothing better than free software! And I was not wrong, Synthing is more powerful than btsync, as expected! But I seem to have found a bug, or my configuration is not right yet…

This is how I setup Syncthing on my laptop: I installed Syncthing 0.11.26 from the official APT repository on Debian Wheezy, run the command syncthing, and set the default folder to Staggered File Versioning and to download in Alphabetic order.

In the Android device, I installed the latest version from the Play Store, and configured it to always run in the background, set the notification priority to normal, and enabled advanced folder selection. Then I created a new folder named Sync, and set its ID to default. On Android I did _not_ enable File Versioning.

On both sides I added the devices with the default options (metadata compression, dynamic address, not observer).

Then in the laptop, I copied a text file named File.json to ~/Sync/. It later appeared in the Android device. Then I opened File.json in Android, and edited it with the ES File Explorer, adding a few words to it. I waited to see if it would sync, but it did not. So I told Syncthing on both devices to refresh, but still the edited file remained only in the Android device. Then I copied another file to the Sync directory in Android, and only then Syncthing really synced, including the new File.json I had edited with ES File Explorer.

So the problem I seem to be suffering is that it doesn’t always sync, and it was in my first use. In the WebGUI on the laptop, I see the option “Ignore Permissions: File permission bits are ignored when looking for changes. Use on FAT file systems.”. I don’t know if I should enable this, since I see this option in the laptop, which has a ext4 filesystem, but not in the Android device. Is this option related to this problem?

Ignore permission is always enabled on Android but more because of Android than the filesystem itself ;). You don’t need to enable it on your laptop.

On Android it needs to be enabled, because syncthing is not allowed to set permissions, so synced files would immediately be seen as changed, because they don’t have the permission syncthing wanted them to have.

I often edit text files with Total Commander on Android and they are synced within seconds. The edited file getting synced only after adding another is really strange.

I’m pretty sure editing the file with ES File Explorer did cause a change in file size and mtime, right?

How long after the edit did you wait before adding the other file?

After you hit refresh in the Synchting Web UI on Android, did you see a a difference in size for the state of the folder? (1 Item, ~xxx B)

If you can reproduce it, could you post screenshots of the two Web UIs, with the folder info expanded.

I tried and was not able to reproduce it again, well, fortunately! But I checked to make sure, and ES File Explorer does update the file timestamp. If I see this problem again, I may come back here. Thank you for your help!

I have a few other questions regarding the Android client, but I will open a new thread!

Unfortunately, my problems persist between my Debian laptop and Android phone! I have written a long text below, but the main points are in bold!

Since I use Syncthing only in my local network, I have disabled Global discovery. With UPnP, the devices don’t connect at all. So I have left only Local discovery enabled, but the devices take a long time to connect. I believe when I have Syncthing running on both devices within the same network, they should connect to each other instantly, shouldn’t they? Generally, I have to wait for one minute or more for them to show as connected. The Android phone I disconnect and reconnect the WiFi periodically to save battery (it lasts double the time this way).

Another major problem: Today, I needed to go out and take with me a synced folder. I have a Python script that everyday updates one file within this folder in the laptop, and removes all others (except hidden files), and then generates other files with different names. Basically, one file is changed and others are always different. After waiting for both devices to connect, they both appeared as Synced, although all the files in Android were from the previous day. Both the number of files, their sizes and timestamps changed completely. I have restarted Syncthing on both sides, and still they both showed as Synced, without having synced anything at all.

I suspect this is some Android problem, so I tried enabling Sync as root, but then Syncthing fails to start, although I have authorized Syncthing in the app SuperSU.

And I was so happy about Syncthing that I even wrote a simple shell script that starts Syncthing, places an icon in the tray with Zenity/Yad, updates the icon to show connected/disconnected states, and opens the Web interface on left click!

Thank you for your support!

I forgot to mention, these are the iptables rules in the laptop:

Chain INPUT (policy DROP)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            
REJECT     all  --  anywhere             loopback/8           reject-with icmp-port-unreachable
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http-alt
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:22000
ACCEPT     udp  --  anywhere             anywhere             udp dpt:21025
ACCEPT     udp  --  anywhere             anywhere             udp dpt:21026

Chain FORWARD (policy DROP)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            

No because it takes time for connections to timeout, if there exists one. Also, it only tries to connect to other peers once a minute by default, or do you expect to to try and connect to every peer every second non stop?

Is the folder shared with each other currectly? Please provide screenshots of from both sides (web ui not android app)

I’m glad it works as intended! Is there any setting to reduce a bit the interval it searches for peers? In the phone I think it wouldn’t matter that much for the battery, since I have Syncthing configured to run only when connected to the WiFi.

Yes, they were shared and synced perfectly yesterday. But today I had to erase the folder to free some space after it failed to sync, since I had to upload them to Box.com and download in the phone, so I’ll have to wait for this to happen again before I can take a screenshot!

Don’t be lazy, and read the docs: http://docs.syncthing.net/users/config.html

I have already spent a good deal of time on this already. As I said, I even wrote a script to manage Syncthing for me.

I pointed you to the place where the settings are defined and explained, I can just tell you what to tweak where, but we will have some other topic in some time about something that again can be solved by reading the docs. I do want to help, but I am trying to reduce the amount of support we need to do by teaching people to help themselves, even if that requires me to look like an asshole.

I’m sorry, I got a little upset that you called me lazy, but thanks for your help so far. I setup the share again and it worked, so I’ll have to wait if it fails again, then I’ll take the screenshots.

The problem appeared again yesterday. I copied 18 pictures to the shared folder in Android, and only 5 synced back to the laptop. On both sides it was showing as already “Up to date”.

So I opened the web interface to take the screenshots. But before that, I saw there is the “Rescan” button, which is not available in the Android client. So I pressed the Rescan button, and then it synced indeed.

After that I took the screenshots (but I wonder if they will be of any help anymore). But one thing I have noticed though in the screenshots is that on Android the “Rescan Interval” defaults to 259200 seconds. In the laptop I had it changed to 20 seconds, but on Android the settings are the default. I forgot to mention that I’m syncing from an external SD card on Android.

The rescan interval is set to such a high number, because Syncthing Android uses inotify, to watch the file system for changes and report them to Syncthing.

If you have only problems with syncing new / changed files from Android to your PC, its probably related to an issue in Syncthing Android (specifically inotify) and the access to the external SD Card. @Nutomic could help tracking down the problem.

Which version of android are you using? Is it a vendor version, AOSP or custom rom?

I’m using Android 4.1.2, the default installed by LG. The version of their ROM is E425f10a-724-05.

I do want to help, but I am trying to reduce the amount of support we need to do by teaching people to help themselves, even if that requires me to look like an asshole.

There are nicer ways to teach people to help themselves, you shouldn’t go around being flippant and calling people lazy.

“You can find that information here in the docs [link]” would have sufficed.

Nobody remembers the good guys, everybody remembers the bad guys :wink:

So this to me seems like an syncthing-android inotify bug, given a rescan fixed it. You probably need to open an issue there, ideally with a way to reproduce it, or willingness to debug it via adb shell, which means you might need to be tech savy.

OK, I have opened a bug there!