FreeBSD, OpenLDAP and the boot process (II)
As one of the things that scares me the most, the FreeBSD, OpenLDAP and the boot process thing is back!
This time, I had to reboot that faulty server because of a kernel panic caused by a usb-connected external hd. I just noticed some noise in /var/log/messages:
Oct 31 17:06:37 PXGOServer kernel: g_vfs_done():da1s1d[WRITE(offset=6144000, length=14336)]error = 6 Oct 31 17:06:47 PXGOServer kernel: g_vfs_done():da1s1e[WRITE(offset=6144000, length=8192)]error = 6 Oct 31 17:09:33 PXGOServer kernel: g_vfs_done():da1s1e[READ(offset=114688, length=16384)]error = 6 Oct 31 17:09:33 PXGOServer kernel: g_vfs_done():da1s1d [READ(offset=114688, length=16384)]error = 6 Oct 31 17:09:38 PXGOServer kernel: g_vfs_done():da1s1d[READ(offset=114688, length=16384)]error = 6
and BAM, a panic there.
Of course, rebooting the server took too much time (as always), so I decided to take another deep look into the problem (as I've done before).
But this time, I'll try to solve the problem from another point of view. Let's try to force slapd to be booted early in the boot process.
Just two links to understand it better:
(If you are used to manage FreeBSD servers, you probably know them already).
After some research (20-30 minutes), I found a quick solution, I just had to modify /usr/local/etc/rc.d/slapd to change two lines:
# REQUIRE: NETWORKING SERVERS # BEFORE: securelevel
# REQUIRE: NETWORKING # BEFORE: SERVERS securelevel
What does this mean?
It's pretty easy to understand. The first two lines set that slapd needed every rc script in the NETWORKING (aka, setting up network interfaces, routing tables, etc) and SERVERS (aka named, mountd, sendmail, etc) groups to be running before trying to start it, while slapd itself should be started before the securelevel rc script.
After my change, slapd only needs rc scripts in the NETWORKING group to be already started and it will be started before any other server rc script.
A quick reboot and I noticed that slapd was started before every other service (including named, sendmail, mountd, sshd, apache, zope, postgresql and some other ones).
Everything was fine, but there is still a delay, cause while starting slapd itself, the system still tries to connect to the OpenLDAP database in order to find the user resposible for running the slapd process... (WTF!, that's the process you are trying to start!).