iNotify Error does not resolve

TIA!

Receive the “failed to set up inotify handler. Please increase inotify limits, see FAQ — Syncthing documentation

This is version 2.0.3. I have followed the link and done that task. I have 3 shared folders – only indicates 1 of the folders, and its is the largest one (about 320k items).

I followed another suggestion to increase the number even more (I think it was 409600) and that still did not work.

I can not find any suggestions that are not 7-8 years old.

System is a Debian 13 vm with 2 cores and 2GB RAM. Ive looked at the resources being used, and its only using about 40-50% of the RAM. I know iNotify is memory sensitive, but I dont feel like an increase is the answer (?).

Hopefully this topic creates a solution that is more up to date for folks to research.

The number of watchers needs to be set higher than the total number of files+directories you want Syncthing to watch.

That completely makes sense. Ill report back.

I increased my RAM to 6GB and changed the number of watchers to 614400.

Still get the error.

I suspect you may still need to raise it further… Would be worth raising it much higher, seeing if that clears the issue, then back it off until you’re seeing an appropriate balance of watchers and RAM usage.

Is rule of thumb 102400 per 1GB RAM?

Same results all. For record:

Command - sudo echo “fs.inotify.max_user_watches=2048000” | sudo tee -a /etc/sysctl.conf (rebooting after running the command)

Ram Usage (4GB):

On the right track – approximately 1GB of RAM per 1 million watches.

inotify’s queue requires 1,080 bytes per slot, so 10 files being watched consumes 10,800 bytes. The queue cannot be swapped to disk (virtual memory), so it needs to fit into system RAM. The queue only consumes as much RAM as there are items being watched, so it’s generally fine to overestimate.

The first sudo in the command above isn’t necessary and could cause unintended results the way the command is written. What’s the output from the following command?

grep inotify /etc/sysctl.conf

Although tee is commonly used because it makes for easy to copy-and-paste commands with less risk of nuking an important file, when editing system files, in my opinion, actually seeing the contents of what’s being edited is way more beneficial. To open a file as root for editing:

sudo -e /etc/sysctl.conf

Having said that, like many Linux distros, Debian supports local configs under /etc/sysctl.d, so adding your settings there keeps things neater and protects from potentially being overwritten by future system updates – e.g.:

echo fs.inotify.max_user_watches=2048000 | sudo tee -a /etc/sysctl.d/99-local.conf
  • Double-quotes around fs.inotify.max_user_watches=2048000 aren’t required because there are no spaces and/or other characters reserved by the command shell.
  • The destination filename can be almost anything that ends in .conf.
  • Files under /etc/sysctl.d are loaded in alphabetical order, so it’s common to prefix with a number for flexibility in controlling the processing. A 99 prefix just helps increase the odds that your setting overrides any that came before it.

Either way, after making a change and rebooting, always verify that it actually took effect:

cat /proc/sys/fs/inotify/max_user_watches

Note that max_user_watches is the combined limit for all processes under a single UID, so Syncthing watching 320K files alongside systemd, etc., etc. all take a slice of the digital pie.

5 Likes

Sudo was definitely an issue.

And the “grep inotify /etc/sysctl.conf” unveiled multiple lines of inotify changes instead of 1 line. So it was probably taking the first line, which was the original command.

It seems to be functioning as it should at this time with a command set at 2048000.

Thank you again for the assist.

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