Hello,
Did you already get this kind of trouble : after having upgraded OpenVas on a Kali VM (2023.3), the postgresl db need also to be upgraded from 15 to 16. The hints obtained with gvm-check-setup suggest to use pg_upgradecluster tool which need the old cluster name and location to be provided. The problem is that I really don’t know where to find this info, searching the web for that, unsuccessfully.
Can you help me build the correct syntax of this tool ?
Thank you
Here’s the syntax I’m looking for : Usage: /usr/bin/pg_upgradecluster [OPTIONS] <old version> <cluster name> [<new data directory>]
Because this one raises an error :
pg_upgradecluster /var/lib/postgresql/15/main main
Use of uninitialized value $_[0] in concatenation (.) or string at /usr/share/perl5/PgCommon.pm line 1055.
Error: specified cluster does not exist
And this is what I get when I do pg_lscluster :
─# pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
15 main 5432 online postgres /var/lib/postgresql/15/main /var/log/postgresql/postgresql-15-main.log
16 main 5433 online postgres /var/lib/postgresql/16/main /var/log/postgresql/postgresql-16-main.log
Hi Lukas, I already checked this page, which is not really helpful for a beginner (no example given to use the command…). I continue on my researches,
Thank you for your help
HINT: If you run sudo apt update -y && sudo apt upgrade -y immediately after a fresh install of Kali, it will automatically upgrade the PG cluster and remove PG 15 for you.
Greenbone Cloud Service (GCS) is also a great option which allows you to avoid managing complex infrastructure. You can sign up for a free trial and the monthly costs are very reasonable.
While this is not a Greenbone related task / tool still cross-referencing a few existing threads in this forums giving more detailed external links / hints:
The gvmd --migrate command is used to migrate the database schema in Greenbone Vulnerability Manager (GVMD). Someone can please correct me if I’m wrong, but that will update the PostgreSQL database schema when the GVM is updates include changes to the schema.
So, unless you are updating from a much older version of GVM, if you just want to migrate the database as is from PG-15 to PG-16, you need to dump the database and re-import it into PG-16. However, You may also encouter other problems unless you also install the other PostgreSQL components from pg-gvm.
Use the pg_dump command to create a backup of your PostgreSQL database. You’ll need to specify the database name, and you can also provide authentication options if necessary. Here’s a basic command:
I think I need use _gvm user because it’s owner of gvmd database
pg_dump -U _gvm -d gvmd -p 5432 -f dumpfile.sql
pg_dump: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: Peer authentication failed for user "_gvm"