db upgrade to pg18 fails with POSTGRES_INITDB_ARGS=--no-data-checksums #20

Open
opened 2026-11-08 06:33:24 +00:00 by cgalo5758 · 0 comments

Migrating a bitnami deploy (pg13) to 1.1.3+2026.7.4, the db container exits during the upgrade with:

pg_checksums: error: data checksums are already disabled in cluster

The current discourse/postgres:pg18 image (sha256:07d2e14a6805) does this in /usr/local/bin/upgrade-postgres.sh:

if [[ "$PG_MAJOR_NEW" -eq 18 ]]; then
  pg_checksums --disable -D ${PGDATANEW}
fi

and turns them back on after pg_upgrade. Since compose.yml sets POSTGRES_INITDB_ARGS=--no-data-checksums, the new cluster already has them off, so --disable fails and the script exits before pg_upgrade runs.

Removing that line fixed it for us. The upgrade went through and the new cluster ended up with checksums enabled.

The failed run leaves an empty cluster in /var/lib/postgresql/18/docker, which I deleted before retrying.

Something else we hit: after undeploying, pg_upgrade refused with "The source cluster was not shut down cleanly", because swarm kills postgres before it finishes shutting down. Starting the old postgres:13 once and stopping it cleanly got around it. Might be worth a line in the release notes next to the undeploy step.

Migrating a bitnami deploy (pg13) to 1.1.3+2026.7.4, the db container exits during the upgrade with: ``` pg_checksums: error: data checksums are already disabled in cluster ``` The current discourse/postgres:pg18 image (sha256:07d2e14a6805) does this in `/usr/local/bin/upgrade-postgres.sh`: ``` if [[ "$PG_MAJOR_NEW" -eq 18 ]]; then pg_checksums --disable -D ${PGDATANEW} fi ``` and turns them back on after pg_upgrade. Since [compose.yml](https://git.coopcloud.tech/coop-cloud/discourse/src/commit/630cba809d56e7e871704c5a7ca6a231e45862b4/compose.yml#L104) sets `POSTGRES_INITDB_ARGS=--no-data-checksums`, the new cluster already has them off, so `--disable` fails and the script exits before pg_upgrade runs. Removing that line fixed it for us. The upgrade went through and the new cluster ended up with checksums enabled. The failed run leaves an empty cluster in `/var/lib/postgresql/18/docker`, which I deleted before retrying. Something else we hit: after undeploying, pg_upgrade refused with "The source cluster was not shut down cleanly", because swarm kills postgres before it finishes shutting down. Starting the old postgres:13 once and stopping it cleanly got around it. Might be worth a line in the release notes next to the undeploy step.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: coop-cloud/discourse#20