[GH-ISSUE #49] Bootstrap script breaks due to non-set environment variables #28

Closed
opened 2026-02-27 16:47:42 +03:00 by kerem · 0 comments
Owner

Originally created by @IngmarPaetzold on GitHub (Sep 12, 2023).
Original GitHub issue: https://github.com/rroemhild/docker-test-openldap/issues/49

After building the container locally, I had the same issue as #42 and could solve that with https://github.com/jskacel 's proposal:
https://github.com/rroemhild/docker-test-openldap/blob/master/rootfs/opt/openldap/bootstrap/config/tls.ldif#L3-L5

However, the script broke again:

Load data...
++ find /opt/openldap/bootstrap/data -maxdepth 1 -name '*_*.ldif' -type f
++ sort
Processing file /opt/openldap/bootstrap/data/00_people.ldif...
[...]
/opt/openldap/bootstrap/data/30_groups_crew.ldif'
+ for ldif in ${data}
+ echo 'Processing file /opt/openldap/bootstrap/data/00_people.ldif...'
/var/run/s6/etc/cont-init.d/050-openldap-populate: line 43: LDAP_BASEDN: unbound variable
[cont-init.d] 050-openldap-populate: exited 1.
[cont-init.d] done.
[services.d] starting services
starting slapd
[services.d] done.
65002ed6 @(#) $OpenLDAP: slapd  (May 14 2022 18:35:44) $
        Debian OpenLDAP Maintainers <pkg-openldap-devel@lists.alioth.debian.org>
65002ed6 hdb_db_open: database "dc=planetexpress,dc=com": database already in use.
65002ed6 backend_startup_one (type=hdb, suffix="dc=planetexpress,dc=com"): bi_db_open failed! (-1)
65002ed6 slapd stopped.

It fails because variables LDAP_BASEDN and LDAP_DOMAIN are not set, but script /rootfs/etc/cont-init.d/050-openldap-populate references them.
Reason is the set -eux on top which makes every non-set variable an error.

Therefore the script breaks and does not stop the database, which, as consequence, raises the database already in use error.

I will file a pull request for that.

Originally created by @IngmarPaetzold on GitHub (Sep 12, 2023). Original GitHub issue: https://github.com/rroemhild/docker-test-openldap/issues/49 After building the container locally, I had the same issue as #42 and could solve that with https://github.com/jskacel 's proposal: [https://github.com/rroemhild/docker-test-openldap/blob/master/rootfs/opt/openldap/bootstrap/config/tls.ldif#L3-L5](url) However, the script broke again: ``` Load data... ++ find /opt/openldap/bootstrap/data -maxdepth 1 -name '*_*.ldif' -type f ++ sort Processing file /opt/openldap/bootstrap/data/00_people.ldif... [...] /opt/openldap/bootstrap/data/30_groups_crew.ldif' + for ldif in ${data} + echo 'Processing file /opt/openldap/bootstrap/data/00_people.ldif...' /var/run/s6/etc/cont-init.d/050-openldap-populate: line 43: LDAP_BASEDN: unbound variable [cont-init.d] 050-openldap-populate: exited 1. [cont-init.d] done. [services.d] starting services starting slapd [services.d] done. 65002ed6 @(#) $OpenLDAP: slapd (May 14 2022 18:35:44) $ Debian OpenLDAP Maintainers <pkg-openldap-devel@lists.alioth.debian.org> 65002ed6 hdb_db_open: database "dc=planetexpress,dc=com": database already in use. 65002ed6 backend_startup_one (type=hdb, suffix="dc=planetexpress,dc=com"): bi_db_open failed! (-1) 65002ed6 slapd stopped. ``` It fails because variables `LDAP_BASEDN` and `LDAP_DOMAIN` are not set, but script `/rootfs/etc/cont-init.d/050-openldap-populate` references them. Reason is the `set -eux` on top which makes every non-set variable an error. Therefore the script breaks and does not stop the database, which, as consequence, raises the `database already in use` error. I will file a pull request for that.
kerem closed this issue 2026-02-27 16:47:43 +03:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/docker-test-openldap#28
No description provided.