Installing OpenVAS on Kali / Debian problem with PostgreSQL version

40.2k views Asked by At

After installing OpenVAS on Kali linux, ran gvm-setup command to setup GVM as per instructions: https://linuxhint.com/install-openvas-kali-linux/

However, the following error ocurred:

ERROR: The default postgresql version is not 13 required by libgvmd
Error: Use pg_upgradecluster to update your postgres cluster

So, I checked the version of PostgreSQL installed by:

$ su postgres
$ psql --version
psql (PostgreSQL) 13.2 (Debian 13.2-1)

The version was 13. How can I complete the gvm-setup?

3

There are 3 answers

2
raw-bin hood On BEST ANSWER

gvm-setup will look for PostgreSQL on port 5432. If you have more than one version of PostgreSQL installed, they will be assigned incremental port numbers starting at 5432. To check for other versions of PostgreSQL, you can look in the /etc/postgresql/ directory. You may see multiple directories, corresponding to the PostgreSQL versions you have installed.

You should go into each version and edit the postgresql.conf file to change the port number of PostgreSQL 13 to 5432, and assign other port numbers to the other versions. So if you had PostgreSQL 12 and 13 installed:

Edit the PostgreSQL 12 config file

$ nano /etc/postgresql/12/main/postgresql.conf

find the line port = 5432 and change to:

port = 5433

Edit the PostgreSQL 13 config file

$ nano /etc/postgresql/13/main/postgresql.conf

find the line port = 5433 and change to:

port = 5432

Finally restart PostgreSQL:

systemctl restart postgres

and then run gvm-setup again

gvm-setup
0
dist3r On

The error message tells you, that you should upgrade your postgres cluster. There could already be a higher version of postgres cluster created in your system, which you can examine with the following command:

sudo pg_lsclusters

However, this auto generated cluster might not always function as intended (e.g. it operates on different from default port). Thus, it's best to perform manual cluster upgrade (you can omit step 1 if you don't have any auto generated cluster). Assuming that you want to upgrade from version 13 to 14:

  1. delete automatically generated cluster version 14 (use --stop if service status is not down):

    sudo pg_dropcluster --stop 14 main
    
  2. migrate cluster version 13 to version 14:

     sudo pg_upgradecluster 13 main
    
  3. optionally, you can drop the old cluster:

     sudo pg_dropcluster --stop 13 main
    

That's it! The new cluster will listen on the port, that were previously used by the old cluster. It might be needed to start or enable postgres service in systemd in order to use PostgreSQL in other applications.

0
EMMANUEL KATO On

This text is from this site https://gorails.com/guides/upgrading-postgresql-version-on-ubuntu-server it worked for me to solve the :

ERROR: The default PostgreSQL version (15) is not 16 that is required by libgvmd
[-] ERROR: Use pg_upgradecluster to update your PostgreSQL cluster

If you're using the default version available on Ubuntu, you can just upgrade to the latest postgres by running the following:

sudo apt-get upgrade

To find the installed versions that you currently have on your machine, you can run the following:

$ dpkg --get-selections | grep postgres
postgresql-14                   install
postgresql-15                   install
postgresql-client               install
postgresql-client-14                install
postgresql-client-15                install
postgresql-client-common            install
postgresql-common               install

You can also list the clusters that are on your machine by running

$ pg_lsclusters
Ver Cluster Port Status Owner    Data directory               Log file
14 main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
15 main    5433 online postgres /var/lib/postgresql/15/main /var/log/postgresql/postgresql-15-main.log
  1. Stop Postgres before we make any changes First thing's first, we need to stop any services using postgres so we can safely migrate our database.
sudo service postgresql stop
  1. Rename the new Postgres version's default cluster When Postgres packages install, they create a default cluster for you to use. We need to rename the new postgres cluster so that when we upgrade the old cluster the names won't conflict.
sudo pg_renamecluster 15 main main_pristine
  1. Upgrade the old cluster to the latest version Replace the version (14) here with the old version of Postgres that you're currently using.
sudo pg_upgradecluster 14 main
  1. Make sure everything is working again We can start Postgres back up again and this time it should be running the new postgres 15 cluster.
sudo service postgresql start

You should also see that the old cluster is down and the new version of Postgres is up:

$ pg_lsclusters
Ver Cluster       Port Status Owner    Data directory                       Log file
14  main          5434 down   postgres /var/lib/postgresql/14/main          /var/log/postgresql/postgresql-14-main.log
15  main          5432 online postgres /var/lib/postgresql/15/main          /var/log/postgresql/postgresql-15-main.log
15  main_pristine 5433 online postgres /var/lib/postgresql/15/main_pristine /var/log/postgresql/postgresql-15-main_pristine.log
  1. Drop the old cluster Optionally, you can drop the old cluster once you've verified the new one works and you don't need the old cluster anymore.
sudo pg_dropcluster 14 main --stop

You can also drop the pristine database from the newer version as well.

sudo pg_dropcluster 15 main_pristine --stop`enter code here`