Scap/Cert database not found after migration to postgresql


I had some sql errors while using Sqlite while performing multiple tasks scan at the same time so I decided to switch to postgres as recommended in some threads.

The migration did well (I removed tasks.db) for all the elements exept the Scap and Certs databases.
When I perform scans now I have internal errors when the task ends

Openvasmd.log :

event task:MESSAGE:2019-01-16 22h32.31 CET:6726: Status of task *********(8bfcaca4-8c69-4105-9cae-a4c3811e3f60) has changed to Done
md manage:WARNING:2019-01-16 22h32.31 CET:6726: manage_cleanup_process_error: Error exit, setting running task to Internal Error
event task:MESSAGE:2019-01-16 22h32.31 CET:6726: Status of task *********(8bfcaca4-8c69-4105-9cae-a4c3811e3f60) has changed to Internal Error

postgresql-9.6-main.log :
2019-01-16 22:32:31.278 CET [6727] root@tasks ERROR: operator doesn't exists : name = integer at character 86
2019-01-16 22:32:31.278 CET [6727] root@tasks INFO : No operator matches the given name and the types of arguments.
You must add explicit type conversions.
2019-01-16 22:32:31.278 CET [6727] root@tasks INSTRUCTION : SELECT max(severity) FROM report_counts WHERE report = 443 AND override = 1 AND user = (SELECT id FROM users WHERE uuid = 'd9cb5862-8988-4b19-8d2b-8a545db4a2a5') AND min_qod = 70 AND (end_time = 0 or end_time >= m_now ());

And, when I start openvasmd (same with openvasmd-pg, I don’t know if it changes something) :

md manage:MESSAGE:2019-01-17 08h43.10 utc:1919: No SCAP database found
md manage:MESSAGE:2019-01-17 08h43.10 utc:1919: No CERT database found

Of course I runned the greenbone-scapdata-sync and greenbone-certdata-sync scripts but this doesn’t change anything. I tried deleting the data at /usr/local/var/lib/cert-data/ and /usr/local/var/lib/scap-data and rebuilding it using the scripts in vain.

It is like the sync/cert databases are still linked to sqlite someway and I can’t find any documentation about how to change this.

I use Debian 9 and every component’s version is the latest stable.

Any help is welcome, thank you for reading

Add of information, I have psql errors when I run the 2 scripts :

2019-01-17 16:53:24.213 CET [26978] root@tasks ERROR:  syntax error on or near "." at character 972
2019-01-17 16:53:24.213 CET [26978] root@tasks INSTRUCTION :  /*
	 * OpenVAS
	 * $Id$
	 * Description: SCAP database initialization script
	 * Authors:
	 * Henri Doreau <>
	 * Timo Pollmeier <>
	 * Copyright:
	 * Copyright (C) 2011-2012 Greenbone Networks GmbH
	 * This program is free software; you can redistribute it and/or
	 * modify it under the terms of the GNU General Public License
	 * as published by the Free Software Foundation; either version 2
	 * of the License, or (at your option) any later version.
	 * This program is distributed in the hope that it will be useful,
	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
	 * GNU General Public License for more details.
	 * You should have received a copy of the GNU General Public License
	 * along with this program; if not, write to the Free Software
	 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
	.output /dev/null
	PRAGMA journal_mode=WAL;

quick workaround : I manually replaced every scripts from sources that you can find at $PATH/share/openvas/cert/ and $PATH/share/openvas/scap/ because even with a cmake -DBACKEND=POSTGRES they weren’t changed.

I still got Internal Errors however. I think I’ll just recreate the db from scratch since I can’t find anything on that.

edit: after recreating the db from scratch

Found out that the scripts used to inject in database the results of the scan are the one that should be used for sqlite instead of postgresql: manage_sql.c instead of manage_pg.c

Is there any way to remove all the sources installed ? Because when I run make install it says that everything is up to date. I’m newbie with installing from sources and I don’t know how to manage it. If I remove every file from the manifest_install.txt will the C scripts be replaced ?