sudo -u postgres bash
cd
createuser -DRS gvm
createdb -O gvm gvmd
psql gvmd -c "create role dba with superuser noinherit; grant dba to gvm;"
exit
And here is proof
root@openvas:~# psql
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: role "root" does not exist
root@openvas:~# su postgres
postgres@openvas:/root$ psql
psql (16.3 (Ubuntu 16.3-0ubuntu0.24.04.1))
So the question would be who told gvmd to use root user to connect to database when dba role is created for user gvm and where.
One more thing to add, running pgsql 16 instead 15.