im getting sync errors running syncthing on wsl as non-root user because it seems to create files and folders as root when there’s files it needs to create from the other machine (debian), specifically. i didn’t think syncthing should able to do that, i’ve turned off the matching permissions etc. then after they’re created as root, seems it runs into permission issues when it does other operations as a normal user, such as
directory has been deleted on a remote device but is not empty; the contents are probably ignored on that remote device, but not locally
and permission denied on other files.
there’s 2 computers running syncthing, the other is a debian machine, doesn’t seem to have the same problem in the other direction.
how to fix this? should syncthing actually be running as root?
Curious, why specifically did you choose to install Syncthing for Linux under WSL, rather than using the windows version? The windows version can talk to your Linux machines. It is platform independent.
I have never loaded the software in WSL but I am familiar and do use WSL. My Syncthing runs under regular Windows.
WSL is a virtual machine type environment and may introduce some problems that regular development may not have come across when doing their testing because I’m not exactly certain if the standard QA process for the software does any actual testing in the WSL environment.
Depending upon which way you install the software it may get installed in different users. For example if you download the Debian package and install it as your regular user then the software gets installed underneath your user account.
If you install the software using the script or from the Repository it will be installed under a system account not under your personal account.
There are two generations of WSL (the original WSL followed by WSL2) with wildly different architectures. The first one is similar to Wine for Linux (a software compatibility layer) while the newer one is a virtual machine running Ubuntu Linux on top of Microsoft’s Hyper-V hypervisor.
A lot depends on which WSL is being used along with how/where the files/folders being synced are stored.
Also, how is Syncthing installed in WSL? (i.e. from Syncthing’s APT repo, Docker container, Snap, etc.)
With a not-so-common installation, any and all details are helpful.
Hi - it’s Debian bookworm/sid on WSL2, I installed syncthing with sudo apt install syncthing. that said after @Wank replied, it made sense there might not be much testing for syncthing running inside WSL2, so i purged syncthing and installed the windows version and pointed the folder inside wsl. now it’s been re-syncing about 33g since yesterday, seems to be going awfully slowly. there’s lots of temp files, unlike e.g. rsync, my syncthing setup seems to actually fully download every single file, and compare. i do have a reasonably fast tplink mesh wifi. i’d have thought syncthing would do some fancy merkle tree md5 stuff to go fast. is there some ‘–fast’ setting that im missing, for instance rsync lets you just use modification times instead?
Is it possible for you to not use folders inside WSL?
You’re having a Windows application access data inside a Windows Virtual Machine which is going to impact performance and perhaps functionality.
In order for Syncthing on Windows to access WSL files it needs to look inside the virtual machine.
What I do with my WSL that you might try to improve performance is to map a drive letter to WSL. I have Windows Drive Z pointing to my Linux subsystem.
To map a drive in Windows to the Windows Subsystem for Linux (WSL), you can follow these steps:
Open Windows Explorer.
Click on the “This PC” icon in the left-hand pane1.
Click on the “Map network drive” option in the toolbar.
Enter the UNC path for the WSL distribution you want to map. The format is \\wsl$\[DistributionName] . For example, if you’re using Ubuntu, you would enter \\wsl$\Ubuntu-20.04
Debian’s Syncthing package tends to trail the upstream release by around 2-3 years, so consider using Syncthing’s official APT repo: https://apt.syncthing.net/
Could you expand on what you mean by “pointed the folder inside wsl”?
Even on a 100 Mbps connection, it should take well under an hour to move 33 GB of files. If I were to guess, I’d say that your two Syncthing devices are using a Syncthing relay. Either that, or it’s something about the storage on your Windows setup.
How many files total? What’s the largest number of files in a folder?
Syncthing generates SHA256 hashes for each data block. I don’t know if Syncthing uses a Merkle tree in memory, but on disk it’s a LevelDB (key/value store) used for tracking hashes.
If you haven’t already, check out the https://docs.syncthing.net/ for all the details and available configuration options.
At this point, screenshots of the Syncthing GUI with the folder and device panels expanded would help a lot, along with a lot more details, otherwise it’s going to require a lot of back and forth forum posts over several days to diagnose this.