3

I'm trying to put a config of slapd on the new server. I did it the same way, but it was probably two years ago and in slightly different environnement (I'm on the Debian actually and it was on CentOS before).

I have a config file in ldif format and I try to do :

slapadd -n 0 -F /etc/ldap/slapd.d -l /root/server_slapd_config.ldif

And I get

5c75466b <= str2entry: str2ad(olcDbCacheSize): attribute type undefined

slapadd: could not parse entry (line=2087)

The strange thing that I could not figure out why I get this error, as olcDbCacheSize is defined in my server_slapd_config.ldif

Here the lines in my server_slapd_config.ldif :

1)

olcObjectClasses: ( OLcfgDbOc:1.1 NAME 'olcBdbConfig' DESC 'BDB backend conf
 iguration' SUP olcDatabaseConfig STRUCTURAL MUST olcDbDirectory MAY ( olcDb
 CacheSize $ olcDbCheckpoint $ olcDbConfig $ olcDbCryptFile $ olcDbCryptKey 
 $ olcDbNoSync $ olcDbDirtyRead $ olcDbIDLcacheSize $ olcDbIndex $ olcDbLine
 arIndex $ olcDbLockDetect $ olcDbMode $ olcDbSearchStack $ olcDbShmKey $ ol
 cDbCacheFree $ olcDbDNcacheSize $ olcDbPageSize ) )

2)

olcAttributeTypes: ( OLcfgDbAt:1.1 NAME 'olcDbCacheSize' DESC 'Entry cache s
 ize in entries' SYNTAX OMsInteger SINGLE-VALUE )

3)

dn: olcDatabase={1}bdb,cn=config
objectClass: olcDatabaseConfig
objectClass: olcBdbConfig
olcDatabase: {1}bdb
[skip]
olcDbCacheSize: 1000

So, DbCacheSize declared in olcBdbConfig attributes.

There is olcAttributeTypes for DbCacheSize

And dn: olcDatabase={1}bdb,cn=config is "objectClass: olcBdbConfig"

Why I get "attribute type undefined"?

Some additional info.

System : Debian 9 (Stretch)

# dpkg -l | grep -i ldap
ii  ldap-utils                    2.4.44+dfsg-5+deb9u2           amd64        OpenLDAP utilities
ii  ldapscripts                   2.0.7-2                        all          Add and remove users and groups (stored in a LDAP directory)
ii  libldap-2.4-2:amd64           2.4.44+dfsg-5+deb9u2           amd64        OpenLDAP libraries
ii  libldap-common                2.4.44+dfsg-5+deb9u2           all          OpenLDAP common files for libraries
ii  slapd                         2.4.44+dfsg-5+deb9u2           amd64        OpenLDAP server (slapd)

Thanks for your help.

Update:

A small update. Just to check. If I remove olcDbCacheSize string, I get the error for the next line : olcDbCheckpoint

5c7553fc <= str2entry: str2ad(olcDbCheckpoint): attribute type undefined

Update 1:

Here the lines started with olcDb*. All the lines are in dn: olcDatabase={1}bdb,cn=config section. I skipped some lines in the middle (they are not started with olcDb).

dn: olcDatabase={1}bdb,cn=config
objectClass: olcDatabaseConfig
objectClass: olcBdbConfig
olcDatabase: {1}bdb
[skip]
olcDbDirectory: /var/lib/slapd 
olcDbCacheSize: 1000
olcDbCheckpoint: 512 15
olcDbConfig: {0}# This configuration file sets BerkeleyDB options when using
olcDbConfig: {1}# backend, for the database held in the directory where this
olcDbConfig: {2}#
olcDbConfig: {3}# Set directory to use for transaction logs:
olcDbConfig: {4}#set_lg_dir /var/lib/ldap/logs
olcDbConfig: {5}# Set in-memory transaction log cache (2MB)
olcDbConfig: {6}set_lg_bsize 2097152
olcDbConfig: {7}# Set max transaction log file size, must be >=4* lg_bsize 
olcDbConfig: {8}#set_lg_max              10485760
olcDbConfig: {9}set_lg_max              20971520
olcDbConfig: {10}# Set in-memory database cache
olcDbConfig: {11}#set_cachesize   0       1048576        0
olcDbConfig: {12}
olcDbConfig: {13}
olcDbConfig: {14}# For batch imports, disabling transaction logging totally 
olcDbConfig: {15}# improve performance:
olcDbConfig: {16}# set_flags DB_TXN_NOT_DURABLE
olcDbConfig: {17}
olcDbConfig: {18}
olcDbNoSync: FALSE
olcDbDirtyRead: FALSE
olcDbIDLcacheSize: 0
olcDbIndex: objectClass eq
olcDbIndex: entryUUID eq
olcDbIndex: entryCSN eq
olcDbIndex: cn eq,subinitial
olcDbIndex: uid eq,subinitial
olcDbIndex: uidNumber eq
olcDbIndex: gidNumber eq
olcDbIndex: sn eq,subinitial
olcDbIndex: givenName eq,subinitial
olcDbIndex: member eq
olcDbIndex: mail eq,subinitial
olcDbIndex: FinLogin eq,approx,sub
olcDbIndex: uniqueMember eq
olcDbIndex: memberUid eq
olcDbLinearIndex: FALSE
olcDbMode: 0600
olcDbSearchStack: 16
olcDbShmKey: 0
olcDbCacheFree: 1
olcDbDNcacheSize: 0
Paul Zakharov
  • 141
  • 1
  • 5
  • Those are related to BDB and HDB Database Directives. Can you show your configuration file? that is ```/root/server_slapd_config.ldif``` I am specifically interested in all values that starts with: ```olcDb*``` – Dmitriy Kupch Feb 26 '19 at 15:22
  • Thank you for reply. I put "Update 1" in the question. – Paul Zakharov Feb 26 '19 at 15:44
  • I usually never edit manually those configs the way you purpose. I would suggest to clean up the config completely and then build everything from the slapd.conf file as an example. You eiter not importing some of the schemas or not referencing database properly in the config. Check for the configuration I referenced in one of my previous answer, specifically look for moduleload, include(schema) and the way I remove config folder and recreate automatically based on slapd.conf https://serverfault.com/questions/941612/nslcd-with-domain-com-and-sub-domain-com/947647#947647 – Dmitriy Kupch Feb 26 '19 at 20:58
  • I agreed with you in theory. Your approach is certainly the right one. But for my case it means also a lot of work. But, you give me some idea and it seems that it's work. I'm not sure for 100%, but it seems that in moduleload section (dn: cn=module{0},cn=config, objectClass: olcModuleList...) there was not back_bdb.la module. I add it and it starts to work. Now I have the new problems... may be finally I will follow your advice to recreate slapd.conf... or I will post the new question. :-) In any case, thank you very much for help. – Paul Zakharov Feb 27 '19 at 09:43
  • Zkharov, could you possibly hit a thumbs up button on the post I mentioned above in case it was helpful to you? – Dmitriy Kupch Feb 27 '19 at 14:15

1 Answers1

0

Some schema descriptions are hard-coded in backend modules or overlays.

That's e.g. the case for attribute type olcDbCacheSize being defined in servers/slapd/back-bdb/config.c and your local schema definition has no effect.

I suspect that the back-bdb backend is not loaded and therefore those schema definitions are not available in your slapd instance.