View Issue Details

IDProjectCategoryView StatusLast Update
0006816Kali Linux[All Projects] Tool Upgradepublic2020-11-16 14:53
Reportersecuhiro Assigned Tosbrun  
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
Product Version2020.3 
Target VersionFixed in Version 
Summary0006816: Problem about postgresql with GVM Install & setting on kali linux 2020.3
DescriptionI am trying GVM GVM Install & setting on kali linux 2020.3.
Then I was able to install by sudo apt install -y gvm without any error

But sudo gvm-setup does not work fine. and got below error
ERROR: The default postgresql version is not 13 required by libgvmd
Error: Use pg_upgradecluster to update your postgres cluster

So I tried “which postgresql” to know the path of bindir.
But no result(empty).
Also tried “dpkg -l | grep postgresql”, then looks like version 13 has already installed like attached file.

I am no idea how to solve it.
I am appreciated if you give me some more advice

Activities

secuhiro

2020-11-02 08:24

reporter  

sbrun

2020-11-03 07:56

manager   ~0013620

Run 'pg_lsclusters' to check the postgresql clusters

To use GVM you need to have Postgresql 13 associated to the default port 5432.

If the port 5432 is associated to an other Postgresql version, you need to run
pg_upgradecluster to update your postgresql cluster as mentioned in the output.

You can find more information about pg_upgradecluster with 'man pg_upgradecluster'

prinziple

2020-11-04 04:32

reporter   ~0013626

Yes , I have same problem to. Kali 2020.03 x64
5.8.0-kali3-amd64 0000001 SMP Debian 5.8.14-1kali1 (2020-10-13) x86_64 GNU/Linux

prinziple@prinziple:~$ sudo gvm-check-setup
gvm-check-setup 1.0.0
  Test completeness and readiness of GVM-11
Step 1: Checking OpenVAS (Scanner)...
        OK: OpenVAS Scanner is present in version 7.0.1.
        OK: Server CA Certificate is present as /var/lib/gvm/CA/servercert.pem.
Checking permissions of /var/lib/openvas/gnupg/*
        OK: _gvm owns all files in /var/lib/openvas/gnupg
        OK: redis-server is present.
        OK: scanner (db_address setting) is configured properly using the redis-server socket: /var/run/redis-openvas/redis-server.sock
        OK: redis-server is running and listening on socket: /var/run/redis-openvas/redis-server.sock.
        OK: redis-server configuration is OK and redis-server is running.
        OK: _gvm owns all files in /var/lib/openvas/plugins
        OK: NVT collection in /var/lib/openvas/plugins contains 63043 NVTs.
Checking that the obsolete redis database has been removed
        OK: No old Redis DB
        OK: OpenVAS Scanner is present in version 1.0.1.
Step 2: Checking GVMD Manager ...
        OK: GVM Manager (gvmd) is present in version 9.0.1.
Step 3: Checking Certificates ...
        OK: GVM client certificate is valid and present as /var/lib/gvm/CA/clientcert.pem.
        OK: Your GVM certificate infrastructure passed validation.
Step 4: Checking data ...
        OK: SCAP data found in /var/lib/gvm/scap-data.
        OK: CERT data found in /var/lib/gvm/cert-data.
Step 5: Checking Postgresql DB and user ...
        ERROR: The default postgresql version is not the one used for gvmd compilation: (12, need 13).
        FIX: Please use pg_upgradecluster to upgrade your postgresql installation

 ERROR: Your GVM-11 installation is not yet complete!

Please follow the instructions marked with FIX above and run this
script again.


prinziple@prinziple:~$ pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
12 main 5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
13 main 5433 online postgres /var/lib/postgresql/13/main /var/log/postgresql/postgresql-13-main.log


prinziple@prinziple:~$ ls -lh /var/log/postgresql/
total 28K
-rw-r----- 1 postgres adm 0 Nov 4 10:54 postgresql-12-main.log
-rw-r----- 1 postgres adm 4.5K Nov 4 10:54 postgresql-12-main.log.1
-rw-r----- 1 postgres adm 451 Oct 16 10:00 postgresql-12-main.log.2.gz
-rw-r----- 1 postgres adm 571 Oct 1 00:00 postgresql-12-main.log.3.gz
-rw-r----- 1 postgres adm 2.6K Sep 2 16:19 postgresql-12-main.log.4.gz
-rw-r----- 1 postgres adm 4.7K Nov 4 11:08 postgresql-13-main.log




prinziple@prinziple:~$ sudo cat /var/log/postgresql/postgresql-12-main.log.1
2020-11-02 14:08:45.722 +07 [15041] LOG: starting PostgreSQL 12.4 (Debian 12.4-3) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.0-13) 10.2.0, 64-bit
2020-11-02 14:08:45.722 +07 [15041] LOG: listening on IPv6 address "::1", port 5432
2020-11-02 14:08:45.722 +07 [15041] LOG: listening on IPv4 address "127.0.0.1", port 5432
2020-11-02 14:08:45.726 +07 [15041] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-11-02 14:08:45.748 +07 [15043] LOG: database system was shut down at 2020-10-15 17:26:42 +07
2020-11-02 14:08:45.758 +07 [15041] LOG: database system is ready to accept connections
2020-11-02 14:08:47.933 +07 [15096] _gvm@gvmd ERROR: incompatible library "/usr/lib/libgvm-pg-server.so": version mismatch
2020-11-02 14:08:47.933 +07 [15096] _gvm@gvmd DETAIL: Server is version 12, library is version 13.
2020-11-02 14:08:47.933 +07 [15096] _gvm@gvmd STATEMENT: CREATE OR REPLACE FUNCTION hosts_contains (text, text) RETURNS boolean AS '/usr/lib/libgvm-pg-server', 'sql_hosts_contains' LANGUAGE C IMMUTABLE;
2020-11-02 14:09:46.301 +07 [15358] root@gvmd FATAL: role "root" does not exist
2020-11-02 14:10:39.342 +07 [15730] root@gvmd FATAL: role "root" does not exist
2020-11-02 14:10:57.390 +07 [15756] _gvm@gvmd ERROR: incompatible library "/usr/lib/libgvm-pg-server.so": version mismatch
2020-11-02 14:10:57.390 +07 [15756] _gvm@gvmd DETAIL: Server is version 12, library is version 13.
2020-11-02 14:10:57.390 +07 [15756] _gvm@gvmd STATEMENT: CREATE OR REPLACE FUNCTION hosts_contains (text, text) RETURNS boolean AS '/usr/lib/libgvm-pg-server', 'sql_hosts_contains' LANGUAGE C IMMUTABLE;
2020-11-02 14:13:37.233 +07 [15938] _gvm@gvmd ERROR: incompatible library "/usr/lib/libgvm-pg-server.so": version mismatch
2020-11-02 14:13:37.233 +07 [15938] _gvm@gvmd DETAIL: Server is version 12, library is version 13.
2020-11-02 14:13:37.233 +07 [15938] _gvm@gvmd STATEMENT: CREATE OR REPLACE FUNCTION hosts_contains (text, text) RETURNS boolean AS '/usr/lib/libgvm-pg-server', 'sql_hosts_contains' LANGUAGE C IMMUTABLE;
2020-11-02 14:15:58.138 +07 [16078] _gvm@gvmd ERROR: incompatible library "/usr/lib/libgvm-pg-server.so": version mismatch
2020-11-02 14:15:58.138 +07 [16078] _gvm@gvmd DETAIL: Server is version 12, library is version 13.
2020-11-02 14:15:58.138 +07 [16078] _gvm@gvmd STATEMENT: CREATE OR REPLACE FUNCTION hosts_contains (text, text) RETURNS boolean AS '/usr/lib/libgvm-pg-server', 'sql_hosts_contains' LANGUAGE C IMMUTABLE;
2020-11-02 14:20:07.983 +07 [16224] _gvm@gvmd ERROR: incompatible library "/usr/lib/libgvm-pg-server.so": version mismatch
2020-11-02 14:20:07.983 +07 [16224] _gvm@gvmd DETAIL: Server is version 12, library is version 13.
2020-11-02 14:20:07.983 +07 [16224] _gvm@gvmd STATEMENT: CREATE OR REPLACE FUNCTION hosts_contains (text, text) RETURNS boolean AS '/usr/lib/libgvm-pg-server', 'sql_hosts_contains' LANGUAGE C IMMUTABLE;
2020-11-02 14:28:00.390 +07 [16474] prinziple@postgres FATAL: role "prinziple" does not exist
2020-11-02 14:28:00.391 +07 [16475] prinziple@template1 FATAL: role "prinziple" does not exist
2020-11-02 14:31:18.367 +07 [15041] LOG: received fast shutdown request
2020-11-02 14:31:18.371 +07 [15041] LOG: aborting any active transactions
2020-11-02 14:31:18.374 +07 [15041] LOG: background worker "logical replication launcher" (PID 15049) exited with exit code 1
2020-11-02 14:31:18.374 +07 [15044] LOG: shutting down
2020-11-02 14:31:18.392 +07 [15041] LOG: database system is shut down
2020-11-02 14:31:18.555 +07 [16736] LOG: starting PostgreSQL 12.4 (Debian 12.4-3) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.0-13) 10.2.0, 64-bit
2020-11-02 14:31:18.556 +07 [16736] LOG: listening on IPv6 address "::1", port 5432
2020-11-02 14:31:18.556 +07 [16736] LOG: listening on IPv4 address "127.0.0.1", port 5432
2020-11-02 14:31:18.560 +07 [16736] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-11-02 14:31:18.578 +07 [16739] LOG: database system was shut down at 2020-11-02 14:31:18 +07
2020-11-02 14:31:18.585 +07 [16736] LOG: database system is ready to accept connections
2020-11-02 15:13:53.196 +07 [16736] LOG: received fast shutdown request
2020-11-02 15:13:53.198 +07 [16736] LOG: aborting any active transactions
2020-11-02 15:13:53.200 +07 [16736] LOG: background worker "logical replication launcher" (PID 16751) exited with exit code 1
2020-11-02 15:13:53.200 +07 [16746] LOG: shutting down
2020-11-02 15:13:53.219 +07 [16736] LOG: database system is shut down

fl0rentin

2020-11-16 14:53

reporter   ~0013684

Hello, i've faced the same problem (i'm an "system/infosec learner" actually so maybe this solution is not fully right but it seems working and can also help someone else maybe for investigate further)

1. Stop pg_clusters
sudo pg_dropcluster 12 main --stop
sudo pg_dropcluster 13 main --stop

2. Be sure all clusters are deleted
sudo pg_lsclusters

3. Relunch gvm setup
sudo gvm-check-setup

4. Create pgsql with version 13 and start it
sudo pg_createcluster 13 main
sudo pg_ctlcluster 13 main start

5. Act on pqsql db and create user
sudo runuser -u postgres -- /usr/share/gvm/create-postgresql-database
sudo runuser -u _gvm -- gvmd --create-user=admin --password=<your_password_not_mine_obviously>

6. Last checks
sudo gvm-check-setup
sudo gvm-start

```
maduser01@attacker:~$ uname -a
Linux attacker 5.9.0-kali1-amd64 0000001 SMP Debian 5.9.1-1kali2 (2020-10-29) x86_64 GNU/Linux
```
```
maduser01@attacker:~$ systemctl status gvmd.service
● gvmd.service - Open Vulnerability Assessment System Manager Daemon
     Loaded: loaded (/lib/systemd/system/gvmd.service; disabled; vendor preset: disabled)
     Active: active (running) since Mon 2020-11-16 15:26:07 CET; 26min ago
       Docs: man:gvmd(8)
             https://www.greenbone.net
   Main PID: 12942 (gvmd)
      Tasks: 3 (limit: 5230)
     Memory: 1.3G
     CGroup: /system.slice/gvmd.service
             ├─12942 gvmd: Waiting for incoming connections
             ├─12962 gpg-agent --homedir /var/lib/gvm/gvmd/gnupg --use-standard-socket --daemon
             └─15469 gvmd: Syncing SCAP: Updating OVALdefs
```

Let me know if it can help you or not !

Have a g00d day !

Issue History

Date Modified Username Field Change
2020-11-02 08:24 secuhiro New Issue
2020-11-02 08:24 secuhiro Status new => assigned
2020-11-02 08:24 secuhiro Assigned To => sbrun
2020-11-02 08:24 secuhiro File Added: 5e43f235ac3c51f4a066b0300fe59afc4ca04743_2_690x160.png
2020-11-03 07:56 sbrun Note Added: 0013620
2020-11-04 04:32 prinziple Note Added: 0013626
2020-11-16 14:53 fl0rentin Note Added: 0013684