I’m having issues with constant conflicts on a dual-boot system, hoping someone might have an idea of how they could be alleviated. Here’s the setup:
Syncthing is syncing a folder between my PC and a NAS (send and receive at both ends). The PC is a dual boot system (Windows+Linux), so locally, the folder is actually pointed to by two installations of Syncthing, though obviously only one of them would be active at a time (depending on which OS is booted).
The issue is that if I edit a file, then reboot to the other OS without waiting for it to completely upload to the NAS, then continue working in that file from the 2nd OS, I get conflicts. Note that the file is never touched remotely (on the NAS) - it’s only being edited on the shared local partion. As an example, if I’m on Linux, edit db.ctb, reboot to Windows, continue working in db.ctb, I will see conflicts named i.e. db.sync-conflict-20220323-200523-XXXXXXX.ctb, where XXXXXXX is the device ID of Windows (the OS that I booted into).
What I’d like to do is be able to keep this folder synced between my NAS & local PC (whether I happen to be booted to Linux or Windows), but without having constant conflicts whenever I need to reboot. I should mention that I do need the NAS<->PC syncs to be bi-directional, as there are there are actually other PCs that also sync via the NAS - however for simplicity when debugging these conflicts, I have all other PCs powered: only two clients are online, the NAS and whichever local OS is booted (either Windows or Linux).
Thanks in advance.
If you only have the shared data partition, and not a shared Syncthing database, this is expected. It’s basically the same as two different devices doing different edits to the same file, leading to a conflict. For dual boot systems, using the same database and config for both Syncthing instances (thus having only one device ID regardless of them operating system used) seems more appropriate and should work with partially synced files before rebooting.
Hmmm…but since Windows & Linux use different path structures, isn’t it impossible to share the same config/db? i.e. “SomeFolder” on the shared partition would be in i.e. D:/SomeFolder from the perspective of Windows, but /media/mountpoint/SomeFolder from the perspective of Linux. So each OS’s Syncthing needs to know the path as appropriate to that OS.
Right. I know others here have described such a setup, but maybe they only shared the certificate and database, but not the config.xml file.
If you switch OSes halfway through syncing and before the “newly started” Syncthing can get in sync, conflicts will indeed always appear. Sharing a db might work (using
--data), but also seems a bit risky.
Not really, but you do need to use relative paths for your Syncthing folders, e.g.
./SomeFolder and similar, instead of full paths that are specific to each OS.
Sharing a db might work (using
--data), but also seems a bit risky.
So would you share just config, or both config and db? And in either case, why do you think it’s risky?
If you switch OSes halfway through syncing
The issue is that sitting & waiting for it to fully upload before I’m able to reboot my system is often very impractical. i.e. I may be working from a coffee shop with slow WiFi - sometimes it can take 20 minutes before it syncs the entire database. In those cases, it isn’t really practical to have to just before I’m able to reboot my local system to Linux
Ah, risky because if I update one but not the other, it could update the db or the config file in a way that breaks the other. So if I’m understanding, it seems like my options are either:
- Deal with constant conflicts whenever I reboot, or
- Deal with risks if not carefully/simultaneously updating both copies each time
As long as the set of shared folders is the same on both OSes, and you don’t need to sync anything outside of the shared data partition, the solution proposed by @tomasz86 should save you some hassle, as it shares both config and DB.
In the other case, it may help to start Syncthing manually, so you have the chance to apply config changes done on one OS to the other instance before they end up e.g. removing stuff from the DB because the corresponding folder is not yet added in both configs.
Right, my concern with sharing config/db is: what happens when i.e. I’m using Windows, Syncthing gets updated, then I reboot to Linux, and Linux is still using the prior version? Thus I need to make sure to always update it simultaneously on both OSs, lest there’s some risk of one OS’s newer db/config being accessed by the other OSs older db/config. Just a guess, but I assumed that’s what imsodin was referring to when he said “also seems a bit risky”.
Yeah, you do absolutely need to disable automatic updates and always make sure you’re using the exact same version if you want to stay on the safe side. This is done the easiest by using the same version binaries downloaded from the official website (rather than relying on what the OS provides).
Yeah, makes sense. Thanks
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.