I do get sync conflicts all the time… literally almost everytime I change a file.
I bet this can’t be normal and maybe I should find some time to fix it.
Since I can’t guarantee that two syncing devices are online and accessible all the time, I thought it might be a good idea to install Syncthing on a server that is always online. So to speak acting like a middleman between my devices. So I sync my devices to this server and vice versa. That’s my setup.
Do you think the conflicts have something to do with the above described setup?
How could I go to debug this issue? I’m not sure what’s causing these conflicts and where to start poking.
I am syncing mostly KeePassXC password database files.
The filename doesn’t change, but the content does.
In KeePassXC I enabled the option “Other save method: Change temporary file to location” which is meant to resolve problems with sync providers.
Involved are mostly Linux devices, but also one Windows PC and one Android Phone
I feel that this happens mostly when I make several changes to a file in a short period of time.
I am aware that this information provided might not be enought, but currently I don’t have time to gather more than that. I will however look into this myself asap and will share as much as I can find.
Probably I should’ve waited posting this until I gathered more information… sorry!
What is your Syncthing version? If any of the devices runs v1.22.0 or v1.22.1, you should upgrade to the newest v1.22.2 because there were issues leading to unnecessary conflict creation in those two versions.
There’s no harm in leaving the “Other save method: Change temporary file to location” enabled, but KeePassXC’s default save mode (“Safe saves”) is also fine for Syncthing. While the former writes changes to a new database under the temporary files folder, the latter puts the new database right alongside the existing/original file. Both save methods result in a completely new database file that replaces the previous version.
For example, on a Linux/Android device, suppose that a KeePassXC password database file is named “passwords.kdbx”. It’ll be given a unique inode number in the filesystem (e.g., “11111111”). Next, the password database is updated, so KeePassXC creates a temporary database file with the change(s) which the filesystem will assign a unique inode number (e.g., “22222222”). Once the temp file is closed, KeePassXC deletes the previous database file with inode number “11111111” and then renames the temp file with inode number “22222222” to “passwords.kdbx”.
Because both Temporary file saves and Safe saves modes in KeePassXC result in new database files, Syncthing will be notified by the OS that there was a sequence of create → delete → rename filesystem events. Ext4 on Linux/Android and NTFS on Windows are both journaling filesystems so file renames are atomic – if there’s a power failure in the middle of a rename process, the file being renamed won’t be in limbo because the filesystem journal is automatically “replayed” when the filesystem is back online. If the rename cannot be completed, the file keeps its old name.
And because Syncthing has a default 10-second delay after a new filesystem event notification is detected before triggering a scan, KeePassXC will have had plenty of time to complete its tasks so that Syncthing won’t even bother with transferring both the temp file and what it’s renamed to since both are the same file (i.e., same inode number).
Based on your description of the symptoms and the setup, the first thing that comes to mind is if the affected KeePass database files are open on multiple devices at the same time and you have one or more of KeePassXC’s auto-save options enabled.