What is the issue while running the gvm python library?

Hi @bricks,

I am trying the python-gvm library. But while running the code that has basic code of printing the version, I am seeing the below error. What am I missing here?

Traceback (most recent call last):
File “/home/user/OpenVasTools/./openVasTest.py”, line 8, in
with Gmp(connection=connection) as gmp:
File “/usr/local/lib/python3.10/dist-packages/gvm/protocols/base.py”, line 51, in enter
File “/usr/local/lib/python3.10/dist-packages/gvm/protocols/base.py”, line 107, in connect
File “/usr/local/lib/python3.10/dist-packages/gvm/connections.py”, line 464, in connect
self._socket.connect((self.hostname, int(self.port)))
File “/usr/lib/python3.10/ssl.py”, line 1375, in connect
self._real_connect(addr, False)
File “/usr/lib/python3.10/ssl.py”, line 1362, in _real_connect
ConnectionRefusedError: [Errno 111] Connection refused

Please let me know if I need to provide any details. I have logged into the Ubuntu 22.04 VM and have not logged in as a root.

This is my code:

#!/usr/bin/env python3
import gvm
from gvm.connections import TLSConnection
from gvm.protocols.latest import Gmp

connection = gvm.connections.TLSConnection(hostname=‘<IP Address of the logged in server/ the IP address of the VM where we have installed the Greenbone Community Edition application.>’)
with Gmp(connection=connection) as gmp:
version = gmp.get_version()



the connection could not be established. That’s it. You tried to connect via TLS which requires to setup the gvmd service accordingly. Normally this means you need to take a look at gvmd --help for the TLS related arguments and to adjust the gvmd.service file to add additional arguments.

Alternatively you can change the connection to use the unix socket if the code is running on the same machine as gvmd. This is much easier to handle by the way.


Thanks @bricks for your response. I tried the UnixSocketConnection as well but I don’t see the socket connection or the .socket file in the /run location. I don’t even see the gvmd folder under run folder. Is there something I am doing wrong? Can you please me here?

Thanks in advance!

How did you install the Greenbone Community Edition? The socket location of course depends on the installations method and which paths the maintainer of the installation method/docs/packages/… did choose. The default is /run/gvmd/gvmd.sock. Did you also check if gvmd is running at all?

1 Like

Hi @bricks,

We installed by following the steps mentioned in the URL https://greenbone.github.io/docs/latest/22.4/container/index.html#. We have executed all the steps mentioned in the instruction.

The gvmd services are not running in the server. Do I need to run anything steps of creating the directories and providing the permissions to the directories?


No you just need to follow the docs step by step carefully.

What’s the error output of /var/log/gvm/gvmd.log when you try starting the gvmd service?

1 Like

Ok. Let me ask the basic question here. Since I did the container based installation, just running the command mentioned in the Installation steps is enough (I assume just one command)? Or Do I need to follow any other command?

Or is there any specific command just to run gvmd services? I assume sudo systemctl enable gvmd is a manual command.

Regarding the /var/log/gvm/gvmd.log I do not see anything. Here is the snap of the log file directory. I assume the permissions should have been taken care with the Container based installation.


If you are using our guide just follow the steps in the docs https://greenbone.github.io/docs/latest/ It’s all there.

That command is for auto starting the service on your system startup (after a reboot). To actually start the service now you need to run sudo systemctl start gvmd.

If gvmd is not starting or running correctly there must be some error messages in /var/log/gvm/gvmd.log.

Btw. if that’s the content of you /var/log/gvm directory you are not following our docs and instead are most likely using some Kali installation.

To avoid confusion, it seems it is currently not fully clear if this is a docker based setup or a source installation:

The OP is writing in What is the issue while running the gvm python library? - #5 by sshastry and in a following comment that the docker based container setup is used while some systemctl commands are used in later comments which doesn’t apply for the docker based container setup.

Maybe something is mixed up here?

I have followed the steps mentioned in the Container based installation using the same link. Still it did not star gvmd. I am able to work with the OpenVAS GUI with out any issues.

I was able to run the command and it failed to start the service. Is there any other dependent command to run? The log file info is as in the snippet below when I ran the command manually.

I have used the Container based installation for setting up the application on the Ubuntu 22.04 VM.

I have asked about the systemctl commands because I can try manual running of the command to bring up gvmd since Brics has mentioned that the gvmd service need to be up and running.

Not sure if the container setup has been followed because the screenshot of the logs shows that version 21.4.4 of the manager daemon is used while the docker container version is already at 22.4.2.

Or the logs are from a side-by-side installation of the GVM stack originating from a package based installation of the GVM stack of the Ubuntu maintained packages (which are outdated, in a at least partly non-working state and not maintained by Greenbone).

We have installed the application during October/November 2022. Do we need to update to the latest version? if yes, can you please share us the commands for upgradation?

Unfortunately i don’t have any knowledge to give support for such topics, especially as i also don’t now which of the installations is the “active” / productive one.

For now i can only suggest to first decide which of the deployment variant you want to use:

  1. Docker / container based installation (https://greenbone.github.io/docs/latest/22.4/container/index.html)
  2. Source based installation (https://greenbone.github.io/docs/latest/22.4/source-build/index.html)
  3. Ubuntu package based installation
    • Note: Strongly discouraged as it will install an EOL version and in a possible not working state
  4. Greenbone Enterprise TRIAL (https://www.greenbone.net/en/testnow/)

and then stick on that while cleaning up the system from possible remains of the mixed usage of other installation methods