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

Re: How to initialize cn=schema,cn=config with the system schema

On Wed, Jul 09, 2008 at 07:50:04PM -0400, Mathias Gug wrote:
> On Tue, Jul 08, 2008 at 09:01:19PM -0700, Howard Chu wrote:
> > Mathias Gug wrote:
> I've attache the three ldif files that I'm using to create a new
> configuration. Here are the steps that I'm following to initialize a new
> setup:
> # mkdir /etc/ldap/slapd.d/
> # slapadd -F /etc/ldap/slapd.d/ -n 0 -l slapd.d.init.ldif
> # slapadd -F /etc/ldap/slapd.d/ -n 0 -l slapd.d.load_hdb_module.ldif
> # slapadd -F /etc/ldap/slapd.d/ -n 0 -l slapd.d.new-db.ldif
> slapadd: could not add entry dn="olcDatabase=hdb,cn=config" (line=1):
> autocreation of "olcDatabase={-1}frontend" failed

After some more debugging, I've hit a problem with creating a database
entry with slapadd when defining a new database is not done at the same
time as creating the initial slapd.d structure.

I've attached two files, init.ldif and database.ldif that I'm using.

The two following tests have different outcomes:

 * First initialize the directory, then create a new database.

$ cat init.ldif | slapadd -F ./d/ -b "cn=config"
$ cat database.ldif | slapadd -F ./d/ -b "cn=config"
slapadd: could not add entry dn="olcDatabase=hdb,cn=config" (line=1): autocreation of "olcDatabase={-1}frontend" failed

 * Initialize the directory *and* create the new database in one run:
$ cat init.ldif database.ldif | slapadd -F ./d/ -b "cn=config"

Although the last command seemed successful, loading a set of entries
fails even in the later case:

$ cat tree.ldif 
dn: dc=my-domain,dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
o: Mydomain
dc: my-domain

dn: cn=admin, dc=my-domain, dc=com
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: admin
description: LDAP administrator
userPassword: secret

$ slapadd -F ./d/ -b "dc=my-domain,dc=com" -l tree.ldif 
slapadd: bad configuration directory!

Mathias Gug
Ubuntu Developer  http://www.ubuntu.com
dn: cn=config
objectClass: olcGlobal
cn: config
olcArgsFile: /var/run/slapd.args
olcPidFile: /var/run/slapd.pid

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

dn: cn=schema,cn=config
objectClass: olcSchemaConfig
cn: schema

include:		file:///etc/ldap/schema/core.ldif

# Frontend settings
dn: olcDatabase=frontend,cn=config
objectClass: olcDatabaseConfig
olcDatabase: frontend

dn: olcDatabase=hdb,cn=config
objectClass: olcDatabaseConfig
objectClass: olcHdbConfig
olcDatabase: hdb
olcSuffix: dc=my-domain,dc=com
olcRootDN: cn=Manager,dc=my-domain,dc=com
olcRootPW: secret
olcDbDirectory:	db/
olcDbIndex: objectClass	eq