View Issue Details

IDProjectCategoryView StatusLast Update
0008729Kali LinuxKali Package Improvementpublic2024-04-25 23:18
Reportermkz Assigned Tosbrun  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Fixed in Version2024.2 
Summary0008729: Fresh Kali install, gvm (OpenVas) has 2 service start failures
Description

Hi,

I hope this is the correct location to report this.

I have had problems with GVM / OpenVAS on fresh installs of Kali and Kali Purple ISOs 2024.1. After completing the initial setup for gvm, I complete a 'gvm-check-setup' to ensure everything is installed properly. Lately, it fails during the setup check because it cannot start 'ospd-openvas.service' and 'notus-scanner.service.' The root cause for this appears to be related to 2 python files returning this error :
AttributeError: 'MQTTClient' object has no attribute '_sock'

Installation:
sudo apt-get update -y && sudo apt full-upgrade -y
sudo apt install gvm

sudo gvm-setup
sudo gvm-check-setup

ospd jorunelctl error output:
Apr 20 17:46:38 kali systemd[1]: Starting ospd-openvas.service - OSPd Wrapper for the OpenVAS Scanner (ospd-openvas)...
░░ Subject: A start job for unit ospd-openvas.service has begun execution
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A start job for unit ospd-openvas.service has begun execution.
░░
░░ The job identifier is 12939.
Apr 20 17:46:39 kali ospd-openvas[115031]: Traceback (most recent call last):
Apr 20 17:46:39 kali ospd-openvas[115031]: File "/usr/bin/ospd-openvas", line 8, in <module>
Apr 20 17:46:39 kali ospd-openvas[115031]: sys.exit(main())
Apr 20 17:46:39 kali ospd-openvas[115031]: ^^^^^^
Apr 20 17:46:39 kali ospd-openvas[115031]: File "/usr/lib/python3/dist-packages/ospd_openvas/daemon.py", line 1245, in main
Apr 20 17:46:39 kali ospd-openvas[115031]: daemon_main('OSPD - openvas', OSPDopenvas, NotusParser())
Apr 20 17:46:39 kali ospd-openvas[115031]: File "/usr/lib/python3/dist-packages/ospd/main.py", line 152, in main
Apr 20 17:46:39 kali ospd-openvas[115031]: daemon.init(server)
Apr 20 17:46:39 kali ospd-openvas[115031]: File "/usr/lib/python3/dist-packages/ospd_openvas/daemon.py", line 501, in init
Apr 20 17:46:39 kali ospd-openvas[115031]: client = MQTTClient(
Apr 20 17:46:39 kali ospd-openvas[115031]: ^^^^^^^^^^^
Apr 20 17:46:39 kali ospd-openvas[115031]: File "/usr/lib/python3/dist-packages/ospd_openvas/messaging/mqtt.py", line 39, in init
Apr 20 17:46:39 kali ospd-openvas[115031]: super().init(client_id=client_id, protocol=mqtt.MQTTv5)
Apr 20 17:46:39 kali ospd-openvas[115031]: TypeError: Client.init() missing 1 required positional argument: 'callback_api_version'
Apr 20 17:46:39 kali ospd-openvas[115031]: Exception ignored in atexit callback: <function exit_cleanup at 0x7fcf27f4cf40>
Apr 20 17:46:39 kali ospd-openvas[115031]: Traceback (most recent call last):
Apr 20 17:46:39 kali ospd-openvas[115031]: File "/usr/lib/python3/dist-packages/ospd/main.py", line 74, in exit_cleanup
Apr 20 17:46:39 kali ospd-openvas[115031]: sys.exit()
Apr 20 17:46:39 kali ospd-openvas[115031]: SystemExit:
Apr 20 17:46:39 kali ospd-openvas[115031]: Exception ignored in: <function Client.del at 0x7fcf26c49620>
Apr 20 17:46:39 kali ospd-openvas[115031]: Traceback (most recent call last):
Apr 20 17:46:39 kali ospd-openvas[115031]: File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 874, in del
Apr 20 17:46:39 kali ospd-openvas[115031]: self._reset_sockets()
Apr 20 17:46:39 kali ospd-openvas[115031]: File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 1133, in _reset_sockets
Apr 20 17:46:39 kali ospd-openvas[115031]: self._sock_close()
Apr 20 17:46:39 kali ospd-openvas[115031]: File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 1119, in _sock_close
Apr 20 17:46:39 kali ospd-openvas[115031]: if not self._sock:
Apr 20 17:46:39 kali ospd-openvas[115031]: ^^^^^^^^^^
Apr 20 17:46:39 kali ospd-openvas[115031]: AttributeError: 'MQTTClient' object has no attribute '_sock'
Apr 20 17:46:39 kali systemd[1]: ospd-openvas.service: Can't open PID file /run/ospd/ospd-openvas.pid (yet?) after start: No such file or directory
Apr 20 17:46:39 kali systemd[1]: ospd-openvas.service: Failed with result 'protocol'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ The unit ospd-openvas.service has entered the 'failed' state with result 'protocol'

notus journalctl error output:
Apr 20 17:49:07 kali systemd[1]: Starting notus-scanner.service - Notus Scanner...
░░ Subject: A start job for unit notus-scanner.service has begun execution
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A start job for unit notus-scanner.service has begun execution.
░░
░░ The job identifier is 13210.
Apr 20 17:49:07 kali notus-scanner[116543]: Traceback (most recent call last):
Apr 20 17:49:07 kali notus-scanner[116543]: File "/usr/bin/notus-scanner", line 8, in <module>
Apr 20 17:49:07 kali notus-scanner[116543]: sys.exit(main())
Apr 20 17:49:07 kali notus-scanner[116543]: ^^^^^^
Apr 20 17:49:07 kali notus-scanner[116543]: File "/usr/lib/python3/dist-packages/notus/scanner/daemon.py", line 130, in main
Apr 20 17:49:07 kali notus-scanner[116543]: run_daemon(
Apr 20 17:49:07 kali notus-scanner[116543]: File "/usr/lib/python3/dist-packages/notus/scanner/daemon.py", line 86, in run_daemon
Apr 20 17:49:07 kali notus-scanner[116543]: client = MQTTClient(
Apr 20 17:49:07 kali notus-scanner[116543]: ^^^^^^^^^^^
Apr 20 17:49:07 kali notus-scanner[116543]: File "/usr/lib/python3/dist-packages/notus/scanner/messaging/mqtt.py", line 35, in init
Apr 20 17:49:07 kali notus-scanner[116543]: super().init(client_id=client_id, protocol=mqtt.MQTTv5)
Apr 20 17:49:07 kali notus-scanner[116543]: TypeError: Client.init() missing 1 required positional argument: 'callback_api_version'
Apr 20 17:49:07 kali notus-scanner[116543]: Exception ignored in atexit callback: <function exit_cleanup at 0x7fac6af100e0>
Apr 20 17:49:07 kali notus-scanner[116543]: Traceback (most recent call last):
Apr 20 17:49:07 kali notus-scanner[116543]: File "/usr/lib/python3/dist-packages/notus/scanner/utils.py", line 104, in exit_cleanup
Apr 20 17:49:07 kali notus-scanner[116543]: sys.exit()
Apr 20 17:49:07 kali notus-scanner[116543]: SystemExit:
Apr 20 17:49:07 kali notus-scanner[116543]: Exception ignored in: <function Client.del at 0x7fac6aeeb240>
Apr 20 17:49:07 kali notus-scanner[116543]: Traceback (most recent call last):
Apr 20 17:49:07 kali notus-scanner[116543]: File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 874, in del
Apr 20 17:49:07 kali notus-scanner[116543]: self._reset_sockets()
Apr 20 17:49:07 kali notus-scanner[116543]: File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 1133, in _reset_sockets
Apr 20 17:49:07 kali notus-scanner[116543]: self._sock_close()
Apr 20 17:49:07 kali notus-scanner[116543]: File "/usr/lib/python3/dist-packages/paho/mqtt/client.py", line 1119, in _sock_close
Apr 20 17:49:07 kali notus-scanner[116543]: if not self._sock:
Apr 20 17:49:07 kali notus-scanner[116543]: ^^^^^^^^^^
Apr 20 17:49:07 kali notus-scanner[116543]: AttributeError: 'MQTTClient' object has no attribute '_sock'
Apr 20 17:49:08 kali systemd[1]: notus-scanner.service: Can't open PID file /run/notus-scanner/notus-scanner.pid (yet?) after start: No such file or direc>
Apr 20 17:50:37 kali systemd[1]: notus-scanner.service: start operation timed out. Terminating.
Apr 20 17:50:37 kali systemd[1]: notus-scanner.service: Failed with result 'timeout'.

I found a thread on freebsd.org which fixed this issue:

./usr/lib/python3/dist-packages/ospd_openvas/messaging/mqtt.py
https://bugs.freebsd.org/bugzilla/attachment.cgi?id=249565&amp;action=edit

diff

  • super().init(client_id=client_id, protocol=mqtt.MQTTv5)
  • super().init(mqtt.CallbackAPIVersion.VERSION1, client_id=client_id, protocol=mqtt.MQTTv5)

./usr/lib/python3/dist-packages/notus/scanner/messaging/mqtt.py
https://bugs.freebsd.org/bugzilla/attachment.cgi?id=249564&amp;action=edit

diff

  • super().init(client_id=client_id, protocol=mqtt.MQTTv5)
  • super().init(mqtt.CallbackAPIVersion.VERSION1, client_id=client_id, protocol=mqtt.MQTTv5).

Once those have been updated, run:
sudo gvm-stop
sudo gvm-check-setup

This should then complete the setup checks without issue.

Thanks

Activities

TRai12

TRai12

2024-04-21 13:28

reporter   ~0019174

Hi,
same problem here with an installation that has been in use for a long time, after updating python3-paho-mqtt. The freebsd.org solution described above also solved the problem for me.

apizsh

apizsh

2024-04-22 10:03

reporter   ~0019179

Last edited: 2024-04-22 12:59

solved.

git clone https://github.com/eclipse/paho.mqtt.python
compile

cd paho.mqtt.python
pip install -e .

cd src
cd paho

cd mqtt

sudo cp client.py /usr/lib/python3/dist-packages/paho/mqtt/client.py

then

sudo service openvas start

and then

sudo gvm-check-setup

image.png (9,753 bytes)   
image.png (9,753 bytes)   
Arszilla

Arszilla

2024-04-22 10:58

reporter   ~0019181

@apizsh You could have just installed python3-paho-mqtt, which is available in Kali repositories: https://pkg.kali.org/pkg/python-paho-mqtt

The gvm package comes from Debian Upstream, which has the following debian/rules file: https://salsa.debian.org/pkg-security-team/gvm/-/blob/debian/master/debian/control?ref_type=heads

There are 2 options:

  • Either get the Debian maintainers to add this dependency to the package
  • Either get the Debian maintainers to apply a patch that would have the fix @mkz wrote
apizsh

apizsh

2024-04-22 13:00

reporter   ~0019182

@Arszilla correct.

but.

when u install it from source package , it solved by copying file at which we got error from journalctl -xeu

tmc-au

tmc-au

2024-04-23 10:12

reporter   ~0019184

same problem here with an installation that has been in use for a long time, after updating python3-paho-mqtt

sbrun

sbrun

2024-04-24 16:19

manager   ~0019191

Thanks for the report.

This is an issue with the new release of paho-mqtt. https://github.com/eclipse/paho.mqtt.python/issues/814

I have imported the upstream patch https://github.com/eclipse/paho.mqtt.python/commit/5c77540e75d86e69a6cc78ada460f857345dd535

The version 2.0.0-1kali1 should fix the issue. It will be available soon in kali-dev.

sbrun

sbrun

2024-04-25 13:04

manager   ~0019195

The package python3-paho-mqtt version 2.0.0-1kali1 is available in kali-rolling.

Please let us know if you still have issues after the upgrade.

gcovain

gcovain

2024-04-25 13:19

reporter   ~0019197

Hello,
This has fixed the problem on my (old) installation, thanks !

mkz

mkz

2024-04-25 14:34

reporter   ~0019198

Confirmed that this has resolved the problem for me too.

Thank you!

tmc-au

tmc-au

2024-04-25 22:43

reporter   ~0019206

Confirm that this resolves issue.

Thanks for quick action

steev

steev

2024-04-25 23:18

manager   ~0019207

Resolving as multiple users report that it's fixed for them

Issue History

Date Modified Username Field Change
2024-04-20 22:21 mkz New Issue
2024-04-21 13:28 TRai12 Note Added: 0019174
2024-04-22 10:03 apizsh Note Added: 0019179
2024-04-22 10:03 apizsh File Added: image.png
2024-04-22 10:58 Arszilla Note Added: 0019181
2024-04-22 12:59 apizsh Note Edited: 0019179
2024-04-22 13:00 apizsh Note Added: 0019182
2024-04-23 10:12 tmc-au Note Added: 0019184
2024-04-24 12:41 sbrun Assigned To => sbrun
2024-04-24 12:41 sbrun Status new => assigned
2024-04-24 16:19 sbrun Note Added: 0019191
2024-04-25 13:04 sbrun Note Added: 0019195
2024-04-25 13:19 gcovain Note Added: 0019197
2024-04-25 14:34 mkz Note Added: 0019198
2024-04-25 22:43 tmc-au Note Added: 0019206
2024-04-25 23:18 steev Status assigned => resolved
2024-04-25 23:18 steev Resolution open => fixed
2024-04-25 23:18 steev Fixed in Version => 2024.2
2024-04-25 23:18 steev Note Added: 0019207