Database migration issue in gvmd

Hi, how do I migrate the database?

when I run the new docker-compose.yml my gvmd starts to crash with this logs:

md   main:MESSAGE:2026-01-20 13h50.54 utc:23:    Greenbone Vulnerability Manager version 26.14.0 (DB revision 265)
md manage:MESSAGE:2026-01-20 13h50.54 utc:23: check_db_versions: database version of database: 264
md manage:MESSAGE:2026-01-20 13h50.54 utc:23: check_db_versions: database version supported by manager: 265
md   main:CRITICAL:2026-01-20 13h50.54 utc:23: gvmd: database is wrong version
md   main:CRITICAL:2026-01-20 13h50.54 utc:23: gvmd: Your database is too old for this version of gvmd.
md   main:CRITICAL:2026-01-20 13h50.54 utc:23: gvmd: Please migrate to the current data model.
md   main:CRITICAL:2026-01-20 13h50.54 utc:23: gvmd: Use a command like this: gvmd --migrate

This happnes no matter what I do beforhand. The same thing happens even when I manually update the db container (together with the new migrator container). Everything seems to be fine, even the fragment files in volumes list the new version as PG 17. Yet still when I upgrade GVM, it considers it version 264 at crashes…

How does gvm determine the db version? How do I make sure that the migration to new postgresql was successful?

Hi,

first of all the error messages gvmd: database is wrong version and gvmd: Your database is too old for this version of gvmd. are a bit misleading because they are referring to our database schema version not the PostgreSQL version.

With the addition of the pg-gvm-migrator container image we have two different migrations.

  1. The migration of the PostgreSQL database when the PostgreSQL major version changes due to an upgrade of the underlying distribution. This migration needs to run very rarely as the distribution changes only every two or three years.
  2. The database schema version may need changes for example if a new feature is implemented and requires a new database table. This migration is run via the gvmd container on every startup by running the gvmd --migrate command automatically. You shouldn’t notice it under normal circumstances. This migration is also independent of the PostgreSQL major version. It should work on every PostgreSQL version.

In your case it seems the database schema migration from version 264 to 265 has an issue and therefore the gvmd container didn’t start up successfully. Sadly the error is not included in your log output. Could you try to run the migration manually via

docker compose -f $DOWNLOAD_DIR/docker-compose.yml run --rm gvmd gvmd --migrate

and paste the possible error output here.

3 Likes

oh ok,

thank you for the clarification! :slight_smile:

This is the output that I get after running the migration manually:

md   main:MESSAGE:2026-01-22 07h26.54 utc:1:    Greenbone Vulnerability Manager version 26.14.0 (DB revision 265)
md   main:   INFO:2026-01-22 07h26.54 utc:1:    Migrating database.
md   main:   INFO:2026-01-22 07h26.54 utc:1:    Migrating to 265
md manage:WARNING:2026-01-22 07h26.54 utc:1: sql_exec_internal: PQexec failed: ERROR:  relation "oci_image_targets" does not exist
 (7)
md manage:WARNING:2026-01-22 07h26.54 utc:1: sql_exec_internal: SQL: ALTER TABLE oci_image_targets ADD COLUMN exclude_images text;
md manage:WARNING:2026-01-22 07h26.54 utc:1: sqlv: sql_exec_internal failed

Thanks. Seems to be a bug to me. I created an internal ticket to fix it.

2 Likes

Seems to not have been an issue in the containers at all but in the manager:

Should be fixed Release gvmd 26.15.0 · greenbone/gvmd · GitHub

1 Like

I thought this would be obvious

Prior to my note the thread was still in the “Community Containers” category and had a title which indicated an issue in the container itself :slight_smile:

I wanted to let you know on 26.16.0 this behavior reverted, I had to revert to 26.15.0 to get it to update.

Me as well. I had to revert the host system sadly b/c of a HyperV issue and that was a snapshot before I did the initial upgrade two weeks ago. How did you specify 26.15.0 specifically?

Could you paste your issue? Maybe it is something different.

yesterday I also had an error when updating to gvmd version 26.16.0

I was updating from version 26.12.1

here are the logs

md   main:MESSAGE:2026-02-19 11h36.25 utc:3340258:    Greenbone Vulnerability Manager version 26.16.0 (DB revision 268)
md   main:   INFO:2026-02-19 11h36.25 utc:3340258:    Migrating database.
md   main:   INFO:2026-02-19 11h36.25 utc:3340258:    Migrating to 263
md   main:   INFO:2026-02-19 11h36.25 utc:3340258:    Migrating to 264
md   main:   INFO:2026-02-19 11h36.25 utc:3340258:    Migrating to 265
md   main:   INFO:2026-02-19 11h36.25 utc:3340258:    Migrating to 266
md   main:   INFO:2026-02-19 11h36.25 utc:3340258:    Migrating to 267
md manage:WARNING:2026-02-19 11h36.25 utc:3340258: sql_exec_internal: PQexec failed: ERROR:  relation "asset_snapshots" does not exist
 (7)
md manage:WARNING:2026-02-19 11h36.25 utc:3340258: sql_exec_internal: SQL: ALTER TABLE asset_snapshots ADD COLUMN scanner INTEGER;
md manage:WARNING:2026-02-19 11h36.25 utc:3340258: sqlv: sql_exec_internal failed
md   main:MESSAGE:2026-02-19 11h37.41 utc:3340318:    Greenbone Vulnerability Manager version 26.16.0 (DB revision 268)
md manage:MESSAGE:2026-02-19 11h37.41 utc:3340318: check_db_versions: database version of database: 266
md manage:MESSAGE:2026-02-19 11h37.41 utc:3340318: check_db_versions: database version supported by manager: 268
md   main:CRITICAL:2026-02-19 11h37.41 utc:3340318: gvmd: database is wrong version
md   main:CRITICAL:2026-02-19 11h37.41 utc:3340318: gvmd: Your database is too old for this version of gvmd.
md   main:CRITICAL:2026-02-19 11h37.41 utc:3340318: gvmd: Please migrate to the current data model.
md   main:CRITICAL:2026-02-19 11h37.41 utc:3340318: gvmd: Use a command like this: gvmd --migrate

md   main:MESSAGE:2026-02-19 11h55.48 utc:3358545:    Greenbone Vulnerability Manager version 26.16.0 (DB revision 268)
md   main:   INFO:2026-02-19 11h55.48 utc:3358545:    Migrating database.
md   main:   INFO:2026-02-19 11h55.48 utc:3358545:    Migrating to 267
md manage:WARNING:2026-02-19 11h55.48 utc:3358545: sql_exec_internal: PQexec failed: ERROR:  relation "asset_snapshots" does not exist
 (7)
md manage:WARNING:2026-02-19 11h55.48 utc:3358545: sql_exec_internal: SQL: ALTER TABLE asset_snapshots ADD COLUMN scanner INTEGER;
md manage:WARNING:2026-02-19 11h55.48 utc:3358545: sqlv: sql_exec_internal failed


md   main:MESSAGE:2026-02-19 13h19.44 utc:3395532:    Greenbone Vulnerability Manager version 26.14.0 (DB revision 265)
md manage:MESSAGE:2026-02-19 13h19.44 utc:3395532: check_db_versions: database version of database: 266
md manage:MESSAGE:2026-02-19 13h19.44 utc:3395532: check_db_versions: database version supported by manager: 265
md   main:CRITICAL:2026-02-19 13h19.44 utc:3395532: gvmd: database is wrong version
md   main:CRITICAL:2026-02-19 13h19.44 utc:3395532: gvmd: Your database is too new for this version of gvmd.
md   main:CRITICAL:2026-02-19 13h19.44 utc:3395532: gvmd: Please upgrade gvmd to a newer version.
md   main:MESSAGE:2026-02-19 13h24.24 utc:3397201:    Greenbone Vulnerability Manager version 26.15.0 (DB revision 266)

I managed to start the service on version 26.15.0

This is actually something new / different, could you please raise an issue for the development team here: GitHub · Where software is built

Edit: For the reference:

1 Like