0

I have setup OpenLdap its starting properly after that due to some issue i kill the process.Now when ever i am trying systemctl start slapd.service i am getting

Job for slapd.service failed because the control process exited with error code. See "systemctl status slapd.service" and "journalctl -xe" for details.

this command journalctl -xe giving below information

Nov 28 21:54:36 suredevbana3 systemd[1]: Starting OpenLDAP Server Daemon...
-- Subject: Unit slapd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit slapd.service has begun starting up.
Nov 28 21:54:36 suredevbana3 runuser[2898]: pam_unix(runuser:session): session opened for user ldap by (uid=0)
Nov 28 21:54:36 suredevbana3 runuser[2898]: pam_unix(runuser:session): session closed for user ldap
Nov 28 21:54:36 suredevbana3 slapcat[2902]: DIGEST-MD5 common mech free
Nov 28 21:54:36 suredevbana3 runuser[2909]: pam_unix(runuser:session): session opened for user ldap by (uid=0)
Nov 28 21:54:36 suredevbana3 runuser[2909]: pam_unix(runuser:session): session closed for user ldap
Nov 28 21:54:36 suredevbana3 runuser[2911]: pam_unix(runuser:session): session opened for user ldap by (uid=0)
Nov 28 21:54:36 suredevbana3 runuser[2911]: pam_unix(runuser:session): session closed for user ldap
Nov 28 21:54:36 suredevbana3 runuser[2913]: pam_unix(runuser:session): session opened for user ldap by (uid=0)
Nov 28 21:54:36 suredevbana3 runuser[2913]: pam_unix(runuser:session): session closed for user ldap
Nov 28 21:54:36 suredevbana3 runuser[2915]: pam_unix(runuser:session): session opened for user ldap by (uid=0)
Nov 28 21:54:36 suredevbana3 runuser[2915]: pam_unix(runuser:session): session closed for user ldap
Nov 28 21:54:36 suredevbana3 runuser[2917]: pam_unix(runuser:session): session opened for user ldap by (uid=0)
Nov 28 21:54:36 suredevbana3 runuser[2917]: pam_unix(runuser:session): session closed for user ldap
Nov 28 21:54:36 suredevbana3 check-config.sh[2894]: Read/write permissions for DB file '/var/lib/ldap/__db.001' are required.
Nov 28 21:54:36 suredevbana3 runuser[2919]: pam_unix(runuser:session): session opened for user ldap by (uid=0)
Nov 28 21:54:36 suredevbana3 runuser[2919]: pam_unix(runuser:session): session closed for user ldap
Nov 28 21:54:36 suredevbana3 check-config.sh[2894]: Read/write permissions for DB file '/var/lib/ldap/__db.002' are required.
Nov 28 21:54:36 suredevbana3 runuser[2921]: pam_unix(runuser:session): session opened for user ldap by (uid=0)
Nov 28 21:54:36 suredevbana3 runuser[2921]: pam_unix(runuser:session): session closed for user ldap
Nov 28 21:54:36 suredevbana3 check-config.sh[2894]: Read/write permissions for DB file '/var/lib/ldap/__db.003' are required.
Nov 28 21:54:36 suredevbana3 systemd[1]: slapd.service: control process exited, code=exited status=1
Nov 28 21:54:36 suredevbana3 systemd[1]: Failed to start OpenLDAP Server Daemon
-- Subject: Unit slapd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit slapd.service has failed.
--
-- The result is failed. Nov 28 21:54:36 suredevbana3 systemd[1]: Unit slapd.service entered failed state. Nov 28 21:54:36 suredevbana3 systemd[1]: slapd.service failed. Nov 28 21:54:36 suredevbana3 polkitd[717]: Unregistered Authentication Agent for unix-process:2887:70553439 (system bus name :1.2956, object path /org/freedesktop/PolicyKit1lines 2393-2430/2430 (END)

After this i check this slapd -d 1 which gave me following information l

dap_url_parse_ext(ldap://localhost/)
ldap_init: trying /etc/openldap/ldap.conf
ldap_init: using /etc/openldap/ldap.conf
ldap_init: HOME env is /root
ldap_init: trying /root/ldaprc
ldap_init: trying /root/.ldaprc
ldap_init: LDAPCONF env is NULL
ldap_init: LDAPRC env is NULL
5a1d9112 @(#) $OpenLDAP: slapd 2.4.44 (Jun  6 2017 18:04:02) $
        mockbuild@x86-019.build.eng.bos.redhat.com:/builddir/build/BUILD/openldap-2.4.44/openldap-2.4.44/servers/slapd
ldap_pvt_gethostbyname_a: host=suredevbana3, r=0
5a1d9112 daemon_init: listen on ldap:///
5a1d9112 daemon_init: 1 listeners to open...
ldap_url_parse_ext(ldap:///)
5a1d9112 daemon: bind(7) failed errno=98 (Address already in use)
5a1d9112 daemon: bind(7) failed errno=98 (Address already in use)
5a1d9112 slap_open_listener: failed on ldap:///
5a1d9112 slapd stopped.
5a1d9112 connections_destroy: nothing to destroy.

Please find below

" ============================================================================
" Netrw Directory Listing                                        (netrw v149)
"   /etc/openldap/slapd.d/cn=config
"   Sorted by      name
"   Sort sequence: [\/]$,\<core\%(\.\d\+\)\=\>,\.h$,\.c$,\.cpp$,\~\=\*$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$
"   Quick Help: <F1>:help  -:go up dir  D:delete  R:rename  s:sort-by  x:exec
" ============================================================================
../
./
cn=schema/
cn=schema.ldif
olcDatabase={-1}frontend.ldif
olcDatabase={0}config.ldif
olcDatabase={1}monitor.ldif
olcDatabase={2}hdb.ldif
.swp

One more information its started with this command

slapd -d -1 -F /etc/openldap/slapd.d
6
  • Can you paste your slapd.conf? – Danila Ladner Nov 28 '17 at 17:09
  • @DanilaLadner Added information you required. – Subodh Joshi Nov 28 '17 at 17:15
  • It looks like when you're killing the process it may not be killing properly and the process still has control of the socket as evidenced by the address already in use and cannot open listener. If you're going to kill the service use systemctl stop slapd or systemctl restart slapd to restart it. – Patrick Nov 28 '17 at 21:32
  • @Patrick Thanks for your reply its starting when i am running it through slapd -d -1 -F /etc/openldap/slapd.d but issue with systemctl only. – Subodh Joshi Nov 29 '17 at 5:52
  • @SubodhJoshi Did you try systemctl restart slapd? – Patrick Nov 29 '17 at 14:28
3
check-config.sh[2894]: Read/write permissions for DB file '/var/lib/ldap/__db.003' are required.

slapd runs as ldap user by default, if you attempted to start it (or loaded ldif etc..) as root user, it'd create files with incorrect permission. Try chown -R ldap.ldap /var/lib/ldap to fix the permissions and start the service.

1

I also facing the same problem but I have resolved with below command:

setenforce 0
getenforce

If you want to persist it:

vi /etc/selinux/config

Change this parameter SELINUX=enforcing to SELINUX=permissive

0
  1. Disable your SELINUX.

  2. Install the required certificates specified in the file:

    olcDatabase={2}hdb.ldif
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.