Ospd-openvas.service doesnt start

I am have openvas installed on Rhel 8 en since the laatste update this is not working anymore , first i was havig some probleem with the a wrong parameter in /usr/lib/systemd/system/ospd-openvas.service i fiexd en updated again the server en now i get this errors:

 ospd-openvas.service - Job that runs the ospd-openvas daemon
   Loaded: loaded (/usr/lib/systemd/system/ospd-openvas.service; enabled; vendor preset: disabled)
   Active: activating (auto-restart) (Result: exit-code) since Wed 2022-07-20 15:51:58 CEST; 28s ago
     Docs: man:gvm
  Process: 15623 ExecStart=/opt/atomicorp/bin/ospd-openvas --pid-file /var/run/ospd/ospd-openvas.pid --unix-socket=/var/run/ospd/ospd-openvas.sock --log-file /var/log/gvm/ospd-scanner.log --lock-file-dir /var/run/gvmd/ (code=exited, status=1/FAILURE)
 Main PID: 15623 (code=exited, status=1/FAILURE)

journalctl -ex

-- Unit ospd-openvas.service has finished shutting down.
 Started Job that runs the ospd-openvas daemon.
-- Subject: Unit ospd-openvas.service has finished start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit ospd-openvas.service has finished starting up.
--
-- The start-up result is done.
 Traceback (most recent call last):
   File "/opt/atomicorp/bin/ospd-openvas", line 5, in <module>
    from ospd_openvas.daemon import main
  File "/opt/atomicorp/lib/python3.8/site-packages/ospd_openvas/daemon.py", line 33, in <module>
    from lxml.etree import tostring, SubElement, Element
 ModuleNotFoundError: No module named 'lxml.etree'
 ospd-openvas.service: Main process exited, code=exited, status=1/FAILURE
 ospd-openvas.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- The unit ospd-openvas.service has entered the 'failed' state with result 'exit-code'.

openvas versions
ospd-openvas version 21.4.4
openvas-scanner 21.4.4

gvm.noarch 21.4.0-18459.el8.art @atomic
gvm-libs.x86_64 21.4.4-26413.el8.art @atomic
gvmd.x86_64 21.4.5-26414.el8.art @atomic

Does anyone have any idea how I can solve this?

Thanks

@yilian how this is installed? from atomic corp repo? and then you compiled some parts manually?

some python module is missing…

Eero

Please raise an issue at GitHub - Atomicorp/gvm: Greenbone Vulnerability Manager / Openvas packaging project for the package maintainer as this looks like either a problem in the packaging itself or some missing dependencies not correctly integrated into the packages.

1 Like

Hi Aero

I only installed from the atomic repo. Yes, openvas does not find lxml.etree from python3.8, but it is installed. I see there are 2 python versions pyhton3.6 and python3.8.

[root@openvas ~]# python3.8
Python 3.8.12 (default, Sep 16 2021, 10:46:05)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from lxml import etree
>>>

@yilian your system is probably using wrong python version.

try removing wrong version or create symbolic link for correct version with name ”python”

Eero

1 Like

@yilian https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_basic_system_settings/assembly_configuring-the-unversioned-python_configuring-basic-system-settings is probably standard way to set correct python version

Eero

1 Like

Hello! I have the same environment and the same problem. I have follow the instruction to force alternative python3.8 but the problem persist.

sysadmin

@sysadmin you need to provide more information. are you sure that it’s really using correct python version?

Eero

@sysadmin did you follow instructions at: https://github.com/Atomicorp/gvm

Eero

@cfi @sysadmin @yilian looks like it’s using wrong python version.

I think this fixes the problem. run following command on root:
alternatives --set python3 /usr/bin/python3.8

please test it.

edit: I verified the solution and it works.

2 Likes

Hi Eero! Thanks for the answer I tried and it works, previously I tried with the interactive mode … I probably got something wrong and it didn’t work. Thanks again regards

1 Like

@sysadmin :clap:t4:

Hi Eero

I uninstalled the wrong version but that didn’t work. Openvas was broken, but I was able to restore it from a backup I made before the update.

I’m going to try this next week and I’ll let you know if it works
alternatives --set python3 /usr/bin/python3.8

Thanks a lot!!

@yilian It works on rockly linux 8.5 - I don’t have access to commercial rhel 8

Eero

1 Like

Some related discussion seems to be ongoing here:

https://github.com/Atomicorp/gvm/issues/61

1 Like

It works on Rhel 8.6. Thanks!!

1 Like

@yilian rocks

This did not solve my problem. Then I found this post here that worked for me Reddit - Dive into anything

It is a permission issue in the openvas.log file.

So basically, after initial installation, do the following:

  1. Check file rights of the file:
    sudo ls -lah /var/log/gvm/openvas.log
    -rw-r–r-- 1 root root 0 Nov 13 14:08 openvas.log

  2. Change the rights:
    $ sudo chmod 666 /var/log/gvm/openvas.log

  3. Results:
    sudo ls -lah /var/log/gvm/openvas.log
    -rw-rw-rw- 1 root root 102 Jan 19 13:42 /var/log/gvm/openvas.log

  4. Check service:
    $ sudo systemctl status ospd-openvas
    â—Ź ospd-openvas.service - Job that runs the ospd-openvas daemon
    Loaded: loaded (/usr/lib/systemd/system/ospd-openvas.service; enabled; vendor preset: disabled)
    Active: active (running) since Fri 2024-01-19 14:38:54 SAST; 4min 43s ago

Presto! It works.

Hopefully this will help someone else with this issue.

The openvas.log file should be owned by the gvm or _gvm user (depending on your installation method) not root.

You can find gvm’s username like so:

$ cut -d: -f1 /etc/passwd | grep gvm
_gvm

Then change the owner and group of the openvas.log file to match that user instead of opening permissions so much.

2 Likes