ldapldif389ds

ldap_add: No such object (32) when adding the root entry (initial ldif)


I'm trying to populate an ldap instance but my ldif fails to add the root entry. These are the first lines of my ldif mytest.ldif:

version: 1

dn: dc=mytest,dc=net
objectClass: top
objectClass: domain
dc: mytest

This is my config file for the instance (ldap-setup.inf), as you see, the suffix is supposed to be configured:

[general]
full_machine_name= sn.mytest.test
user= dirsrv
group= dirsrv
admin_domain= mytest.test
admin_id= admin
admin_password= admin
ConfigDirectoryLdapURL= ldap://sn.mytest.test:389/o=NetscapeRoot

[slapd]
instance_name = sn
ldap_port= 389
suffix= dc=mytest,dc=net
root_dn= cn=Directory Manager
root_password= password
init_ldif= /tmp/mytest.ldif

[backend]
backend_name= userRoot

[admin]
admin_port= 9830
admin_ip_address= 111.11.11.11
server_admin_id= admin
server_admin_password= admin

But when I bring the instance up, nothing seems to be in there. And if I try to add the ldif manually, this is what happens:

ldapadd -x -D "cn=Directory Manager" -w password -H ldap://localhost:389 -f /tmp/mytest.ldif
adding new entry "dc=mytest,dc=net"
ldap_add: No such object (32)

Any clue of what am I doing wrong here? Thanks!


Solution

  • So it seems the setup file format changed quite a bit since the last time I had to bother with it, so that's why that didn't work. Here's how it looks like now:

    [general]
    config_version=2
    full_machine_name= sn.mytest.test
    user= dirsrv
    group= dirsrv
    
    [slapd]
    instance_name = sn
    ldap_port= 389
    root_dn= cn=Directory Manager
    root_password= password
    
    [backend-userroot]
    suffix= dc=mytest,dc=net
    

    And now it works. You'll notice some of the stuff is missing. For the most part I don't really need it since mine is just a test environment, however I did miss the initial_ldif argument. I couldn't find any alternative on the new format, so I just execute an ldapadd afterwards on my ansible playbook. Feel free to answer in the comments in case you know how to do it.