Greenbone 21.4.4 migrate to 22.4 Container

Hi all

At present i have a Greenbone server that was running version 21.4.4. As it shows some errors and i would also want to upgrade i have installed the container version of 22.4.

All working fine till i had to import the old database.

I took a dump of the old database and copied over to the container data volume and tried to import it from pg-gvm but i got a lot of errors.

Checking the container version i see that it is running postgres 13 where my old server was running 12 and the db dump is on 12.

How can i migrate the db? I’ve checked also the container version for 21.4 but that one runs Postgres 13 as well.

Trying to run the pg 13 upgrade on the old server it gives me the below:
postgres@rimdub-vs-02:~$ LD_PRELOAD=/opt/gvm/lib/libgvm-pg-server.sopostgres@rimdub-vs-02:~$ export LD_PRELOADpostgres@rimdub-vs-02:~$ /usr/lib/postgresql/13/bin/pg_upgrade --old-datadir=/var/lib/postgresql/12/main --new-datadir=/var/lib/postgresql/13/main --old-bindir=/usr/lib/postgresql/12/bin --new-bindir=/usr/lib/postgresql/13/bin --old-options ‘-c config_file=/etc/postgresql/12/main/postgresql.conf’ --new-options ‘-c config_file=/etc/postgresql/13/main/postgresql.conf’
/usr/lib/postgresql/13/bin/pg_upgrade: symbol lookup error: /opt/gvm/lib/libgvm-pg-server.so: undefined symbol: SPI_processed

Any ideas what i can try to get this db migrated?

Just make an SQL-dump and import the SQL-dump into the new Postgres 13. Then migrate the database to the new schema.

hi Lukas

I have tried that but unfortunately once i do that i see a lot of errors in the postgres on import and the db is not complete.

i also tried to upgrade the db to v13 then take the dump and trie to reimport to the same result.

third option was to go docker version but in there could not import the db either so i am kind of stuck.

Hmm what about improve your Postgres skills first.

If you run a SQL database you should be able to backup and import a database at any time :wink: And that is independent of the delivery method (Container, Distribution or self compiled).

I don’t want to be mean here.
i dumped the database with “pg_dump gvmd > gvmd.sql”. then copied over the sql file to the destination server and imported with “psql gvmd < gvmd.sql” on a brand new empty database with the proper user and roles and extensions created, so what am i doing wrong?
also on the container one the user is changed from gvm to gvmd so more errors.

You need to understand the encoding and other side effects like permissions.

As i said, here is not the PostgreSQL beginner forum:

https://www.postgresql.org/docs/12/app-pgdump.html

As well i would use the pg_dumpall command like suggested in the migation guide.

https://www.postgresql.org/docs/13/upgrading.html

just used pg_dumpall as per the how to and also checked the DB is UTF8 on both servers.
I am trying to import to the pg-gvm container and i see a lot of
invalid command \n
invalid command \n
invalid command \n
invalid command \n
invalid command \n
invalid command \n
invalid command \n
invalid command \n
invalid command \nFixed

or like this

unrecognized value “NOTE:” for “tuples_only”: Boolean expected
invalid command \nthe
invalid command \nand
invalid command \tNOTE:
invalid command \N
invalid command \tNOTE:
invalid command \nJava
invalid command \nthe
invalid command \nthe
invalid command \nand
invalid command \tNOTE:
invalid command \nthe
unrecognized value “NOTE:” for “tuples_only”: Boolean expected
invalid command \nthe
invalid command \tNOTE:
invalid command
invalid command \tNOTE:
unrecognized value “NOTE:” for “tuples_only”: Boolean expected
invalid command
invalid command \tNOTE:
ERROR: syntax error at or near “4169”
LINE 1: 4169 oval:org.mitre.oval:def:11397_/oval/5.10/org.mitre.oval…

and now my db is screwed up

right. so if i drop the database prior to import i can import no issue. now i need to see how to combine the 2 databases into one as i need to combine 2 servers into one.

That is not planed nor supported. You simply can´t merge databases out of the box.

thanks for the support. i managed to import one db and to upgrade it.