fix: every PostgreSQL cluster starts after keel-host-keys #45
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Keel-Linux/inithooks!45
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/postgresql-cluster-after-host-keys"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
On the step 12 PostgreSQL image (2026-10-09),
35pgsqlpassand36pgsqlverifyfailed at first boot.postgresql@17-mainhad started beforekeel-host-keys.servicemade the snakeoil pair:FATAL: could not load server certificate file "/etc/ssl/certs/ssl-cert-snakeoil.pem": No such file or directory.Cause
keel-host-keys.serviceisBefore=postgresql.service. That orders no cluster:postgresql.serviceis the meta unit of postgresql-common, and eachpostgresql@VERSION-CLUSTER.serviceis itselfBefore=postgresql.service. The build removes the snakeoil pair (no key in the image), so on the first boot the cluster raced the unit that makes it.Change
The package installs
/usr/lib/systemd/system/postgresql@.service.d/keel-host-keys.confwithWants=andAfter=keel-host-keys.service. A drop-in for the template applies to every cluster, in every image that has PostgreSQL (keel-postgresql, unit-postgresql for LAPP, Odoo). No Condition, so a fault stays visible. No key goes into the image. The comment inkeel-host-keys.servicesays where the cluster order comes from.Tests
tests/test-packaging.bats: the install line, the drop-in content, and the order as systemd sees it. With the units of postgresql-common 278 (tests/fixtures/), a probe unit that asks for the opposite order gives an ordering cycle insystemd-analyze verifywith the drop-in, and none without it.systemd-analyze verifyaccepts the template with the drop-in.Changelog 2.3.6+keel26. The keel-postgresql boot test gate gets the assertion that the cluster is active after first boot in a separate PR.
Reproduced on the published postgresql layer in LXC, with keel-host-keys made 10 s slower: the cluster stopped on the missing snakeoil certificate and 35pgsqlpass and 36pgsqlverify failed. With this drop-in in the same rootfs, the cluster starts after keel-host-keys and both hooks complete.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.