Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been walking through this tutorial and kept getting errors -- likely because I was typing it in manually -- so I retried, executing it after entering in

# Load dynamic backend modules
dn: cn=module,cn=config
objectClass: olcModuleList
cn: module
olcModulepath: /usr/lib/ldap
olcModuleload: back_hdb

# Database settings
dn: olcDatabase=hdb,cn=config
objectClass: olcDatabaseConfig
objectClass: olcHdbConfig
olcDatabase: {1}hdb
olcSuffix: dc=example,dc=local
olcDbDirectory: /var/lib/ldap

It worked, so I typed in the rest and re-executed:

sudo ldapadd -Y EXTERNAL -H ldapi:/// -f backend.example.com.ldif

and now it says

ldap_add: Other (e.g., implementation specific) error (80)
    additional info: <olcSuffix> namingContext "dc=home,dc=local" already served by a preceding hdb database

Which, as I would guess, means that it can't complete the ldapadd because one already exists under the same name.

I tried deleting it using (from here):

sudo ldapdelete 'dc=example,dc=local'

and it's asking for a password, of which my password doesn't work and there was nothing set as the olcRootPW in the initial setup.

How do I use ldapdelete in this context so I can re-setup this database?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Wasn't able to figure out how to delete the database, but I had just started so I purged slapd and ldap-utils.

sudo apt-get purge slapd ldap-utils

and reinstalled.

share|improve this answer
    
Downvoted because although uninstalling and then reinstalling may work, it is rarely the correct answer. What Ignmar said below is much better advice. –  Kevin S Mar 13 at 18:05

Generally the initial setup process for cn=config isn't very easy and there are plenty of ways to shoot yourself in the foot in the process. However, remember that cn=config is stored in LDIF format files in slapd.d (usually in ${prefix}/etc/openldap/) and can be edited by hand (carefully and while slapd isn't running). So if you've locked yourself out (no RootDN/RootPW) or completely mangled your cn=config somehow, you can always fix it there.

A good way to get a basic config going is to actually do it in the old style slapd.conf fashion and then convert it to slapd.d (using slaptest -f -F) once the basic stuff (databases, modules and a RootDN/RootPW) is sorted.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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