After configuring services, gvmd and gsad wouldnt start because they didnt have access to /run/gvm/gsad(or gvmd).pid (sadly there werent any topics that could resolve it, they had different matters at hand or just said “fix permission”, but the permissions to the /run/gvm folders were correct and done according to the docs) I tried reinstalling another ubuntu vm, same problem, switched to debian, same problem.
For those having the same issue, here is a quick summary for my “fix”:
During the part in the docs where you create the service with “cat << EOF > $BUILD_DIR/gvmd.service”, replace “PIDFile=/run/gvm/gvmd.pid” with “PIDFILE=/run/gvmd/gvmd.pid”
Do the same for the gsad service (replacing gvmd with gsad of course)
I am pretty certain I followed the docs precisely, so my question is if there is anything wrong with the docs or are they just not updated for newer versions, or is this some other issue entirely?
I am trying to prevent some headache for others facing the same issue and I want to make sure everything in the docs and version compatablity is right.
OS: Debian 11
gsad: 21.4.4
gvmd: 21.4.5
openvas: 21.4.4
open-lib: 21.4.4
postgresql: 13 (postgresql11 is used by the docs, but apt install on debian gets me 13, so 13 it is)
Yes the directories are removed and created automatically by systemd. But nevertheless you have been right about the paths. It should be /run/gvmd and /run/gsad. I’ve updated the docs accordingly just now.
Thank you for the quick reply and edit!
I think the gsad service in the docs still is missing something, for me it would still error because it cant access /run/gsad/gsad.pid, understandable, because the directory wasnt there, systemd probably didnt create it.
I think I “fixed” it by adding:
RuntimeDirectory=gsad
RuntimeDirectoryMode=2775
I dont have much linux experience, so take this with many grains of salt.
Also, since I have you here, i dont know if it will help anyone, but I certainly overlooked one thing when using "gvmd --modify-setting 78eceaec-3385-11ea-b237-28d24461215b --value gvmd --get-users --verbose | grep admin | awk '{print $2}'", could you add a disclaimer that you may need to run
/usr/local/sbin/gvmd --modify-setting 78eceaec-3385-11ea-b237-28d24461215b --value /usr/local/sbin/gvmd --get-users --verbose | grep admin | awk '{print $2}'" instead in case gvmd returns an error/ isnt found? I dont want to be too pushy making suggesstions, thank you for your help and work!
In file “source/gsad-21.4.4/config/gsad.service.in”, environment variable GSAD_PID_DIR is expected in the PIDFile value, but is nowhere defined in the documentation, hence the PIDFile will end up being “/gsad.pid” with no permission, understandably.
In file “source/ospd-openvas-21.4.4/config/ospd-openvas.service”, the PIDFile path is hardcoded. This works, but maybe should depend on an environment variable, for sake of consistency?
In file “source/gvmd-21.4.5/config/gvmd.service.in”, variable GVM_RUN_DIR is used and is defined with value “/run/gvm” in the documentation, which is fine per se, but variable definition “GVMD_RUN_DIR=/run/gvmd” is used in section “Building gsad”, hence gsad will not find the gvmd pid file in /run/gvm/gvmd, when starting.
I followed the updated guide by @bricks but gsad service still won’t start. I’m trying this on ubuntu 20.04
ubuntu@server:~$ sudo systemctl start gsad
Job for gsad.service failed because a timeout was exceeded.
See "systemctl status gsad.service" and "journalctl -xe" for details.
ubuntu@server:~$ journalctl -xe
...
May 22 07:58:59 server systemd[1]: gsad.service: Can't open PID file /run/gsad/gsad.pid (yet?) after start: Operation not permitted
Hmm seems to be a bit strange. Could you please check the permissions of /run/gsad/? And also if that directory is or is not available after you stopped the service? Under normal circumstances systemd should create and remove /run/gsad with the defined permissions and ownership from the service file. One possible issue came to my mind, maybe you didn’t reload the service file after changing it. Did you run sudo systemctl daemon-reload?
Just saw we are mixing up gsad and gvmd. The service file was for gsad and the log output for gvmd. You need to take a look at the gvmd.service file for fixing the error.
@BoandlKramer well. Maybe you can try my ansible script that installs openvas on debian 11? I think it’s up to date and works perfectly (at least I hope so )
today I upgraded from 21.4.3 to 21.4.4 but I still have problems with starting gvmd and gsad. Both applications are missing their pidfiles or are unable to create them. Is the documention https://greenbone.github.io/docs/latest/21.04/source-build/index.html correct? I followed it very strictly to perform the update, used the unit files from there and also did systemctl daemon-reload (and even some reboots), but it still fails.
The ospd-openvas service is okay, this one is starting with systemd. The two others not.
If I start the gvmd manually:
Version 21.4.4 creates the gvmd.pid under /run/gvm
Version 21.4.5 does not create any pid file, but it seems to need still /run/gvm to start (and not /run/gvmd)
So if the current version does not create a pid file, systemd would be unable to check for it. Is this new behavior expected? Is /run/gvm still correct or should it be /run/gvmd? Its still a bit messed up between these two pathes.
Alright, I found the problem. I updated the applications when they were running. So it happened that the binaries of gvmd and gsad were not replaced by the new versions. I overlooked that during the update yesterday.