5

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?

  • P.S. I'm guessing that the behaviour I'm observing happens by default on Ubuntu, but I don't know that's true - I've only tested on my own machine. If I'm wrong, then this will end up being a Hail-Mary question that is only answerable if somebody can guess what odd thing I might've done or installed that would cause the max_user_watches value to reset to 8192 on reboot. My apologies if that is the case! – Mark Amery Jan 3 '16 at 18:08
7

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

4

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.

  • Like a man! I think it's the best way. – contributorpw Jul 5 '19 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.