PQexec failed: ERROR: relation "vulns" does not exist

Freshly installed GVM-20 from Atomic’s rpm. Install works fine, all functionalities seem to work fine. The moment a scan is deleted however, we are getting errors on the vulnerabilities page. Created this GH issue: https://github.com/Atomicorp/gvm/issues/34

As I thought it might have been an issue with the rpm. But I was able to reproduce, this starts the moment a scan is deleted.

An internal error occurred while getting resources list. The current list of resources is not available. Diagnostics: Failure to receive response from manager daemon.

GVM versions

gsad: Greenbone Security Assistant 20.08.0
gvmd: Greenbone Vulnerability Manager 20.08.0
Manager DB revision 233
openvas-scanner: OpenVAS 20.8.0
gvm-libs 20.8.0
gvm-libs: gvm.noarch 20.8.0-14930.el8.art @atomic
gvm-libs.x86_64 20.8.0-14795.el8.art @atomic
gvmd.x86_64 20.8.0-14595.el8.art @atomic

Environment

Operating system: CentOS 8
Kernel: 4.18.0-193.19.1.el8_2.x86_64
Installation method / source: Atomic rpm

Full error from the linked issue:

md manage:WARNING:2020-09-25 08h38.26 UTC:554058: sql_exec_internal: SQL: SELECT id AS id, uuid AS uuid, name AS name, '' AS comment, iso_time (creation_time), iso_time (modification_time), creation_time AS created, modification_time AS modified, cast (null AS text) AS _owner, '' AS owner, vuln_results (uuid, opts.task, opts.report, opts.host) AS results, (SELECT count(*) FROM  (SELECT results.host FROM results  WHERE nvt = vulns.uuid    AND (opts.report IS NULL OR results.report = opts.report)    AND (opts.task IS NULL OR results.task = opts.task)    AND (opts.host IS NULL OR results.host = opts.host)    AND (results.severity != -3.0)    AND (SELECT has_permission FROM permissions_get_tasks         WHERE "user"                = (SELECT id FROM users                   WHERE uuid                         = (SELECT current_setting                                    ('gvmd.user.uuid')))           AND task = results.task)      GROUP BY results.host) AS hosts_subquery) AS hosts, severity, qod, (SELECT iso_time (min (date)) FROM results  WHERE nvt = vulns.uuid    AND (opts.report IS NULL OR results.report = opts.report)    AND (opts.task IS NULL OR results.task = opts.task)    AND (opts.host IS NULL OR results.host = opts.host)    AND (results.severity != -3.0)    AND (SELECT has_permission FROM permissions_get_tasks         WHERE "user"                = (SELECT id FROM users                   WHERE uuid                         = (SELECT current_setting                                    ('gvmd.user.uuid')))           AND task = results.task)), (SELECT iso_time (max (date)) FROM results  WHERE nvt = vulns.uuid    AND (opts.report IS NULL OR results.report = opts.report)    AND (opts.task IS NULL OR results.task = opts.task)    AND (opts.host IS NULL OR results.host = opts.host)    AND (results.severity != -3.0)    AND (SELECT has_permission FROM permissions_get_tasks         WHERE "user"                = (SELECT id FROM users                   WHERE uuid                         = (SELECT current_setting                                    ('gvmd.user.uuid')))           AND task = results.task)), type, (SELECT min (date) FROM results  WHERE nvt = vulns.uuid    AND (opts.report IS NULL OR results.report = opts.report)    AND (opts.task IS NULL OR results.task = opts.task)    AND (opts.host IS NULL OR results.host = opts.host)    AND (results.severity != -3.0)    AND (SELECT has_permission FROM permissions_get_tasks         WHERE "user"                = (SELECT id FROM users                   WHERE uuid                         = (SELECT current_setting                                    ('gvmd.user.uuid')))           AND task = results.task)) AS oldest, (SELECT max (date) FROM results  WHERE nvt = vulns.uuid    AND (opts.report IS NULL OR results.report = opts.report)    AND (opts.task IS NULL OR results.task = opts.task)    AND (opts.host IS NULL OR results.host = opts.host)    AND (results.severity != -3.0)    AND (SELECT has_permission FROM permissions_get_tasks         WHERE "user"                = (SELECT id FROM users                   WHERE uuid                         = (SELECT current_setting                                    ('gvmd.user.uuid')))           AND task = results.task)) AS newest FROM vulns , (SELECT cast (null AS integer) AS task, cast (null AS integer) AS report, cast (null AS text) AS host, 70 AS min_qod) AS opts WHERE  t () AND (vuln_results (uuid, opts.task, opts.report,                    opts.host) > 0) AND (qod >= opts.min_qod) ORDER BY lower (name) ASC LIMIT 10 OFFSET 0;
md manage:WARNING:2020-09-25 08h38.26 UTC:554058: next: sql_exec_internal failed
md manage:WARNING:2020-09-25 08h38.28 UTC:554077: sql_exec_internal: PQexec failed: ERROR:  relation "vulns" does not exist
LINE 1: ...         AND task = results.task)) AS newest FROM vulns , (S...

Found the following in the issue below which might be related but not included in the atomic repos yet:

We have reports of “ERROR: relation “vulns” does not exist” that are hard to reproduce, and this may help.

1 Like

Got the same issue, this time without deleting a scan…

Restored snapshot and tried deleting a scan, after which this issue did not come back… So this issue might be unrelated to deleting a scan after all…

Anyone got any advice how to prevent this from happening or how to fix this in GVM-20.08?

Tx