[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: problem importing cn=config





Howard Chu wrote:
Greg Martin wrote:
Now I want to convert to cn=config.  I ran:

    slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d
to build the config, then ran:

    slapadd -d -1 -F /etc/openldap/slapd.d -n 0 -l cn=config.ldif
to import it

I get this error:
: config_add_internal: DN="cn=config" already exists
slapadd: could not add entry dn="cn=config" (line=1):
slapadd shutdown: initiated

I tried -c to ignore errors, but this must be serious.

Not much when I ask Google, but I saw a post from Howard months back
that suggested there was a bug surrounding this process and that it was
fixed in the 2.3.x HEAD.

Seems to me that anything you found is completely unrelated to this.
I didn't think it was, but wanted you to know I had looked for an answer before posting.


Other than that - no other help.

Is there a way to force overwrite?

Overwrite? Why would you want to overwrite what you just created?
I don't, but I do want to understand what's happening. The slapd-config manpage and the admin guide tell me what to do but not why, so I'm trying to figure that out.

Once you've converted the config it's ready to run, you don't slapadd it again. You're trying to slapadd the database onto itself, which obviously makes it complain... There's no import needed.
I read this in man slapd-config:
"Assuming the above data was saved in a file named "config.ldif" and the
/etc/openldap/slapd.d directory has been created, this command will
initialize the configuration:
slapadd -F /etc/openldap/slapd.d -n 0 -l config.ldif"
and:


"Alternatively, an existing slapd.conf file can be converted to the new
format using slapd or any of the slap tools:
slaptest -f /etc/openldap/slapd.conf -F ETCDIR/slapd.d"




From reading that it looks as if this is a two-step process. 1) to convert slapd.conf to ./slapd.d, and the second to "initialize" it. Since slapadd is used to add things to the database, I figured it was being imported into the database. Is the slappadd not necessary?

\\Greg