Cannot install openvas in kali due to pg-gvm extension error

I encountered the error about pg-gvm extension after i run gvm-setup in kali linux as follow:

*] Creating extension pg-gvm
ERROR: extension “pg-gvm” is not available
DETAIL: Could not open extension control file “/usr/share/postgresql/16/extension/pg-gvm.control”: No such file or directory.
HINT: The extension must first be installed on the system where PostgreSQL is running.

I already attempt to create pg-gvm extension from postgresql command but it give the same error output as stated above. Can i know what is the alternate way to install pg-gvm extension?

FYI i already run apt update and update everything to the latest version in kali

3 Likes

Hi jonathaninori, welcome to the Greenbone forum,

It seems that the Kali native GVM installation packages have started using PostgreSQL 16 instead of PostgreSQL 15. However, I guess that Greenbone’s postgres extensions are not tested against PostgreSQL 16. You can report the bug to Kali linux here: My View - Kali Linux Bug Tracker

In the meantime, you can fix by modifying the file /usr/share/gvmd/postgresql-version and change 16.0 to 15.0. Then gvm-setup should work properly for you.

2 Likes

Hi, this solution does not work for me. Installing OpenVAS on Kali 2023.3 is a pain at the moment. Tried different tips on postgresql but did not get it working.

1 Like

Hi.

Thanks for your help. It work. I change the openvas config to use postgresql 15 instead of 16 and now gvm-setup can work perfectly fine in my kali linux

many thanks

Few short notes:

1 Like

Even in the weekly build (2023 week 32) of Kali with fully upgraded packages, PostgreSQL-15 is installed and occupying port 5432:

┌──(kali㉿kali)-[~]
└─$ pg_lsclusters --no-header | awk '$3 == "5432" { print $1 }'
15

So while the need to migrate to PostgreSQL-16 is indeed on the forecast, it is not a hard requirement for now.

Otherwise, you can follow the instructions presented by @cfi.

From 0008472: Greenbone - Openvas - GVMD - incompatible library “/usr/lib/libgvm-pg-server.so”: version mismatch - Kali Linux Bug Tracker:

I have uploaded a fix: gvmd version 22.9.0-0kali4 (it installs postgresql-16-pg-gvm version 22.6.2-1kali1 too).
It will be available in few hours.

and

postgresql-16-pg-gvm is now available, so please make sure to perform an update and a full-upgrade via apt

so it seems the Kali package maintaining team already uploaded a solution so any workarounds shouldn’t be required anymore.

2 Likes

And a more generic note:

For upgrading PostgreSQL from 15 to 16 manual user action is always required as this is AFAICT not done automatically. And when not doing these steps the user is left behind with unsupported and unmaintained PostgreSQL server packages which has even security implications.

See the following posts below for a few additional notes. I had suggested to ask the Kali team (or even Debian as Kali is AFAICT also only taking the PostgreSQL packages from Debian) for better documentation around this topic as users seems to struggle quite often with this (Greenbone software unrelated) administrative tasks.

2 Likes

Sorry that I am new here when trying to install openvas in latest Kali. and I am having the same issue here.
I did the update and full-upgrade via apt. But the gvm-setup still gives me:
Creating extension pg-gvm
ERROR: extension “pg-gvm” is not available
DETAIL: Could not open extension control file “/usr/share/postgresql/16/extension/pg-gvm.control”: No such file or directory.

What exact steps I shall do to fix this issue? I have been struggling on this issue for many days.

This looks like a packaging issue / problem which can’t be solved by Greenbone or the Greenbone Community.

Please raise a new issue over here for investigation by the Kali packaging team:

https://bugs.kali.org

3 Likes

I had the same problem. I got it solved by following this tutorial (NB: You need to SKIP the Updating feeds part):

There was one time the tutorial did not work (tried updating feed), but it did work when i reinstalled Kali.

I think this is because the Kali maintainers do not maintain separate install scripts for older versions of Kali Rolling. Typically, since Kali isn’t considered a long-term-support LTS operating system when new versions of Kali are released, or when upgrades to packages come out, only the leading Greenbone install scripts are kept.

Something that works for me:
edit /usr/share/gvmd/postgresql-version and change for 15.0
check your clusters and if you have 16 and 15 delete the 16
then restart the service with pg_ctlcluster 15 main restart
the last step you should be able to execute gvm-setup
COMMANDS:
sudo vim /usr/share/gvmd/postgresql-version
sudo pg_lsclusters
sudo pg_dropcluster 16 main --stop
sudo pg_ctlcluster 15 main restart
sudo gvm-setup

1 Like

Hello and welcome to this community forums.

As mentioned previously via Cannot install openvas in kali due to pg-gvm extension error - #5 by cfi it is strongly discouraged to use such older PostgreSQL versions which are left behind on the system for the simple reason that these are not getting e.g. security fixes anymore.

Instead the current older version (in this case 15) should be “upgraded” to the more recent version (in this case 16) and then packages for the older version should be dropped completely.

Please see the following for more information and raise an issue on https://bugs.kali.org if the problem persists so that the Kali packaging team can investigate.

1 Like

Some one now raised a new issue over here:

https://bugs.kali.org/view.php?id=8549

Hi,
I had the same issue on Kali and fixed-it, (i’m using Postgresql 16 not 15, using 15 isn’t advised)
I had to install pg-gvm via github :

It ran into an additional error wich i can’t recall when using cmake to compile via github. You’ll find a way through, remember to use journalctl -u gvmd.service to look for logs if you are stuck.

After sucessfully installing pg-gvm, i had to go to the postgresql prompt and create the extention. then gvm-stop > gvm-start for changes to apply. Then i was able to login to the gvm web interface without issues.

Sorry for not giving much details, i can’t recall all the steps, but journalctl -u does a wonderfull job when it comes to finding out the source of an issue.

If using the Kali packages then building additional packages from source shouldn’t even be required and it is even strongly discouraged to do so.

pg-gvm seems to be already packaged by Kali here:

https://pkg.kali.org/pkg/pg-gvm

as a postgresql-16-pg-gvm binary.

I’m experiencing the same problem with the postgre 16 already installed, and Kali on version 6.3.0. Even after perform apt update $$ apt upgrade. Does anyone knows how to fix this?

I found the answer: I executed the “apt install postgresql-16-pg-gvm” code and after this I just needed to create the DB user and password, and then the gvm could be executed successfully.

1 Like

Since yesterday we have a nice chapter in our docs about troubleshooting this issue on Kali Linux Troubleshooting - Greenbone Community Documentation

6 Likes