I just installed Ubuntu 16.04 and I get this warning when I start SmartGit:

IOException: User limit of inotify watches reached

Moreover I get this warning launching tail -f:

tail: inotify resources exhausted 

tail: inotify cannot be used, reverting to polling

I never get this error with Ubuntu 14.04 and applications and files I'm using on the new Ubuntu are quite the same I was using in the previous version.

The only relevant differences are that I added an additional Hard Disk on the PC and I configured the Ubuntu's backup tool. Can this problem be related with a second disk or with the backup tool?


The current default on Xenial is 8192 (see fs/notify/inotify/inotify_user.c in the kernel source), you can verify this by printing the file to stdout:

cat /proc/sys/fs/inotify/max_user_watches

You can bump the number up, for example, doubling this to 16384, using:

echo 16384 | sudo tee /proc/sys/fs/inotify/max_user_watches

bear in mind that inotify watches do consume memory, I think it's around 160 bytes per watch on 64 bit systems.

To set this permanently, add an entry to /etc/sysctl.conf, for example:

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

..or manually edit /etc/sysctl.conf (you need root privileges to update it) and then run sudo sysctl -p

  • Yes, thank you. I doubled it and now I do not have warnings anymore. How much memory (at max) will be consumed for 16.384 watches? My calculations give me more or less 2.5MB. Is it right?
    – Andrea
    May 10 '16 at 20:15
  • Something in that order, plus some overhead; it's not too large in the grand scheme of thing.s May 10 '16 at 21:55
  • 1
    here's some more info on possible memory consumption of (used) watches askubuntu.com/questions/154255/…
    – michael
    Dec 2 '17 at 5:23
  • Adding a new file in /etc/sysctl.d/ with content fs.inotify.max_user_watches = 16384 would be the same, right? But in ubuntu 20.04 it doesn't work. However, adding a new line in /etc/sysctl.conf works.
    – fikr4n
    Jun 16 at 10:30

Above answers work great but it does not explain why which I was looking around to here my attempt for a complete answer -


Programs that sync files such as dropbox, git etc use inotify to notice changes to the file system. The limit can be see by -

cat /proc/sys/fs/inotify/max_user_watches

For me, it shows 100000. When this limit is not enough to monitor all files inside a directory it throws this error.

Increasing the amount of inotify watchers(Short version):

If you are running Debian, RedHat, or another similar Linux distribution, run the following in a terminal:

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

If you are running ArchLinux, run the following command instead (see here for why):

echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/40-max-user-watches.conf && sudo sysctl --system

Then paste it in your terminal and press on enter to run it.

Technical details:

Listen uses inotify by default on Linux to monitor directories for changes. It's not uncommon to encounter a system limit on the number of files you can monitor. For example, Ubuntu Lucid's (64bit) inotify limit is set to 8192.

You can get your current inotify file watch limit by executing:

$ cat /proc/sys/fs/inotify/max_user_watches

When this limit is not enough to monitor all files inside a directory, the limit must be increased for Listen to work properly.

You can set a new limit temporary with:

$ sudo sysctl fs.inotify.max_user_watches=524288
$ sudo sysctl -p

If you like to make your limit permanent, use:

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

You may also need to pay attention to the values of max_queued_events and max_user_instances if Listen keeps on complaining.

Source: https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers


You can check the existing Limit and based on that you can alter it as per your requirement

To Check : cat /proc/sys/fs/inotify/max_user_watches To Alter : sudo sysctl fs.inotify.max_user_watches=524288

This will resolve the error.

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.