mediastack icon indicating copy to clipboard operation
mediastack copied to clipboard

Postgresql having trouble with Version 18

Open cbxd opened this issue 3 months ago • 5 comments

I reran the restart.sh script and postgres wouldn't cooperate.

I got the error: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "mstack/appdata/postgresql" to rootfs at "/var/lib/postgresql/data": change mount propagation through procfd: open o_path procfd: open /var/lib/docker/overlay/<hash>/merged/var/lib/postgresql/data: no such file or directory: unknown

I read the docker page for postgres (at https://hub.docker.com/_/postgres#pgdata) and tried updating the volume from: - ${FOLDER_FOR_DATA:?err}/postgresql:/var/lib/postgresql/data to - ${FOLDER_FOR_DATA:?err}/postgresql:/var/lib/postgresql/18/data

But that didn't work and left me with dependency failed to start: container postgresql is unhealthy

Temporary workaround: Updating the postgresql docker image to: image: docker.io/library/postgres:17 lets it run, but naturally being stuck at an older version isn't ideal.

cbxd avatar Sep 26 '25 19:09 cbxd

The error above can be fixed by mapping the folder into the new directory for postgresql 18, but further steps are required (including running a backup first) for the upgrade per https://henrywithu.com/upgrade-postgresql-from-17-to-18-on-docker/ postgresql | 2025-09-27 12:46:59.801 AEST [1] DETAIL: The data directory was initialized by PostgreSQL version 17, which is not compatible with this version 18.0 (Debian 18.0-1.pgdg13+3). I think we should pin to v17, current minor release is supported until November 8, 2029. 18.0 might not even be production ready, so again, lets run v17 instead of latest.

sjpilot avatar Sep 27 '25 02:09 sjpilot

Thank you for this. I'm trying to get this up and running my self and had the same issue. Workaround confirmed to work.

losergamer04 avatar Sep 27 '25 22:09 losergamer04

Hi there, I can confirm the issue is also happening for deployments using runc in k3s. trying to mount a persistent volume to it will crash with:

failed to create shim task: OCI runtime create failed: runc create failed: unable to st │
│ art container process: error during container init: error mounting "....." to rootfs at "/var/lib/postgresql/data"

victorguidi avatar Sep 28 '25 03:09 victorguidi

use /var/lib/postgresql/18/docker

sennaarer avatar Sep 30 '25 07:09 sennaarer

I was able to successfully get version 17 to work with the following changes image: **docker.io/library/postgres:latest --> image: docker.io/library/postgres:17

I then added a PGData value under environment environment: - TZ=${TIMEZONE:?err} - PGData=${FOLDER_FOR_DATA:?err}/postgresql/data - POSTGRES_DB=${AUTHENTIK_DATABASE:?err} - POSTGRES_USER=${POSTGRESQL_USERNAME:?err} - POSTGRES_PASSWORD=${POSTGRESQL_PASSWORD:?err}

losergamer04 avatar Oct 01 '25 00:10 losergamer04