I’ve just ran into a strange limitation regarding synchronization of permissions. Maybe it is a bug, maybe it is just a mistake on my side.
This concerned a particular folder I am sharing between devices A, B and C.
One day I accidentally mounted the folder on C with ntfs-3g in a wrong way which caused many unintentional permission changes. Syncthing synchronized these changes as expected back then. I didn’t do anything about it after the fact as I don’t really care about these permission changes in that folder. I think this was even before A, B and C were migrated to v2. There were no other changes made on C to this date but it pulled newer versions from other devices occasionally.
Since then I’ve updated all devices to v2.
Today I made a mistake when doing some testing for Syncthing Tray which effectively reset my Syncthing config on device A. I accidentally posted a config to my production Syncthing instance via the REST API which was supposed to go to some test instance instead. So Syncthing removed all my folder configs and consequently also all databases. Not a big deal, I simply restored the previous config from backups. I did not restore the database from backups because the database was a bit behind. So I instead lead Syncthing scan all folders again. This was ok because everything was in sync anyway.
The problem I ran into was that one folder would not get back in sync. Of course they were in sync anyway but device A always though that remote device B still has many out of sync items. Device B thought that remote A is up to date. So this was a one-sided problem. Device A and B both thought correctly that they are in sync locally.
Weirdly, device A thought that remote device B lacks a version of many files that was last modified by C. Not all files were affected; only files were the last version was still the permission change by C were showing as out of sync.
I tried the following to rectify the situation:
- Turn on device C. This didn’t help except that C pulled some new versions. From device C the remotes A and B were both in sync.
- Enable ignoring of permissions on all devices. This didn’t help. I turned device C off again.
- Turn device A and B on and off. This didn’t help.
- Disable ignoring permissions again on A and B. This didn’t help.
- Run
find . -exec chmod 755 {} \+in the folder on device A. This changed a permissions change on all files. After re-scanning I’ve got many more out of sync files on remote B but this time the count went down to zero. So this finally helped. - Run
find . -exec chmod 777 {} \+on A again to restore how permissions were before. Again, all permissions were synced as expected and the on device A remote B was eventually in sync again. - Turn on device C again which was still ignoring permissions. The device was quickly updating as expected and ignoring permissions worked as expected.
TLDR: So device A was stuck thinking remote B needs to get permission-only changes from device C. Only generating a new version by changing permissions back-and-forth on device A helped. The problem only occurred after doing an initial scan on device A (due to losing the database).
By the way, I’m wondering whether it would make sense if Syncthing could preserve the database when removing a folder (as an advanced opt-in feature). This way it would be less trouble accidentally deleting a folder from the config at the cost of having to clean the database files manually (although there could be some automatic cleanup similar to how versioning works).