Fixing max open files (1024) is smaller than max sockets (4096) errors

If you are running BIND, you may be seeing errors like this in your logs each time you reload or restart named:

Feb  9 22:22:17 mail named[19053]: max open files (1024) is smaller than max sockets (4096)

This is caused by the default number of files that a process can run being set very low, to 1024. By default, in include/linux/fs.h:

#define INR_OPEN 1024           /* Initial setting for nfile rlimits */

You could edit that line and recompile your kernel, but that would involve doing that every time a new kernel was released. An easier option is to edit /etc/security/limits.conf, and add the line:

named        soft    nofile        4096

This sets the default limit for the named user to 4096. Then, edit your named.conf and add

files 4096;

in the options section. Note that you're have to stop and start the named daemon, and not simply run rndc reload, because it needs to actually exit for the changes to take effect. Now the warning will be gone!

1 comment:

Limited By Imaginations said...

The best way is update your kernel. Kernel 2.6.28 or later had been fixed this issue.