• Contact Us
  • Home
  • Maintenance

Troubleshooting slapadd

Learn how to troubleshoot common issues with the slapadd command, ensuring smooth data imports in LDAP servers.

Written by Greg Noe

Updated at September 13th, 2024

  • Quick Start
  • Installation
    Best Practices Configuration Troubleshooting Design Performance Platform
  • Maintenance
    Releases Upgrade
  • Reference
+ More

Table of Contents

Resuming slapadd Error: slapadd: could not add entry dn="cn=config" (line=1) Error: str2entry: entry -1 has no dn slapadd: could not parse entry (line=N) Error: slapadd: line [N]: cannot add entry with empty dn="" Error: slapadd: line [N]: database #1 ([suffix]) not configured to hold "[DN]"; no database configured for that naming context

Resuming slapadd

After correcting an issue with an entry in the input ldif, you can resume slapadd at the point in the ldif where the correction was made using the -j <line-number> argument. The line at the line number must start with dn:.  

Without this argument slapadd will fail because it tries to re-add entries already processed in the input ldif file.

Example:

slapadd -f /opt/symas/etc/openldap/slapd.conf -b dc=example,dc=com -l myfile.ldif -j 23 -q

If you want to completely restart the database load, remove the data.mdb file from the database directory (directory <path> in slapd.conf or olcDbDirectory: <path> in cn=config.

 

The slapadd tool is used for loading LDAP database offline (when slapd isn't running.) 

Here are some of the common issues encountered with this tool.

Error: slapadd: could not add entry dn="cn=config" (line=1)

This error occurs when trying to load the cn=config database and the configuration directory, usually /opt/symas/etc/openldap/slapd.d or /etc/openldap/slapd.d is not empty. To fix this, simply delete the contents of the directory:

rm -rf /opt/symas/etc/openldap/slapd.d/*

Or

rm -rf /etc/openldap/slapd.d/*

Error: str2entry: entry -1 has no dn slapadd: could not parse entry (line=N)

This error occurs when there is a blank line within an entry in the ldif file. Entries are separated by blank lines in ldif files, so if there's as stray blank line, slapadd will fail because every entry must start with the “dn: " attribute.  

To fix this, open your ldif file at the line number given in the error and delete the offending blank line above. Then, you can resume slapadd (see “Resuming slapadd”).

Error: slapadd: line [N]: cannot add entry with empty dn=""

In LDAP, every entry must have a DN attribute, with one exception (null root databases which handle multiple suffixes.)

To fix this, open your ldif file at the line number given in the error and add the DN. You can then resume slapadd (see “Resuming slapadd”)

Error: slapadd: line [N]: database #1 ([suffix]) not configured to hold "[DN]"; no database configured for that naming context

This error occurs when the DN of an entry in the ldif file contains has an incorrect suffix. For example, if the suffix of the database is dc=example,dc=com and the suffix of an entry being added is dc=example,dc=cob, slapadd will fail with this error.

Fix: Correct the DN of the entry at the line number given in the error and resume slapadd (see “Resuming slapadd” at the top of this article.)

Copyright © 2020-2024 Symas Corporation. All rights reserved.
slapadd importing naming context

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • General slapd Operations
  • Startup And Shutdown Problems
  • Core File Retention
  • Symas Blog RSS Feed
  • Symas on Facebook
  • Symas on Twitter
  • Symas Blog
  • Symas on LinkedIn
  • Symas YouTube Channel

Copyright © 2023, Symas Corporation. All rights reserved. Privacy Statement (updated July 31, 2023)

Phone:

Main Office: +1.650.963.7601
Fax: +1.650.390.6284

Email:

Sales: sales@symas.com
Support: support@symas.com

Office Hours:

8:00 AM - 5:00 PM ET

Office Location:

Symas Corporation
PO Box 391
Grand Junction, CO 81507 USA

Expand