Bug 213671 - net/openldap24-server: no start at boot
Summary: net/openldap24-server: no start at boot
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Xin LI
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-21 11:49 UTC by IPTRACE
Modified: 2018-04-11 09:42 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description IPTRACE 2016-10-21 11:49:33 UTC
After upgrade from 10.3-RELEASE to 11.0-RELEASE I encountered the problem with starting slpad daemon.

Mounting local filesystems:.
ELF ldconfig path: /lib /usr/lib /usr/lib/compat /usr/local/lib /usr/local/libexec/openldap
32-bit compatibility ldconfig path: /usr/lib32
Starting slapd.
/etc/rc: WARNING: failed to start slapd

The problem was, I think so, in the startup script of openldap-server in /usr/local/etc/rc.d/slapd where below line indicates order of another services have to start before slapd.

WAS: # REQUIRE: FILESYSTEMS ldconfig
CHANGED TO: # REQUIRE: FILESYSTEMS ldconfig netif

Above means that slapd will start after the network service will start.
So when network is not started, slapd will never run.

pkg info
openldap-server-2.4.44         Open source LDAP server implementation

/etc/rc.conf
slapd_enable="YES"
slapd_flags='-h "ldap://10.10.10.10:389/"'
Comment 1 Walter Schwarzenfeld 2018-01-14 03:18:38 UTC
Maintainer feedback?
Comment 2 Mikael Urankar freebsd_committer freebsd_triage 2018-04-10 13:04:09 UTC
same here on 11.1-RELEASE, can we have a fix for this issue?
Comment 3 Xin LI freebsd_committer freebsd_triage 2018-04-10 15:30:59 UTC
I can't reproduce this.  Please provide additional details.
Comment 4 Mikael Urankar freebsd_committer freebsd_triage 2018-04-10 16:02:19 UTC
(In reply to Xin LI from comment #3)
FreeBSD ldap1 11.1-RELEASE-p8 FreeBSD 11.1-RELEASE-p8 #0: Tue Mar 13 17:07:05 UTC 2018     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

pkg info -q
icu-61.1,1
libevent-2.1.8_1
libiconv-1.14_11
libltdl-2.4.6
openldap-client-2.4.46
openldap-server-2.4.46_1
pkg-1.10.5

openldap-server-2.4.46_1 was built with the following options:
ACCESSLOG      : on
DYNAMIC_BACKENDS: on
MDB            : on
MEMBEROF       : on
SYNCPROV       : on

failure at boot:
/etc/rc: DEBUG: checkyesno: slapd_cn_config is set to NO.
/etc/rc: DEBUG: checkyesno: slapd_enable is set to YES.
/etc/rc: DEBUG: run_rc_command: start_precmd: start_precmd 
/etc/rc: DEBUG: checkyesno: slapd_cn_config is set to NO.
/etc/rc: DEBUG: checkyesno: rc_startmsgs is set to YES.
Starting slapd.
/etc/rc: DEBUG: run_rc_command: doit:  limits -C daemon /usr/local/libexec/slapd  -u ldap -g ldap 
/etc/rc: WARNING: failed to start slapd


slapd.conf is unmodified.

It starts correctly if I put NETWORKING in the REQUIRE line of the rc.d script.
Comment 5 Xin LI freebsd_committer freebsd_triage 2018-04-10 16:32:35 UTC
(In reply to mikael.urankar from comment #4)
Ok... Do you by any chance use DHCP for your interface?
Comment 6 Mikael Urankar freebsd_committer freebsd_triage 2018-04-10 16:42:06 UTC
No, it's a static ip:

hostname="ldap1"
ifconfig_vtnet0="192.168.2.20/24"
defaultrouter="192.168.2.1"

ntpd_enable="YES"               # Run ntpd Network Time Protocol (or NO).
ntpd_config="/etc/ntp.conf"     # ntpd(8) configuration file
ntpd_sync_on_start="YES"

slapd_enable="YES"

#rc_debug=yes
Comment 7 Mikael Urankar freebsd_committer freebsd_triage 2018-04-11 08:15:52 UTC
I tried on a second machine, FreeBSD-11.1-Release, package from the quarterly branch 2018Q2, slapd.conf unmodified (I only uncommented moduleload back_mdb), static ip and I still have the error:
more debug info with -d 255:

ldap_url_parse_ext(ldap://localhost/)
ldap_init: trying /usr/local/etc/openldap/ldap.conf
ldap_init: using /usr/local/etc/openldap/ldap.conf
ldap_init: HOME env is /
ldap_init: trying //ldaprc
ldap_init: trying //.ldaprc
ldap_init: trying ldaprc
ldap_init: LDAPCONF env is NULL
ldap_init: LDAPRC env is NULL
5acdbd29 @(#) $OpenLDAP: slapd 2.4.46 (Apr  8 2018 12:20:41) $
        root@111amd64-quarterly-job-03:/wrkdirs/usr/ports/net/openldap24-server/work/openldap-2.4.46/servers/slapd
ldap_pvt_gethostbyname_a: host=, r=-1
5acdbd29 daemon_init: <null>
5acdbd29 daemon_init: listen on ldap:///
5acdbd29 daemon_init: 1 listeners to open...
ldap_url_parse_ext(ldap:///)
5acdbd29 daemon: bind(5) failed errno=49 (Can't assign requested address)
5acdbd29 daemon: bind(5) failed errno=49 (Can't assign requested address)
5acdbd29 slap_open_listener: failed on ldap:///
5acdbd29 slapd stopped.
5acdbd29 connections_destroy: nothing to destroy.
/etc/rc: WARNING: failed to start slapd

The issue is also mentionned on the forum:
https://forums.freebsd.org/threads/openldap-fails-to-start-on-boot.58365/
Comment 8 commit-hook freebsd_committer freebsd_triage 2018-04-11 09:29:56 UTC
A commit references this bug:

Author: delphij
Date: Wed Apr 11 09:29:26 UTC 2018
New revision: 467039
URL: https://svnweb.freebsd.org/changeset/ports/467039

Log:
  Require netif be run before starting slapd.

  PR:		213671
  Submitted by:	arkadiusz.majewski at iptrace.pl

Changes:
  head/net/openldap24-server/Makefile
  head/net/openldap24-server/files/slapd.in
Comment 9 Xin LI freebsd_committer freebsd_triage 2018-04-11 09:30:54 UTC
I've used the reporter's proposed fix and thanks for their submission.

It seems that I haven't hit by this because I always run OpenLDAP inside jails.
Comment 10 Mikael Urankar freebsd_committer freebsd_triage 2018-04-11 09:36:45 UTC
Thanks a lot!
Is it possible to merge the fix to the quaterly branch?
Comment 11 commit-hook freebsd_committer freebsd_triage 2018-04-11 09:42:09 UTC
A commit references this bug:

Author: delphij
Date: Wed Apr 11 09:42:04 UTC 2018
New revision: 467041
URL: https://svnweb.freebsd.org/changeset/ports/467041

Log:
  MFH: r467039

  Require netif be run before starting slapd.

  PR:		213671
  Submitted by:	arkadiusz.majewski at iptrace.pl
  Approved by:	ports-secteam

Changes:
_U  branches/2018Q2/
  branches/2018Q2/net/openldap24-server/Makefile
  branches/2018Q2/net/openldap24-server/files/slapd.in
Comment 12 Xin LI freebsd_committer freebsd_triage 2018-04-11 09:42:41 UTC
(In reply to mikael.urankar from comment #10)
Yes, I think this is serious enough to warrant a merge.  I've done it as 467041.