Unable to launch gvmd (sqlv: sql_exec_internal failed)

GVM versions

gsa: None
gvm: 20.04+alpha
openvas-scanner: 20.4+beta1
gvm-libs: master

Environment

Operating system: Debian 9.7
Kernel: 4.9.0-11-amd64
Installation method / source: make

##################################################

Dear all,

I’m currently compiling some Greenbone packages (versions listed above) via make on Debian 9.7.

The packages and compilation order is as follows:

  1. openvas-smb
  2. gmv-libs
  3. openvas
  4. gvmd

Everything seemed to be OK, until I tried to execute gvmd. The following error is listed in /var/log/gvm/gvmd.log

md main:MESSAGE:2019-10-10 16h50.39 utc:32305: Greenbone Vulnerability Manager version 20.04+alpha (DB revision 221)
md manage:WARNING:2019-10-10 16h50.39 utc:32306: sql_exec_internal: PQexec failed: ERROR: permission denied to set role “dba”
(7)
md manage:WARNING:2019-10-10 16h50.39 utc:32306: sql_exec_internal: SQL: SET role dba;
md manage:WARNING:2019-10-10 16h50.39 utc:32306: sqlv: sql_exec_internal failed

I am using the PostgreSQL DB as indicated in the docs:

Thank you in advance for your answer.

Kind regards.

Your user has no access to the role dba. See point 4. in the INSTALL docs.

1 Like

And additionally please do not use master branches. They are very very very likely to break all the time!

2 Likes

Thank you for your warning, @bricks.

In case I would like to compile the repositories listed in my first message, what “stable” versions should I use for Debian 9.7?

  1. openvas-smb --> master
  2. gmv-libs --> gvm-libs-11.0
  3. openvas --> openvas-7.0
  4. gvmd --> gvmd-9.0

Is this correct?

Kind regards.

Those are listed in the release announcement of the stable releases in GVM-10 (end-of-life, initial release 2019-04-05) - Greenbone Community Edition - Greenbone Community Forum

1 Like

I went through the PoststreSQL setup yesterday and I verified my user admin has access to the role dba (see below):

postgres@osboxes:/home/mysuser/projects/gvmd$ psql gvmd
psql (9.6.15)
Type “help” for help.

gvmd=# create role dba with superuser noinherit;
ERROR: role “dba” already exists
gvmd=# grant dba to admin;
NOTICE: role “admin” is already a member of role “dba”
GRANT ROLE
gvmd=# create extension “uuid-ossp”;
ERROR: extension “uuid-ossp” already exists

However, in the meantime a colleague of mine noticed I was using a regular user, instead of the Linux superuser.

Now everything works as expected. I can spawn gvmd and create/modify/delete objects like users, tasks, etc.

Thanks for your help @bricks and @cfi!

You should not run gvmd as root user. Please create a dedicated user for running gvmd.

2 Likes

i have the same problem like him… and i dont want to use root user, but i also followed the points from the install docs… Maybe know whats the problem? I use the new gvmd 9.0

@ayinuha,

The following worked for me:

Do as @bricks say. That means:

  1. Use a regular user for installation (do not use root).
  2. Once you have all the cloned repos locally, read the INSTALL.md files and follow the steps.
  3. If you do not know how to set up libraries/folder variables (DCMAKE_INSTALL_PREFIX, etc) before cmake/compilation, just use the suggested commands from the build folder.
$ cmake ..
$ make 
$ make install
  1. When running cmake, make or make install you will get some message stoppers, particularly if you have not set up the libraries/folder variables before running cmake/compilation. Some of them will look like can’t copy this file into there (during make install) or maybe missing packages. This is not blocking. Just give folder permissions and relaunch the command.

$ sudo chown -R <USER>:<GROUP> <YOUR_FOLDER>

  1. All the previous steps worked for me using the versions pointed out at GVM-10 (end-of-life, initial release 2019-04-05) - Greenbone Community Edition - Greenbone Community Forum.
  2. Maybe it is simpler if you use sqlite3 instead of postgresql during the first compilation.

Good luck :slight_smile:

Hello,

thanks for the fast answer, i will try it and give you than a feedback if its worked for me :slight_smile:
The problem is that i try to install the gvm11 over the gvm10 which was already running… I dont know if thats a good idea… but ye… i will see… :smiley:

@victor.sanchez
i installed it now again step by step till to the step with the postgresql… but i wonder why i have to edit now sth in the postgresql settings… with gvm 10 i just installed it and doesnt make anything with postgres…

atm i have this error in the gvmd.log:

md main:MESSAGE:2019-10-15 12h38.09 utc:30120: Greenbone Vulnerability Manager version 9.0.0 (DB revision 221)
md manage:WARNING:2019-10-15 12h38.09 utc:30121: sql_open: PQconnectPoll failed
md manage:WARNING:2019-10-15 12h38.09 utc:30121: sql_open: PQerrorMessage (conn): FATAL: role “user” does not exist
md manage:WARNING:2019-10-15 12h38.09 utc:30121: init_manage_process: sql_open failed

i try now the postgresql steps from the install.md.
Do you maybe know if i have to name the user like my “login” user?
image
i dont know if it can be come to complications cause my login username is “user”?

I used this command for cmake:
cmake -DCMAKE_INSTALL_PREFIX=/home/user/install …

for the libraries variables i have used in gvm10 this:
LD_LIBRARY_PATH=:/home/user/install/lib/
PATH=/home/user/.local/bin:/home/user/install/bin:/home/user/install/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PKG_CONFIG_PATH=/home/user/install/lib/pkgconfig

so that you dont get wrong, i have a working GVM10 Setup, but because GVM11 is released i try to “update” it with install the new version GVM11 over the old setup. In the old Setup i dont had to create a postgres user/db… So i wonder why i have to do that now.

and sqlite is not supported with gvm11

@ayinuha

I have not managed to compile it with gvmd11, so I cannot give you an answer on that. You better ask the dev team.

Kind regards.

okay, thank you anyway.

@bricks you can maybe help me?

okay… i renamed now my username and installed greenbone for the new user… now the postgres setup works… but now its make again a new error… if i try to start gvmd i see this error in the log:

md main:MESSAGE:2019-10-16 06h10.22 utc:3965: Greenbone Vulnerability Manager version 9.0.0 (DB revision 221)
md manage:WARNING:2019-10-16 06h10.22 utc:3966: sql_exec_internal: PQexec failed: ERROR: could not load library “/home/gvm/install/lib/libgvm-pg-server.so”: libgvm_base.so.11: cannot open shared object file: No such file or directory
(7)
md manage:WARNING:2019-10-16 06h10.22 utc:3966: sql_exec_internal: SQL: CREATE OR REPLACE FUNCTION hosts_contains (text, text) RETURNS boolean AS ‘/home/gvm/install/lib/libgvm-pg-server’, ‘sql_hosts_contains’ LANGUAGE C IMMUTABLE;
md manage:WARNING:2019-10-16 06h10.22 utc:3966: sqlv: sql_exec_internal failed

For me it seems you are not very familiar with unix groups/permissions, postgres setup and building C code from source. Therefore I would recommend to use packages from a distribution or alternatively our community edition.

The solution for your problem is listed in the INSTALL.md document of gvmd

Ye okay, i found few time ago the solution to create d gvmd.conf file in ld.so.conf.d where i have to put the libary path in.

If you don’t know what you are doing and adding library path to it, you really put your system at security risks. I would strongly advice you to use a sane system.

This means YOU MUST NOT USE THIS SETUP IN PRODUCTION.

1 Like

@Lukas @bricks Okay… But i dont understand in what way i should fix my problem then… Especially since it is so in the install.md

or does that mean sth different?

It’s not clearly stated in the docs but changing your ld.so.conf has serious security implications and should not be done on hosts used in production setups. It’s only intended for short term testing or development.