Gvm-migrate-to-postgres: Database version not supported

good afternoon

I installed the greenbone-vulnerability-manager on the Centos 7 operating system successfully

command executed

yum install greenbone-vulnerability-manager

sed -i ‘/^#.*unixsocket/s/^# //’ /etc/redis.conf

systemctl enable redis && systemctl restart redis

echo ‘OPTIONS="–listen=0.0.0.0 --port=9392"’ > /etc/sysconfig/gsad

systemctl start gsad

openvas-setup

I need to migrate the sqlite database to postgres, but it was not possible, I request support

database installation procedure

yum install postgresql-server postgresql postgresql-contrib

  • Versions installed
    postgresql-server-9.2.24-1.el7_5.x86_64
    postgresql-9.2.24-1.el7_5.x86_64
    postgresql-contrib-9.2.24-1.el7_5.x86_64

postgresql-setup initdb

systemctl enable postgresql ; systemctl start postgresql

sudo -u postgres bash

createuser -DRS openvas10

createdb -O openvas10 gvmd

sudo -u postgres bash

psql gvmd

create role dba with superuser noinherit;

grant dba to openvas10;

sudo -u postgres bash

psql gvmd

create extension “uuid-ossp”;

createuser -DRS root

grant dba to root;

ALTER USER root with password ‘password’;

vim /var/lib/pgsql/data/postgresql.conf

listen_addresses = ‘*’

vim /var/lib/pgsql/data/pg_hba.conf

TYPE DATABASE USER ADDRESS METHOD

“local” is for Unix domain socket connections only

local all all ident

IPv4 local connections:

host all all 127.0.0.1/32 trust

IPv6 local connections:

host all all ::1/128 ident

host all all 172.16.34.0/24 trust

systemctl restart postgresql

gvm-migrate-to-postgres

gvm-migrate-to-postgres: Checking SQLite3 database.
gvm-migrate-to-postgres: SQLite: DROP INDEX report_hosts_by_host;
gvm-migrate-to-postgres: SQLite: CREATE INDEX report_hosts_by_host ON report_hosts (host);
gvm-migrate-to-postgres: SQLite: PRAGMA integrity_check;
gvm-migrate-to-postgres: PG: SELECT EXISTS (SELECT table_name FROM information_schema.tables WHERE table_catalog = ‘gvmd’ AND table_schema = ‘public’ AND table_name = ‘meta’) ::integer;
gvm-migrate-to-postgres: Database version not supported:

What do I need to do to correct the problem?

Thank you in advance for your attention.

Att

1 Like

Hi,

it’s very likely that you have a too old version of OpenVAS. You have to update at best to the latest gvmd 9 release (GVM-9 (old stable, initial release 2017-03-07)) first.

Good Morning,

I made the installation through the atomic repository
yum install greenbone-vulnerability-manager 10.0.0-6947.el7.art

below installed versions

gvmd --version

Greenbone Vulnerability Manager 8.0.0
DB Manager revision 205

openvassd --version

OpenVAS Scanner 6.0.0
Most new code since 2005: © 2018 Greenbone Networks GmbH

gsad --version

Greenbone Security Assistant 8.0.0
Copyright © 2010-2016 Greenbone Networks GmbH

psql --version

psql (PostgreSQL) 9.2.24

sqlite3 --version

3.7.17 2013-05-20 00:56:22

Do I need to upgrade? What’s the procedure?

Att

Please get back to Atomic, we can´t support any 3rd party packets here. You need either psql or sqlite so both are not simultaneously needed, please ensure that GVM is build with PSQL support as well.

I would suggest to build it from the source with the last GVM 10 release and not relay to 3rd party packets that are known to be buggy or insecure.

Hello,

would have some manual for compiling the solution with postgres in Centos 7?

Att

Yes you need to go to our github and under “installation and usage” is described how to build the software.

You should be familiar with your Linux system …

1 Like

Hello Lukas,

in preparation of moving on to the latest GVM-11 release, I wanted to migrate my source-built installation from sqlite to postgres. So I installed postgres as stated in the gvmd Install.md over on GitHub and ran the gvm-migrate-to-postgres script.

The script always fails with the same error as described in the original post:

<29>Oct 16 11:59:01 gvm-migrate-to-postgres: Database version not supported: 205

Is there anything I could do?

Best regards,

Chris

First you need to migrate sqlite to PostgreSQL on GVM10 then you can migrate your PostgreSQL from the GVM10 to the GVM11 schema.

1 Like

Yes, that’s what I’m trying to do… At the moment, I’m using the latest released versions of the GVM10 stack.

It looks like my database scheme version is 205, but the migration script only covers versions up to 187:

u10013-adm@mak1-vas1:~$ sudo gvmd --version
Greenbone Vulnerability Manager 8.0.1
Manager DB revision 205
Copyright (C) 2010-2017 Greenbone Networks GmbH
License GPLv2+: GNU GPL version 2 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

I think this is wrong. The script should support migrating from the last db version of GVM 10. Nevertheless the script from gvmd 9/GVM 11 does support the migration

4 Likes

Thanks @bricks. So I could just take the newer script and make the migration. Will GVM10 work with DB revision 209 or will I have to upgrade to GVM11 immediately with the migration?

Hey bricks,

i had the same problem like him after fixxing the corrupt Database, when i take the newer Script from gvmd 9 i have this output:

I am not sure about that. I guess it will only migrate your sqlite3 database to postges with the db version from sqlite3. But please create a backup of the db before trying out.

1 Like

@ayinuha I am sorry but as I wrote before you don’t seem very familiar with building software from source code and lower-level developer/sysadmin topics in general. Therefore I highly recommend you to use packages or our community edition. Or even think about buying one of our appliances with extensive support. You are doing several beginner level mistakes for which we can’t always offer help.

A xyz.in file is a template that gets converted into the correct file during build :expressionless:

1 Like

sorry for being a beginner, but anyway without doing i cant learn it… and for this its an forum or? if you guys cant offer always beginner help i understand it, but here are other peoples which can help too…
and just that you know, im not just very familar with building from source code, that is the first time that i make that

Ok, I’ll try that with a backup of the current DB :slight_smile:

1 Like

Of course this forum is for learning and giving advises but you did ask me directly. I am not able to answer all basic issues neither are my co-workers. You did choose a bigger and very complex product to start with. You will have to learn a lot of new things in one go and will do many many mistakes. Therefore it may be better for you to choose packages and start learning with a different simpler project.

1 Like

@bricks: It worked like a charm :wink:

1 Like

Thats worked now for me too, thank you

1 Like