When running journalctl -f
the error "``Insufficient watch descriptors available`"
is reported, since the amount of file watches is surpassing the amount of resources allocated for it.
This can happen when running containers like LXC or Docker.
The kernel can run out of resources that way.
To fix this some kernel values need to be increased.
To report the current inotify values run the next command.
for fn in /proc/sys/fs/inotify/* ; do echo "${fn} $(cat "${fn}")"; done
These are the typical values are:
/proc/sys/fs/inotify/max_queued_events 16384
/proc/sys/fs/inotify/max_user_instances 128
/proc/sys/fs/inotify/max_user_watches 8192
Find processes using inotify.
find /proc/*/fd -lname anon_inode:inotify | cut -d/ -f3 | xargs -I '{}' -- ps --no-headers -o '%p %U %c' -p '{}' | uniq -c | sort -nr
To increase or change the values temporarily.
sysctl fs.inotify.max_queued_events = 18000
sysctl fs.inotify.max_user_instances=256
sysctl fs.inotify.max_user_watches=524288
Create or edit /etc/sysctl.d/95-inotify.conf
with the following content.
# Added to prevent warning 'Insufficient watch descriptors available'.
fs.inotify.max_queued_events = 16384
fs.inotify.max_user_instances = 256
fs.inotify.max_user_watches = 524288
To make them immediate effective run the sysctl
command.
sysctl --load="/etc/sysctl.d/95-inotify.conf"