Connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory

Hi I am trying to install OpenVAS for the first time following this guide https://www.ceos3c.com/security/install-openvas-kali-linux/ I have been following along fine, I ran a sudo gvm-check-setup.

vm-check-setup 23.11.0
Test completeness and readiness of GVM-23.11.0
Step 1: Checking OpenVAS (Scanner)…
OK: OpenVAS Scanner is present in version 22.7.9.
OK: Notus Scanner is present in version 22.6.2.
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: the mqtt_server_uri is defined in /etc/openvas/openvas.conf
OK: _gvm owns all files in /var/lib/openvas/plugins
OK: NVT collection in /var/lib/openvas/plugins contains 88343 NVTs.
OK: The notus directory /var/lib/notus/products contains 456 NVTs.
Checking that the obsolete redis database has been removed
OK: No old Redis DB
OK: ospd-openvas service is active.
OK: ospd-OpenVAS is present in version 22.6.2.
Step 2: Checking GVMD Manager …
OK: GVM Manager (gvmd) is present in version 23.1.0.
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 …
OK: Postgresql version and default port are OK.
psql: error: connection to server on socket β€œ/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
Is the server running locally and accepting connections on that socket?
ERROR: The Postgresql DB does not exist.
FIX: Run β€˜sudo runuser -u postgres – /usr/share/gvm/create-postgresql-database’

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

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

I then ran the fix it suggested but got these errors.

sudo runuser -u postgres – /usr/share/gvm/create-postgresql-database
psql: error: connection to server on socket β€œ/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
Is the server running locally and accepting connections on that socket?

[*] Creating database user
createuser: error: connection to server on socket β€œ/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
Is the server running locally and accepting connections on that socket?
psql: error: connection to server on socket β€œ/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
Is the server running locally and accepting connections on that socket?

[*] Creating database
createdb: error: connection to server on socket β€œ/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
Is the server running locally and accepting connections on that socket?
psql: error: connection to server on socket β€œ/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
Is the server running locally and accepting connections on that socket?

[*] Creating permissions
psql: error: connection to server on socket β€œ/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
Is the server running locally and accepting connections on that socket?

[*] Applying permissions
psql: error: connection to server on socket β€œ/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
Is the server running locally and accepting connections on that socket?
psql: error: connection to server on socket β€œ/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
Is the server running locally and accepting connections on that socket?

[*] Creating extension uuid-ossp
psql: error: connection to server on socket β€œ/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
Is the server running locally and accepting connections on that socket?
psql: error: connection to server on socket β€œ/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
Is the server running locally and accepting connections on that socket?

[*] Creating extension pgcrypto
psql: error: connection to server on socket β€œ/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
Is the server running locally and accepting connections on that socket?
psql: error: connection to server on socket β€œ/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
Is the server running locally and accepting connections on that socket?

[*] Creating extension pg-gvm
psql: error: connection to server on socket β€œ/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
Is the server running locally and accepting connections on that socket?

Can anyone help please? It’s my first time installing OpenVAS and also have 0 experience with postgres. Thanks.

Hi,

it would be best to follow Kali Linux Install Guide - Greenbone Community Documentation instead and to look at Troubleshooting - Greenbone Community Documentation for your issue.

1 Like

Thanks. Managed to get a bit further now by restarting my kali server but getting the following error.

sudo runuser -u postgres – /usr/share/gvm/create-postgresql-database

[*] Creating database user

[*] Creating database

[*] Creating permissions
CREATE ROLE

[*] Applying permissions
GRANT ROLE

[*] Creating extension uuid-ossp
CREATE EXTENSION

[*] Creating extension pgcrypto
CREATE EXTENSION

[*] Creating extension pg-gvm
ERROR: extension β€œpg-gvm” is not available
DETAIL: Could not open extension control file β€œ/usr/share/postgresql/16/extension/pg-gvm.control”: No such file or directory.
HINT: The extension must first be installed on the system where PostgreSQL is running.

How do I install the extention? any ideas?

Ahh ok I ran this command β€œapt install postgresql-16-pg-gvm that seemed to work but now I have another error!
Step 5: Checking Postgresql DB and user …
OK: Postgresql version and default port are OK.
gvmd | _gvm | UTF8 | libc | en_GB.UTF-8 | en_GB.UTF-8 | | |
16440|pg-gvm|10|2200|f|22.6||
ERROR: No users found. You need to create at least one user to log in.
FIX: create a user by running β€˜sudo runuser -u _gvm – gvmd --create-user= --password=’

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

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

I run the fix however it doesn’t work.

sudo runuser -u _gvm – gvmd --create-user= --password=
zsh: parse error near `\n’

OK! managed to get it working using this command.
sudo runuser -u _gvm – gvmd --create-user=admin --password=β€˜β€™
User created.

Now all seems to be working. had to reset the admin password again for some reason but did that using the following command.

sudo -E -u _gvm -g _gvm gvmd --user=admin --new-password=NEW_PASSWD

Hi, could you please format your post according to Start Here - #3 by bricks ?

2 Likes