落雨宸的时光机
415 字
2 分钟
Android Syncthing-Fork 显示 Filesystem Watcher Errors: lstat 的解决方案
2026-02-24
...

1. 前言#

有的定制系统不知道下了什么料,运行 Syncthing-Fork 的时候会有报错:

Filesystem Watcher Errors

For the following folders an error occurred while starting to watch for changes. It will be retried every minute, so the errors might go away soon. If they persist, try to fix the underlying issue and ask for help if you can't. 

lstat /storage/emulated: no such file or directory
lstat /storage/emulated: no such file or directory

2. 解决方案#

2.1. 可能性一:文件系统隔离,SAF 发癫#

我在手机上安装 Dhizuku 并激活后,不知道触发了什么机制,导致手机的文件系统被隔离了,SAF 文件选择器也看不到根目录。在这个情况下,Syncthing-Fork 也大概率是被隔离了,所以才会报错 lstat /storage/emulated: no such file or directory

解决方案:

sm set-force-adoptable on

具体干啥的我也不清楚,但是它可以重置 SAF,恢复文件选择器里空白的根目录。总之我是执行这个以后就好了。

2.2. 可能性二:找不出问题。#

如果上面的方法不行,可以试着关掉 Syncthing 里面的“监视文件更改”,改用外部软件来监视更改并通知 Syncthing 重新扫描。

给出 Termux 脚本 st-watch.sh

#!/data/data/com.termux/files/usr/bin/sh

termux-notification --id 819361 --title "Syncthing Watcher" --content "Watcher started: $(date --rfc-3339=seconds)"
# (sleep 300; termux-notification-remove 819361) &

last_time=0
inotifywait -m -r -e modify,create,delete,move /storage/emulated/0/<YOUR_PATH_1> /storage/emulated/0/syncthing/<YOUR_PATH_2> | while read path action file; do
    current_time=$(date +%s)
    if [ $((current_time - last_time)) -ge 5 ]; then
        curl -k -s -X POST -H "X-API-Key: <YOUR_API_KEY>" "https://127.0.0.1:8384/rest/db/scan" -i
        last_time=$current_time
    fi
done

请自行替换 <YOUR_API_KEY><YOUR_PATH>

该脚本通过 inotifywait 监视多个路径的修改事件,并在更改发生时通过 API 通知 Syncthing 重新扫描。进行了判断:小于 5 秒内发生两次修改,只会通知一次。

Android Syncthing-Fork 显示 Filesystem Watcher Errors: lstat 的解决方案
https://blog.lzc256.com/posts/syncthing-android-fs-watcher-error-workaround/
作者
落雨宸
发布于
2026-02-24
许可协议
CC BY-NC-SA 4.0


Loading Comment Component...