Gmvd service not starting after Kali update

Hi,

my Kali system updated yesterday and from there on gvmd service ist not starting anymore. I checked entries from my gvmd.service and found one mismatch from what was written here

[Unit]
Description=Greenbone Vulnerability Manager daemon (gvmd)
After=network.target networking.service postgresql.service ospd-openvas.service
Wants=postgresql.service ospd-openvas.service
Documentation=man:gvmd(8)
ConditionKernelCommandLine=!recovery

[Service]
Type=forking
User=_gvm
Group=_gvm
PIDFile=/run/gvmd/gvmd.pid
RuntimeDirectory=gvmd
RuntimeDirectoryMode=2775
ExecStart=/usr/sbin/gvmd --osp-vt-update=/run/ospd/ospd.sock --listen-group=_gvm
Restart=always
TimeoutStopSec=10

According to greenbone documentation it must be

ExecStart=/usr/sbin/gvmd --osp-vt-update=/run/ospd/ospd-openvas.sock --listen-group=_gvm

Changed that in file, but gvmd still does not start. Permissions on /run/gvmd ist correct.

Any further ideas?

p.s.

when changing Type=exec I get this when starting gvmd

If you are using Type=exec you need to add --foreground to the ExecStart line:

ExecStart=/usr/sbin/gvmd --osp-vt-update=/run/ospd/ospd-openvas.sock --listen-group=_gvm --foreground

Perfect, Thanks. That fixed the start issue.

weird. gvmd was running for a few seconds and now restarted the service throws out activating

Could you check the log file for issues?

Seems to be a database issue

You need to update the data in postges. Please run

sudo -u _gvm gvmd --migrate

thanks. I will try later on

unfortunately no luck

It seems that pg-gvm postgres extension is not installed. Did you use Kali packages? Which version of our stack do you use?

1 Like

I’m running into the same problem with the community edition and logs that toddehb posted after updating Kali three days ago as well. In my case I used the version installed with Kali. gsad version is 22.04.0.

pg-gvm is installed

I am using the standard kali repositories

In our case the error was that after the system update postgres 15 was installed with pg-gvm but on a different port. Postgres 14 continued to run on the default port. It helped us to put postgres 15 on the default port and to disable postgres 14. Unfortunately, we then had to recreate all the data because the database is on the 14

Nice hint. Thanks. Wouldn’t it be possible to just export database from 14 and then do an import to 15? Or tell greenbone to just keep using 14?

@patzux

how did you disable postgresql 14? Can’t see any additional systemd startup files with /lib/systemd/system

Ok, found it myyself. Need to disable in start.conf. I put V15 on standard port 5432, but that does just shift errors

p.s running gvm-check-setup tells me that

What is confusinbg me is the fact, that postgresql 15 seems to run, but no port is aquired

systemctl stop and systemctl disable postgresql@14-main.service is an option.

I adjusted the port under /etc/postgresql/14/main/postgresql.conf and /etc/postgresql/15/main/postgresql.conf. Default port is 5432 (set it for postgres 15).

After that you can try gvm-setup. It should install gvm again but the database too

To the best of my knowledge this is not related to gvmd (the only relation is that gvmd is using PostgreSQL) but a standard thing which will happen once a Linux distribution (at least on Debian and Kali) is doing a major bump from one PostgreSQL version to another (this also happened in the past from v13 to v14 and now again from v14 to v15):

If this is the case the user needs to take action and “upgrade” the PostgreSQL database (e.g. the one currently containing the gvmd data) to the next version manually via pg_upgradecluster:

https://www.muehlencord.de/wordpress/2020/10/31/postgresql-pg_upgradecluster/

Kali should also have some documentation about this in the /usr/share/doc/postgresql* folders and AFAICT you should also get a note (at least on Debian) while updating the OS that an upgrade of PostgreSQL is required.

If documentation from Kali side is missing a request for them could be also done via https://bugs.kali.org/my_view_page.php

2 Likes

(just a quick moderator note that I’ve moved this to the Linux Distribution category)

2 Likes

Unfortunately I have to dig out this thread. Did an upgrade on my Kali machine today and afterwards logging into gsad is not possible anymore. Logs are pretty silent

2023-07-20T19:38:16.205770+02:00 kali systemd[1]: gvmd.service: Main process exited, code=exited, status=1/FAILURE
2023-07-20T19:38:16.205859+02:00 kali systemd[1]: gvmd.service: Failed with result 'exit-code'.
2023-07-20T19:38:16.386983+02:00 kali systemd[1]: gvmd.service: Scheduled restart job, restart counter is at 5.
2023-07-20T19:38:16.387190+02:00 kali systemd[1]: Stopped gvmd.service - Greenbone Vulnerability Manager daemon (gvmd).
2023-07-20T19:38:16.387241+02:00 kali systemd[1]: gvmd.service: Start request repeated too quickly.
2023-07-20T19:38:16.387286+02:00 kali systemd[1]: gvmd.service: Failed with result 'exit-code'.
2023-07-20T19:38:16.387315+02:00 kali systemd[1]: Failed to start gvmd.service - Greenbone Vulnerability Manager daemon (gvmd).

gvmd.service looks like this

[Unit]
Description=Greenbone Vulnerability Manager daemon (gvmd)
After=network.target networking.service postgresql.service ospd-openvas.service
Wants=postgresql.service ospd-openvas.service
Documentation=man:gvmd(8)
ConditionKernelCommandLine=!recovery

[Service]
Type=exec
User=_gvm
Group=_gvm
PIDFile=/run/gvmd/gvmd.pid
RuntimeDirectory=gvmd
RuntimeDirectoryMode=2775
#ExecStart=/usr/sbin/gvmd --osp-vt-update=/run/ospd/ospd.sock --listen-group=_gvm --foreground
ExecStart=/usr/sbin/gvmd --osp-vt-update=/run/ospd/ospd-openvas.sock --listen-group=_gvm --foreground
Restart=always
TimeoutStopSec=10

[Install]
WantedBy=multi-user.target

any ideas?