Can't Sync a file that doesn't exist

I’m having a problem with my Windows machine, an error keeps occurring saying it can’t sync a file in the .thrash directory because it cannot end with a “.”, but in that directory there isn’t such file, the folder is empty.

Can you post screenshots of the Syncthing Web GUI from both sides (with the error message visible)? Is the other side some kind of Linux? If yes, please check the folder from the command line using the ls -a command to see whether there are really no hidden files there that may end with ..

this is the only machine where the error is showing, it’s syncing to a MacOS and Android Device

I’d assume that the Games. file itself should be present on the Mac then. Can you check the folder there, possibly using the ls command suggested previously? Also, can you check the Web GUI on Android to see whether there is really no error there? Android normally uses FAT filesystem which also doesn’t allow files ending with ., so the error should be present there as well.

Only in limited circumstances such as when a USB flash drive is plugged in and SD card media on devices other than smartphones and tablets.

Primary storage is ext4 format and a mix of sdcardfs/F2FS for SD cards depending on the vintage of a phone.

I don’t think the above is correct. The whole internal storage has always been formatted to FAT by default. SDCardFS is essentially dead (see https://source.android.com/docs/core/storage/sdcardfs-deprecate), and while some custom ROMs did use to support other filesystems on the internal storage (like the aforementioned ext4 and F2FS), the major ones (i.e. LineageOS) dropped it long time ago already.

Linux, and Android by extension, cannot operate natively off a FAT filesystem because there isn’t enough support for file attributes and special files required by a Un*x system (e.g., symbolic links, contents of /dev).

The Linux kernel used to support UMSDOS, but it was removed about 6 years ago. UMSDOS stored Linux file attributes in a per-directory file on a FAT filesystem, then via Linux’s VFS, made it look as though the underlying filesystem wasn’t FAT. (For years I used to set up older computers to “dual boot” Windows 3/95/98 and Linux using UMSDOS when repartitioning or adding additional drives wasn’t an option.)

It’s also possible to use FUSE to simulate the required file attributes, but combining it with a FAT filesystem would be too slow for primary storage.

Nowadays, with most computers equipped with 256MB or more of RAM, Linux can bootstrap itself from an ISO or disk image sitting on a FAT filesystem, but the resulting system is either running from a loop device or cached entirely in RAM.

About 10 years ago, starting with Android 4.4, SELinux was added. That in turn required that the root filesystem support extended file attributes – so definitely no running from a FAT16/FAT32/exFAT partition.

With each generation of Android, SELinux became more integrated into Android’s core security model. Both Android and LineageOS are derived from AOSP (Android 13 = AOSP 13/“Tiramisu” = LineageOS 20). While the LineageOS project could disable SELinux, it wouldn’t make sense to do so, and it still wouldn’t make FAT suitable as a root filesystem for Linux.

For the reasons mentioned above, all of LineageOS’s images use ext4 for the root filesystem. What LineageOS is doing is removing support for other filesystems except FAT/vFAT/exFAT on external storage. In addition, the official images limit exFAT to devices where the manufacturer is known to have a license from Microsoft (the patents are still in effect).

There’s also the issue of the 4GB file size limitation with FAT16/FAT32. A lot of users download videos and shoot 2K/4K videos with their smartphones.

F2FS is the successor to SDCardFS, and was used by different manufacturers for a few years because it supports the required Linux file attributes. The latest versions of Android still supports it because F2FS and ext4 are currently the only two official filesystems for Android’s file-based encryption (which has superseded disk encryption in Android).

What’s important here is that regardless of what filesystems are used for other partitions, the internal storage (which is basically the equivalent of /home in other Linux systems and really the only place the user has access without root) is still (V)FAT with all its limitations, e.g. regarding allowed filename characters or case sensitivity, etc. (see https://averstak.tripod.com/fatdox/names.htm).

You can even verify this yourself easily by trying to create a file with one of those characters on the /sdcard partition:

$ touch "testfile.txt?"
touch: 'testfile.txt?': Operation not permitted
$ touch "testfile.txt:"
touch: 'testfile.txt:': Operation not permitted

These kind of issues are nothing new when it comes to Syncthing as well, as there have been a lot of forum topics and GitHub issues created with users asking for help on this specific matter (e.g. try searching for “android fat” on the forum).

What I was wrong about though is that . seems to be actually allowed on FAT as the last filename character. It’s only Windows that doesn’t like which I wrongly believed was the filesystem limitation. However, the other filesystem restrictions still apply.

The last point does make the Android filesystem issue kind of irrelevant to the question at hand now, as it appears to be only Windows that won’t accept the Games. file/folder in this case.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.