gvm.errors.GvmError: Socket /var/run/gvmd.sock does not exist

Hello,

I’ve installed the gvm-tools (with pip3) but when I try to run the gvm-pyshell in socket mode I get this error:

gvm.errors.GvmError: Socket /var/run/gvmd.sock does not exist

Any hint about how to fix it?

"/opt/gvm/.local/bin/gvm-pyshell", line 10, in <module> sys.exit(main()) File "/opt/gvm/.local/lib/python3.7/site-packages/gvmtools/pyshell.py", line 134, in main with protocol_class(connection, transform=transform) as protocol: File "/opt/gvm/.local/lib/python3.7/site-packages/gvm/protocols/gmp.py", line 79, in __enter__ self.connect() File "/opt/gvm/.local/lib/python3.7/site-packages/gvm/protocols/base.py", line 107, in connect self._connection.connect() File "/opt/gvm/.local/lib/python3.7/site-packages/gvm/connections.py", line 353, in connect ) from None gvm.errors.GvmError: Socket /var/run/gvmd.sock does not exist

There is no gvmd.sock in the whole system. I can only see the ospd.sock:

root@8b480bba09e3:/# ls -l /opt/gvm/var/run/
total 12

-rw-r--r-- 1 root root 4 Jan  8 15:45 gsad.pid
-rw------- 1 gvm  gvm  0 Jan  2 11:56 gvm-checking
-rw------- 1 gvm  gvm  0 Jan  2 11:56 gvm-create-functions
-rw------- 1 gvm  gvm  0 Jan  2 11:56 gvm-helping
-rw------- 1 gvm  gvm  0 Jan  2 11:56 gvm-migrating
-rw------- 1 gvm  gvm  0 Jan  2 11:57 gvm-serving
-rw------- 1 gvm  gvm  4 Jan  8 15:46 gvmd.pid
-rw-r--r-- 1 gvm  gvm  3 Jan  8 15:45 ospd-openvas.pid
srwx------ 1 gvm  gvm  0 Jan  8 15:47 ospd.sock

It seems gvmd is running in some way:

root@8b480bba09e3:/# ps axjf
 PPID   PID  PGID   SID TTY      TPGID STAT   UID   TIME COMMAND
    0 25012 25012 25012 pts/0    26533 Ss       0   0:00 /bin/bash
25012 26533 26533 25012 pts/0    26533 R+       0   0:00  \_ ps axjf
    0     1     1     1 ?           -1 Ss       0   0:00 /bin/sh -c /entrypoint.sh
    1     6     1     1 ?           -1 S        0   0:00 /bin/bash /entrypoint.sh
    6   120     1     1 ?           -1 S        0   0:00  \_ tail -F /opt/gvm/var/log/gvm/gsad.log /opt/gvm/var/log/gvm/gvmd.log /opt/gvm/v
    1    26    26    26 ?           -1 Ssl    103   9:13 /usr/bin/redis-server 127.0.0.1:0
    1    58    55    55 ?           -1 S      104   0:12 /usr/lib/postgresql/11/bin/postgres -D /var/lib/postgresql/11/main -c config_file=
   58    60    60    60 ?           -1 Ss     104   0:11  \_ postgres: 11/main: checkpointer
   58    61    61    61 ?           -1 Ss     104   0:01  \_ postgres: 11/main: background writer
   58    62    62    62 ?           -1 Ss     104   0:22  \_ postgres: 11/main: walwriter
   58    63    63    63 ?           -1 Ss     104   0:01  \_ postgres: 11/main: autovacuum launcher
   58    64    64    64 ?           -1 Ss     104   0:19  \_ postgres: 11/main: stats collector
   58    65    65    65 ?           -1 Ss     104   0:00  \_ postgres: 11/main: logical replication launcher
   58   148   148   148 ?           -1 SLs    104   0:23  \_ postgres: 11/main: gvm gvmd [local] idle
   58 26530 26530 26530 ?           -1 Ss     104   0:00  \_ postgres: 11/main: gvm gvmd [local] idle
    1   101    99    99 ?           -1 S     1000   0:45 gvmd: Waiting for incoming connections
  101 26525    99    99 ?           -1 S     1000   0:00  \_ gvmd: Reloading NVTs
26525 26527    99    99 ?           -1 S     1000   0:00      \_ gvmd: OSP: Updating NVT cache

but the log refers only to ospd.sock:

root@8b480bba09e3:/# cat ./opt/gvm/var/log/gvm/gvmd.log | grep .sock
md manage:WARNING:2020-01-02 10h01.18 utc:217: manage_update_nvt_cache_osp: failed to connect to /opt/gvm/var/run/ospd.sock       
md manage:WARNING:2020-01-02 11h57.02 utc:195: manage_update_nvt_cache_osp: failed to connect to /opt/gvm/var/run/ospd.sock
md manage:WARNING:2020-01-02 11h57.12 utc:206: manage_update_nvt_cache_osp: failed to connect to /opt/gvm/var/run/ospd.sock
md manage:WARNING:2020-01-02 11h57.22 utc:211: manage_update_nvt_cache_osp: failed to connect to

Did you check other locations? it depends on your installation (check: https://readthedocs.org/projects/gvm-tools/downloads/pdf/latest/). Is your manager up and running?

1 Like

Yes it’s up and running. There is something I don’t understand: When is usually the socket created? During the installation? Or When the process starts?

My understanding is that the manager is responsible for creating it, depending on whether you use unix socket or tls authentication.

1 Like

Where the socket is created depends on your build parameters and settings for gvmd. If you want to adjust the socket location you can use

-c, --unix-socket=<filename>                  Listen on UNIX socket at <filename>.

The unix socket is created by gvmd after startup automatically.

2 Likes

Hello, same issue here.
I can communicate using osp (ospd.sock does exist) but gvmd.sock doesn’t exist.
I tried touch gvmd.sock , then chmod 777 gmvd.sock and i got a Errno 111 ( i know its not the proper way to do it ) any info will be appriciated

regards

The path to the gvmd socket depends on your installation method. If you got gvmd via packages it should be placed under /var/run/gvmd.sock. gvmd will create the socket at startup if it isn’t configured to use TLS connections. If you need different socket settings e.g. different path or permissions please take a look at the parameters shown with --help and adjust your startup configurations. These configurations are distribution and package specific. Most of the time systemd service files are used.

2 Likes

Thanks for the fast reply!.
I’m using this one https://github.com/Secure-Compliance-Solutions-LLC/GVM-Docker
and i have tried either dockerized and not(with some script adjusting).
From my understanding since i’m a newbie i cant use osp protocol to initiate scans through python-scripting yet, therefore i need to use gvmd.sock to use the GMP protocol
Through the docker container i can detect gvmd.sock , but at /tmp only ospd.sock exists && and its not in /var/run either.

root@7c257acafc4a:~# ps axjf
 PPID   PID  PGID   SID TTY      TPGID STAT   UID   TIME COMMAND
    0  1066  1066  1066 pts/0     2937 Ss       0   0:00 /bin/bash
 1066  2937  2937  1066 pts/0     2937 R+       0   0:00  \_ ps axjf
    0     1     1     1 ?           -1 Ss       0   0:00 /bin/sh -c '/start.sh'
    1     9     1     1 ?           -1 S        0   0:00 bash /start.sh
    9   294     1     1 ?           -1 S        0   0:00  \_ tail -F /usr/local/var/log/gvm/gsad.log /usr/local/var/log/gvm/gvmd.log /usr/local/var/log/gvm/openvas.log /usr/local/var/log/gvm/ospd-openvas.log
    1    12    12    12 ?           -1 Ssl      0   0:28 redis-server 0.0.0.0:6379
    1    22    19    19 ?           -1 S      102   0:00 /usr/lib/postgresql/10/bin/postgres -D /var/lib/postgresql/10/main -c config_file=/etc/postgresql/10/main/postgresql.conf
   22    24    24    24 ?           -1 Ss     102   0:00  \_ postgres: 10/main: checkpointer process   
   22    25    25    25 ?           -1 Ss     102   0:00  \_ postgres: 10/main: writer process   
   22    26    26    26 ?           -1 Ss     102   0:00  \_ postgres: 10/main: wal writer process   
   22    27    27    27 ?           -1 Ss     102   0:00  \_ postgres: 10/main: autovacuum launcher process   
   22    28    28    28 ?           -1 Ss     102   0:00  \_ postgres: 10/main: stats collector process   
   22    29    29    29 ?           -1 Ss     102   0:00  \_ postgres: 10/main: bgworker: logical replication launcher   
   22   270   270   270 ?           -1 Ss     102   0:07  \_ postgres: 10/main: gvm gvmd [local] idle
   22   274   274   274 ?           -1 Ss     102   0:00  \_ postgres: 10/main: gvm gvmd [local] idle
   22  2935  2935  2935 ?           -1 Ss     102   0:00  \_ postgres: 10/main: gvm gvmd [local] idle
    1   132     1     1 ?           -1 Sl       0   1:23 /usr/bin/python3 /usr/local/bin/ospd-openvas --log-file /usr/local/var/log/gvm/ospd-openvas.log --unix-socket /tmp/ospd.sock --log-level INFO
  132  1672     1     1 ?           -1 Sl       0   0:00  \_ /usr/bin/python3 /usr/local/bin/ospd-openvas --log-file /usr/local/var/log/gvm/ospd-openvas.log --unix-socket /tmp/ospd.sock --log-level INFO
    1   227   225   225 ?           -1 SL    1001   0:02 gvmd: Waiting for incoming connections
  227   272   225   225 ?           -1 R     1001  35:15  \_ gvmd: Syncing SCAP
  227  2930   225   225 ?           -1 S     1001   0:00  \_ gvmd: Reloading NVTs
 2930  2934   225   225 ?           -1 S     1001   0:00      \_ gvmd: OSP: Updating NVT cache
    1   264   264   264 ?           -1 Ss    1001   0:00 gpg-agent --homedir /usr/local/var/lib/gvm/gvmd/gnupg --use-standard-socket --daemon
    1   293   291   291 ?           -1 Sl    1001   0:00 gsad --verbose --http-only --no-redirect --port=9392

Any help will be appreciated, thanks in advance!

I really don’t have a clue about the docker instance. Please ask the maintainers for further information.

i see,
i am correct about not trying to initiate a scan using OSP protocol rather than GMP right?
thank you for your time!

OSP is the protocol used between gvmd and osp scanner especially ospd-openvas. gvmd stores, manages and evaluates the data provided by the scanners via OSP. GMP is the protocol used as our public API and also between gsad and gvmd. So this depends on your use case.

1 Like

This is what I was missing!
I wasn’t able to find the socket because TLS connection was configured!
Thank you very very much!