Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container doesn't start for a second time, because default database changed #34

Open
Kritzefitz opened this issue Dec 8, 2023 · 0 comments · May be fixed by #35
Open

Container doesn't start for a second time, because default database changed #34

Kritzefitz opened this issue Dec 8, 2023 · 0 comments · May be fixed by #35

Comments

@Kritzefitz
Copy link

If prepopulation data is provided, the container only starts once and then never again:

$ mkdir prepopulate
$ cat > prepopulate/test.ldif
dn: ou=example,dc=example,dc=org
objectClass: organizationalUnit
ou: example
$ podman run --name test-ldap -e 'SLAPD_PASSWORD=12345' -e 'SLAPD_DOMAIN=example.org' -v "$PWD/prepopulate:/etc/ldap.dist/prepopulate" docker.io/dinkel/openldap:latest
657312c4.38b3a632 0x7f474441e200 @(#) $OpenLDAP: slapd 2.5.13+dfsg-5 (Feb  8 2023 01:56:12) $
	Debian OpenLDAP Maintainers <[email protected]>
657312c4.38f56d00 0x7f474441e200 slapd starting
^C657312c7.37ac3eae 0x7f4702fff6c0 daemon: shutdown requested and initiated.
657312c7.37b0a93b 0x7f4702fff6c0 slapd shutdown: waiting for 0 operations/tasks to finish
$ podman start --attach test-ldap
Info: Container already configured, therefore ignoring SLAPD_xxx environment variables and preseed files
mdb_id2entry_put: mdb_put failed: MDB_KEYEXIST: Key/data pair already exists(-30799) "ou=example,dc=example,dc=org"
=> mdb_tool_entry_put: id2entry_add failed: err=-30799
=> mdb_tool_entry_put: txn_aborted! MDB_KEYEXIST: Key/data pair already exists (-30799)
slapadd: could not add entry dn="ou=example,dc=example,dc=org" (line=1): txn_aborted! MDB_KEYEXIST: Key/data pair already exists (-30799)

This is because the check that guards loading the propupulation data checks for /var/lib/ldap/DB_CONFIG, but that file is only created by the berkeley db backend of openldap, but the new default backend in openldap after version 2.5 has been changed to mdb. This means a freshly populated /var/lib/ldap looks like this:

$ ls -l /var/lib/ldap
total 64
-rw------- 1 openldap openldap 61440 Dec  8 13:04 data.mdb
-rw------- 1 openldap openldap  8192 Dec  8 13:04 lock.mdb

and the prepopulation code path will be run every time, failing on every start but the first.

@Kritzefitz Kritzefitz linked a pull request Dec 8, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant