How to Solve PostgreSQL Error During GVM (Greenbone Vulnerability Management) Installation

Gökhan
3 min readFeb 22, 2025

--

GVM is a popular choice for vulnerability scans. It’s a essential tool for security experts because it has a large database, scanning infrastructure, and is open-source.
However, there have been some reports of errors in certain systems, especially older ones with version mismatches. Today, I’ll share the solution to one of these errors. I encountered the same error and figured out the solution through some steps. Let’s quickly go through the solution.

image from kolibers.com

GVM Setup

At this point, I will assume you are running apt install gvm directly:

apt install gvm

To avoid permission errors after installation, go to the following location and run the setup command from there

cd /usr/bin/

gvm-setup

After this step, if you do not have the minimum version of PostgreSQL supported by GVM installed on your system, or if it is installed but not the default, you are likely to get the following PostgreSQL error.

└─# gvm-setup [>] Starting PostgreSQL service [-] ERROR: The default PostgreSQL version (15) is not 17 that is required by libgvmd [-] ERROR: libgvmd needs PostgreSQL 17 to use the port 5432 [-] ERROR: Use pg_upgradecluster to update your PostgreSQL cluster

To avoid this situation, do the following in order.

Check the available versions of PostgreSQL:

pg_lsclusters

See if the version you need is in the list. If it is not available

sudo apt update
sudo apt install postgresql-17

to install the latest version (17 is the latest available version, after this tutorial find the latest version on the Internet).

Stop the old PostgreSQL service after the installation.

sudo systemctl stop postgresql

We need to point the new PostgreSQL 17 to the correct port;

sudo nano /etc/postgresql/17/main/postgresql.conf

Open the file postgresql.conf with the command nano, then find the line with the defined port number and change it as follows

port = 5432

Save and close.

Enable the service of the new version:

sudo systemctl start postgresql

At the end of the process, check the versions again to make sure it is the default:

pg_lsclusters

If 17 is the default and active in this list, your problem is solved.

Uninstall the old version if the upgrade was successful:

sudo pg_dropcluster 15 main — stop
sudo apt remove postgresql-15

Proceed with the GVM installation again:

gvm-setup

After the installation, reboot the system, log in again, and check the installation:

gvm-check-setup

The GVM installation finishes successfully.

So why did we install manually instead of using pg_upgradecluster?

The pg_upgradecluster command would upgrade the existing package, but would still leave PostgreSQL 15 on port 5432, which is required for GVM. We had to redirect 17 to this port and delete 15 to avoid conflicts. Also, a direct upgrade could have caused conflicts with the services opened at the beginning, if any, making the GVM database unusable/inaccessible. So we fixed it manually.

Safe days, so long…

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Gökhan
Gökhan

Written by Gökhan

Information Security Specialist / Computer Engineer

No responses yet

Write a response