Linux – Failed to bind to server ldap:// Error: Can’t contact LDAP server

authenticationbindldaplinuxslapd

We are running a Linux 2.6.32-431.3.1.el6.x86_64 kernel and keep seeing the following messages in /var/log/messages periodically showing up on our user space server. When the messages appear we also have users stating that they are unable to access network drive space.

Feb 6 20:10:40 <server_name> smbd[15502]:   failed to bind to server ldap://<server-ip> with dn="cn=user,dc=some_domain,dc=some_domain,dc=some-domain" Error: Can't contact LDAP server
Feb 6 20:10:40 <server_name> smbd[15502]:   #011(unknown)
Feb 6 20:10:41 <server_name> smbd[15503]: [2013/11/05 20:10:41.146650,  0] lib/smbldap.c:1225(smbldap_connect_system)
Feb 6 20:10:41 <server_name> smbd[15503]:   failed to bind to server ldap://<server-ip> with dn="cn=user,dc=some_domain,dc=some_domain,dc=some-domain" Error: Can't contact LDAP server
Feb 6 20:10:41 <server_name> smbd[15503]:   #011(unknown)
Feb 6 20:10:42 <server_name> smbd[1655]: [2013/11/05 20:10:42.868838,  0] lib/smbldap.c:1225(smbldap_connect_system)
Feb 6 20:10:42 <server_name> smbd[1655]:   failed to bind to server ldap://<server-ip> with dn="cn=user,dc=some_domain,dc=some_domain,dc=some-domain" Error: Can't contact LDAP server
Feb 6 20:10:42 <server_name> smbd[1655]:   #011(unknown)
Feb 6 20:10:48 <server_name> smbd[15504]: [2013/11/05 20:10:48.531242,  0] lib/smbldap.c:1225(smbldap_connect_system)
Feb 6 20:10:48 <server_name> smbd[15504]:   failed to bind to server ldap://<server-ip> with dn="cn=user,dc=some_domain,dc=some_domain,dc=some-domain" Error: Can't contact LDAP server
Feb 6 20:10:48 <server_name> smbd[15504]:   #011(unknown)

While our ldap server shows the following:

Feb  6 10:29:03 <server_name> nslcd[1491]: [918931] ldap_result() failed: Can't contact LDAP server
Feb  6 10:29:03 <server_name> nslcd[1491]: [918931] failed to bind to LDAP server ldap://<server-ip>/: Can't contact LDAP server: Transport endpoint is not connected
Feb  6 10:29:03 <server_name> nslcd[1491]: [918931] no available LDAP server found, sleeping 1 seconds
Feb  6 10:29:04 <server_name> nslcd[1491]: [873f47] failed to bind to LDAP server ldap://<server-ip>/: Can't contact LDAP server: Transport endpoint is not connected

Linux users are unable to authenticate, but windows users can.

We noticed that just before these errors appear we get another kind of error stating:

Feb 6 11:24:30 <server-name> slapd[1796]: warning: cannot open /etc/hosts.allow: Too many open files
Feb 6 11:24:30 <server-name> slapd[1796]: warning: cannot open /etc/hosts.deny: Too many open files

To resolve this issue, at least for now, we can run the following command on our server that is running ldap:

service slapd restart

Any ideas as a cause and permanent solution would be most grateful. What should we look for in regards to the cause of these error and what can we do to resolve these issue's? Any suggestions would be appreciated.

Best Answer

It looks like you're reaching one of the security limits on how many files can be open. Try this:

  1. First check and see how many file you've got oppened compared to your limit.

    sysctl fs.file-nr
    
  2. Change your open file limits to meet your needs and leave yourself a buffer.

    echo "fs.file-max = ########" >> /etc/sysctl.conf
    
  3. Apply the change.

    sysctl -p