[openldap] nss_ldap failed to bind to LDAP (solved)

Hi,

While booting the system, /var/log/messages shows folling error :

...
avahi-daemon[4731]: nss_ldap: failed to bind to LDAP server ldap://127.0.0.1: Can't contact LDAP server
...
dbus-daemon: nss_ldap: failed to bind to LDAP server ldap://127.0.0.1: Can't contact LDAP server
...
systemd[1]: Failed to register match for Disconnected message: Connection timed out
...

It seems that local openldap service do not start.

I do not use ldap but some packges require it.

In the current situation, it’s not possible to logon into the system.

How can I fix it?

Thanks

Are you using systemd? nss_ldap error should not affect the ability to login.

The system is using systemd. Many services cannot start.

Sep  1 09:24:38 lt001 systemd[1]: Failed to register match for Disconnected message: Connection timed out
...
Sep  1 09:25:28 lt001 systemd-logind[4750]: Failed to add match for NameOwnerChanged: Connection timed out
Sep  1 09:25:28 lt001 systemd-logind[4750]: Failed to fully start up daemon: Connection timed out
Sep  1 09:25:29 lt001 systemd[1]: systemd-logind.service: main process exited, code=exited, status=1/FAILURE
Sep  1 09:25:29 lt001 systemd[1]: Failed to start Login Service.
Sep  1 09:25:29 lt001 systemd[1]: Unit systemd-logind.service entered failed state.
...
Sep  1 09:27:14 lt001 systemd[1]: Unit bluetooth.service entered failed state.
Sep  1 09:27:14 lt001 systemd[1]: avahi-daemon.service: main process exited, code=killed, status=9/KILL
Sep  1 09:27:14 lt001 systemd[1]: Unit avahi-daemon.service entered failed state.
Sep  1 09:27:14 lt001 systemd[1]: NetworkManager.service: main process exited, code=killed, status=9/KILL
Sep  1 09:27:14 lt001 systemd[1]: Unit NetworkManager.service entered failed state.
Sep  1 09:27:14 lt001 systemd[1]: Looping too fast. Throttling execution a little.
Sep  1 09:27:15 lt001 dbus[4737]: nss_ldap: failed to bind to LDAP server ldap://127.0.0.1: Can't contact LDAP server
...

OpenLDAP is installed on the system but it seems not started by systemd, even if slapd.service is installed.

Running slaptest -v -d 1 -f /etc/openldap/slapd.conf return

54042815 hdb_db_open: database "dc=domain,dc=com": db_open(/var/lib/openldap-data/id2entry.bdb) failed: No such file or directory (2).

After starting ldap manually, slaptest works fine.

/usr/lib/openldap/slapd -f /etc/openldap/slapd.conf -d 255

But I still have the same errors in messages log file. I understand that ldap is not start by systemd as a service.

Finally, I remove ldap from /etc/nsswitch.conf and all works fine.