8

Some software that I'm using needs a higher-than-default value in /proc/sys/fs/inotify/max_user_watches. I can modify this value with a text editor or from the terminal, and for a little while, everything is fine. However, after restarting my computer (not just logging out and in again, which works fine), the value has reset to 8192.

Why does this happen, and how can I make the change permanent?

2 Answers2

13

From: /usr/lib/sysctl.d/50-default.conf:

To override settings in this file, create a local file in /etc (e.g. /etc/sysctl.d/90-override.conf), and put any assignments there.

So create the file: nano /etc/sysctl.d/90-override.conf.
And populate it with: fs.inotify.max_user_watches=65536.

This will now be used when you restart your server to populate: /proc/sys/fs/inotify/max_user_watches

There is no need therefore to edit /proc/sys/fs/inotify/max_user_watches. Once you've followed the above you can restart your server for the new setting to take affect.

nick
  • 231
9

On Ubuntu 16.04 the following worked for me...

echo "fs.inotify.max_user_watches=524288" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

where 524288 is the higher-than-default number that I'm using. The second command is to make it take effect without rebooting.

Also, here is a link to a similar question with some good answers, in particular see the second answer from user3086182 which helped me.

kernel-inotify-watch-limit-reached