[Solved]Problem to Update OpenLDAP in FreeBSD

Recently, I found the following error message when updating my FreeBSD system regarding to the OpenLDAP:

===>  Installing for openldap-client-2.4.31
===>   Generating temporary packing list
===>  Checking if net/openldap24-client already installed
===> Creating users and/or groups.
Using existing group `ldap'.
Creating user `ldap' with uid `389'.
pw: user 'ldap' already exists
*** Error code 74

Stop in /usr/ports/net/openldap24-client.
*** Error code 1

Stop in /usr/ports/net/openldap24-client.

And I don’t use LDAP in particular, however it affects other applications that use LDAP, e.g., PHP

php -v
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/ldap.so' - Shared object "libldap-2.4.so.8" not found, required by "ldap.so" in Unknown on line 0
PHP 5.3.10 with Suhosin-Patch (cli) (built: Feb 14 2012 16:59:15)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator

It is very simple to solve this problem. All you need is to remove the user ‘ldap’, and install the port again. First, let’s remove the user ‘ldap’ first:

sudo vipw

You will see this line:

ldap:*:389:389::0:0:OpenLDAP Server:/nonexistent:/usr/sbin/nologin

Remove the line by pressing ‘dd’, hit ‘ESC’ button, and then press ‘:wq’ to save the file and quit the editor.

After that, let’s clean the port and run the update again:

cd /usr/ports/net/openldap24-client
sudo make clean
sudo make install clean

That’s it. Your LDAP will be happy and your applications (such as PHP) will not complain.

Our sponsors:


–Derrick