Hello, I have a recurrent error on my Syncthing from Android.
The web interface always says “error in monitoring filesystem” in a yellow box.
Under that, it says that my main (and only) syncthing directory, called “syncthing” has a problem: “lstat /storage/emulated: no such file or directory”
But if I go a little bit lower on the same page, the syncthing folder has a green tick and folder status is synchronized. I really can’t understand what’s the problem.
The only problem I can see from the “standard info box” below is that on “re-scan” it appears that configuration failed, but I don’t know what should I do.
Although ~ is often expanded by most Unix shells to the path set in $HOME, on Android /storage/emulated/0/ isn’t the home directory, so in Syncthing the path needs to be set to /storage/emulated/0/syncthing instead of ~/syncthing.
On Android, for the past several versions, /storage/emulated is a FUSE mount point, so it’s wrapped with special security policies. Unless Android is rooted, Syncthing cannot make changes to the mount point, only directories below it (if granted permission).
Just checked the std lib and it resolves the user home dir on android to “/sdcard”. That seems odd, I am not aware of this being a useful path on recent androids. In any case, definitely try setting the folder path without using tilde.
Edit: Looks like /sdcard is some legacy thing, and symlinked (with intermediate redirections) to /storage/emulated/0. Our filesystem notification library resolves symlinks on setup, and I presume some of the checks it does during that involves filesystem calls that android prohibits. Thus the error you see. Probably the android wrapper app should replace tilde with the appropriate path that it can get from android APIs (for multi-user setups the final 0 directory could be a higher number).
I think this is likely more about ~ being resolved to /sdcard than just /sdcard. I’ve always been using /sdcard for my Syncthing paths on multiple Android devices throughout the years, and I’ve never seen this error on any of it.
Thanks for your answer gadget! Interesting, but it’s explicitly said on the web interface of syncthing android that ~ equals /storage/emulated/0. Anyway, I did as you said and specified /storage/emulated/0/syncthing as a path, an got the exact same problem as before.
That’s good, just keep in mind that it’ll depend on the particular phone, so ~ won’t always be an alias for /storage/emulated/0.
That’s most often caused by not enough permission when the path was initially selected. You’ll need to either dig into the app settings for Syncthing and manually grant permission, or remove the Syncthing folder and re-add it, being sure to allow Syncthing access.
Sometimes the file picker in a custom version of Android (e.g. Samsung) or the way notifications are presented causes the prompt for permissions to be missed. A more reliable way to ensure that the prompt isn’t missed is to add the Syncthing folder via the web UI instead of via the mobile app wrapper UI.
Personally, I prefer to use Material Files as my default file manager instead of whatever was bundled with the OEM Android.
In the app permissions I only see camera, notifications and position. Camera is the only one allowed (don’t know why though).
I see no permission related to files unfortunately.
I have android 14 custom (crdroid10), so more close to android stock than MIUI/HyperOS for example.
To edit the folder path, I had to remove it, and I re-added it with your path. I did all of this from the web UI. I’m starting to consider this warning to be a bug, since it still synchronizes files.
My stock file picker is stock file manager (very similar to Material Files since it is based on AOSP14), but usually I use File Manager +.
Camera permission is to scan QR codes to add a new device. In principle should only be asked once you use that functionality.
Seems like that permission moved - isn’t visible from the app info/permission page anymore (which is weird, but well). You need to go through system settings Apps > Special app access > All files access, and there syncthing should be listed as allowed.
Does syncing occur as frequently as if file watching is working or is it per the rescan interval? If it’s the former, then the warning does sounds like it might be some kind of compatibility issue with crDroid.
It occurs as frequently as the file watching is working, I tried before. I really have 0 clue of what could be the source of that warning, I think we’ll never know.
Thank you bro for your time though, we tried.