BIND: Max open files (1024) is smaller than max sockets (4096) Error and Solution

While going though my logs I found that BIND9 on Debian version 5.x is giving a warning which read as follows:

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

How do I fix this problem?

The “open files is smaller than max sockets” problem is kernel bug which is already fixed in 2.6.28. Linux kernel returns EPERM when RLIMIT_NOFILE is set to RLIM_INFINITY. To fix this issue update your Linux kernel using yum or apt-get command.
# yum update
OR
# apt-get update
# apt-get upgrade

Reboot the server. Verify error is not reported after boot:
# tail -f /var/log/messages

See kernel bug # 461458 and 515673 for more information.

🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
9 comments… add one
  • Bram May 1, 2009 @ 10:47

    Soultion? ;-)

  • avarkin May 19, 2009 @ 12:34

    how to fix on debian lenny 5.0 ( 2.6.26-2-686):

    # vim /etc/default/bind9

    add “-S 1024” to “OPTIONS” line:

    # run resolvconf?
    RESOLVCONF=yes
    
    # startup options for the server
    OPTIONS="-u bind -S 1024"
    

    restart bind:
    # /etc/init.d/bind9 restart

    check for errors:
    # cat /var/log/syslog

  • avarkin May 19, 2009 @ 12:39

    ooops :)

    # vim /etc/default/bind9

    add “-S 1024″ to “OPTIONS” line:

    # run resolvconf?
    RESOLVCONF=yes

    # startup options for the server
    OPTIONS="-u bind -S 1024"

  • indexofire Jun 3, 2009 @ 1:00

    how to fix the error in freebsd?

  • xone Jun 16, 2009 @ 12:32

    sysctl kern.maxfilesperproc=4096

  • Chris Dec 3, 2009 @ 9:37

    There’s another way of fixing it on Linux:

    At the beginning of the “start” section of /etc/init.d/bind9 add i.e.:

    ulimit -HSn 8192

    so you have some extra, spare file descriptors for the whole process,
    and then restart the bind using:

    # /etc/init.d/bind9 restart

    and voila, log reads:

    […]
    named[19060]: using up to 4096 sockets
    […]

  • JN Jan 5, 2010 @ 15:25

    The preceding “ulimit -HSn 8192” command might better go in /etc/default/bind9 on debian to keep package updates (ie. changed config files) a little smoother.

  • ben May 10, 2011 @ 9:36

    If you are using Centos or redhat, edit /etc/sysconfig/named and at the bottom, at,

    OPTIONS=”-4 -S 1024″

    It think the author’s claim of upgrading the kernel it’s false and can be dangers. I got a vmware application runnning on the host, upgrading the kernel can simply break it

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.