Skip to content

[BUG] multi-container db is not initialized correctly #372

@NODeeJay

Description

@NODeeJay

** Please attach large files to the report instead of pasting the contents into the report. **

Describe the bug
When starting the compose for multi-container, the db container is not initialized correctly. It seems on first run it does not know about the DB version yet which run pg_createcluster most probably with the version 0 instead of 13 or whatever is the current one there.

To Reproduce

  1. in Portainer I manually added a stack
  2. gave it a name
  3. copy pasted the yaml and env to the corresponding fields
  4. all containers start, however ovas_gvmd spams DB not ready yet and the DB outputs this
2026-01-29T12:19:58.289570960Z starting container ver 25.12.26.01 at: Thu Jan 29 12:19:58 UTC 2026
2026-01-29T12:19:58.289624049Z Setting up container filesystem
2026-01-29T12:19:58.292164886Z Creating needed Directories
2026-01-29T12:19:58.304665410Z ln: failed to create symbolic link '/run/ospd/ospd': File exists
2026-01-29T12:19:58.326254218Z Validating other directories
2026-01-29T12:19:58.419665559Z Setting up soft links
2026-01-29T12:19:58.419693954Z PostgreSQL Version is 
2026-01-29T12:19:58.419701618Z total 0
2026-01-29T12:19:58.424398063Z Database  not found in /data/database, initializing ...
2026-01-29T12:19:58.545036966Z Usage: /usr/bin/pg_createcluster [options] <version> <cluster name> [-- <initdb options>]
[...]

later it continues with the process successfully starting with the creation of the 2 confs and lib and log.

  1. Subsequent starts of the ovas_postgresql container ends in the container trying to update the DB and failing
2026-01-29T12:23:56.757806676Z 2026-01-29 12:22:46.485 GMT [19] LOG:  skipping missing configuration file "/data/database/postgresql.auto.conf"
2026-01-29T12:23:56.757810979Z 2026-01-29 12:22:46.485 UTC [19] FATAL:  "/data/database" is not a valid data directory
2026-01-29T12:23:56.757815286Z 2026-01-29 12:22:46.485 UTC [19] DETAIL:  File "/data/database/PG_VERSION" is missing.
2026-01-29T12:23:56.757819358Z 2026-01-29 12:23:51.761 GMT [18] LOG:  skipping missing configuration file "/data/database/postgresql.auto.conf"
2026-01-29T12:23:56.757823585Z 2026-01-29 12:23:51.762 UTC [18] FATAL:  "/data/database" is not a valid data directory
2026-01-29T12:23:56.757827829Z 2026-01-29 12:23:51.762 UTC [18] DETAIL:  File "/data/database/PG_VERSION" is missing.
2026-01-29T12:23:56.757831919Z  Log status done. 
2026-01-29T12:23:56.757835871Z Looking for indication of database mismatch.
2026-01-29T12:23:56.759809495Z There does not appear to be a difference in databases versions.... 
2026-01-29T12:23:56.759841125Z exiting now
2026-01-29T12:23:56.760033845Z  DB Upgrade was a success. Starting postgresql 13
2026-01-29T12:23:56.784348337Z 2026-01-29 12:23:56.784 GMT [53] LOG:  skipping missing configuration file "/data/database/postgresql.auto.conf"
2026-01-29T12:23:56.785814953Z pg_ctl: directory "/data/database" is not a database cluster directory
2026-01-29T12:24:57.020094496Z starting container ver 25.12.26.01 at: Thu Jan 29 12:24:57 UTC 2026
2026-01-29T12:24:57.020134700Z Choosing container start method from:
2026-01-29T12:24:57.020143723Z postgresql
2026-01-29T12:24:57.020150444Z Starting postgresql for gvmd !!
2026-01-29T12:24:57.020170891Z Starting PostgreSQL...
2026-01-29T12:24:57.048709691Z 2026-01-29 12:24:57.048 GMT [14] LOG:  skipping missing configuration file "/data/database/postgresql.auto.conf"
2026-01-29T12:24:57.051022074Z pg_ctl: directory "/data/database" is not a database cluster directory
2026-01-29T12:24:57.051681204Z pg exit with 1 .
  1. after some time openvas and ovas_gvmd turns unhealthy

Expected behavior
Container inits correctly and starts

Screenshots
see logs

Environment (please complete the following information):

  • OS: Mint 21.2
  • Memory available to OS: 16GB + 8GB zram
  • Container environment used with version: docker/portainer

logs ( commands assume the container name is 'openvas' )
Please attach the output from one of the following commands:

docker

docker logs openvas > logfile.log

Podman

podman logs openvas > logfile.log

docker-compose

docker-compose logs > logfile.log

Please "attach" the file instead of pasting the conents to the issue.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions