Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 937564 - net-analyzer/notus-scanner fails to start
Summary: net-analyzer/notus-scanner fails to start
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal major (vote)
Assignee: Giuseppe Foti
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2024-08-08 09:13 UTC by Elleni
Modified: 2024-09-14 10:09 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Elleni 2024-08-08 09:13:10 UTC
After GVM INstallation () I followed the next steps on the wiki, like installed nmap, ikescan and nikta, then configured redis-openvas.conf and started said service. successfully. Then configured and 

Reproducible: Always

Steps to Reproduce:
1.useflags activated: gsa, cli, ospd, snmp
2.gvm installation
3.installed additional packages as per wiki: ikescan, nikta, nmap
4.configured redis-openvas.conf and started said service. successfully. 
5.configured and started postgresql backend
6.Sync the Greenbone Community Feed
7.Starting Greenbone daemons
Actual Results:  
Starting notus-scanner fails

Expected Results:  
notus-scanner starts successfully

* Starting mosquitto ...                                                                                                            [ ok ]
 * /run/notus-scanner: creating directory
 * /run/notus-scanner: correcting owner
 * Starting Greenbone Notus Scanner ...
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.12/notus-scanner", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.12/site-packages/notus/scanner/daemon.py", line 117, in main
    init_logging(
  File "/usr/lib/python3.12/site-packages/notus/scanner/utils.py", line 128, in init_logging
    log_file_handler = WatchedFileHandler(log_file)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/logging/handlers.py", line 475, in __init__
    logging.FileHandler.__init__(self, filename, mode=mode,
  File "/usr/lib/python3.12/logging/__init__.py", line 1231, in __init__
    StreamHandler.__init__(self, self._open())
                                 ^^^^^^^^^^^^
  File "/usr/lib/python3.12/logging/__init__.py", line 1263, in _open
    return open_func(self.baseFilename, self.mode,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/var/log/gvm/notus-scanner.log'
 * start-stop-daemon: failed to start `/usr/bin/notus-scanner'
 * Failed to start Greenbone Notus Scanner                                                                                           [ !! ]
 * ERROR: notus-scanner failed to start
Comment 1 Elleni 2024-08-08 09:14:39 UTC
emerge --info: 

Portage 3.0.65 (python 3.12.3-final-0, default/linux/amd64/23.0/split-usr/desktop/gnome, gcc-13, glibc-2.39-r6, 6.6.38-gentoo x86_64)
=================================================================
System uname: Linux-6.6.38-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_E5-2650_v3_@_2.30GHz-with-glibc2.39
KiB Mem:   103010752 total, 100401560 free
KiB Swap:   14884856 total,  14884856 free
Timestamp of repository gentoo: Tue, 06 Aug 2024 14:00:00 +0000
Head commit of repository gentoo: 67bdb4af52217e340371d42346d592d6f40b517d
Timestamp of repository dilfridge: Tue, 06 Aug 2024 09:07:38 +0000
Head commit of repository dilfridge: a00183bcb95faba2976cbc08d5e29fc878112132

Timestamp of repository guru: Tue, 06 Aug 2024 14:18:53 +0000
Head commit of repository guru: 15e858de541c22cec01c0d56c487132c3f4c2e7f

sh bash 5.2_p26-r6
ld GNU ld (Gentoo 2.42 p3) 2.42.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p26-r6::gentoo
dev-build/autoconf:        2.13-r8::gentoo, 2.71-r7::gentoo
dev-build/automake:        1.16.5-r2::gentoo
dev-build/cmake:           3.28.5::gentoo
dev-build/libtool:         2.4.7-r4::gentoo
dev-build/make:            4.4.1-r1::gentoo
dev-build/meson:           1.4.1::gentoo
dev-lang/perl:             5.38.2-r3::gentoo
dev-lang/python:           3.11.9-r1::gentoo, 3.12.3-r1::gentoo
dev-lang/rust-bin:         1.79.0::gentoo
sys-apps/baselayout:       2.15::gentoo
sys-apps/openrc:           0.54.2::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-devel/binutils:        2.42-r1::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           18.1.8::gentoo
sys-devel/gcc:             13.3.1_p20240614::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/lld:             18.1.8::gentoo
sys-devel/llvm:            18.1.8-r1::gentoo
sys-kernel/linux-headers:  6.6-r1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.39-r6::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    volatile: False
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts: 
    sync-rsync-verify-jobs: 1

dilfridge
    location: /var/db/repos/dilfridge
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/dilfridge.git
    masters: gentoo
    volatile: False

guru
    location: /var/db/repos/guru
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/guru.git
    masters: gentoo
    volatile: False

local
    location: /var/db/repos/local
    masters: gentoo
    volatile: False

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-march=native -O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live candy config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -O2 -pipe"
GENTOO_MIRRORS="https://mirror.init7.net/gentoo/ http://mirror.init7.net/gentoo/ rsync://mirror.init7.net/gentoo/"
LANG="de_CH.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs"
LEX="flex"
LINGUAS="de de_CH"
MAKEOPTS="-j36"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="X a52 aac acl acpi alsa amd64 bluetooth branding bzip2 cairo cdda cdr cet cli colord cpudetection crypt cups dbus dri dts dvd dvdr eds elogind encode evo exif extra ffmpeg flac gdbm gif gnome gnome-keyring gnome-online-accounts gnome-shell gpm gsa gstreamer gtk gui iconv icu introspection ipv6 jpeg keyring kf6compat lcms libnotify libtirpc mad mng mp3 mp4 mpeg multilib nautilus ncurses networkmanager nls ogg opengl openmp opus ospd pam pango pcre pdf png policykit ppds pulseaudio qt5 readline screencast sdl seccomp snmp sound spell split-usr ssl startup-notification svg syslog sysprof test-rust tiff tracker truetype udev udisks unicode upower usb vorbis vpx vulkan wayland wxwidgets x264 x265 xattr xcb xft xml xspice xv xvid zlib" ABI_X86="64" ADA_TARGET="gcc_12" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 aes avx avx2 f16c fma3 pclmul popcnt rdrand sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev libinput spice synaptics" KERNEL="linux" L10N="de de_CH" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_12" PYTHON_TARGETS="python3_12" RUBY_TARGETS="ruby31 ruby32" VIDEO_CARDS="fbdev qxl vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 2 Giuseppe Foti 2024-08-09 04:39:17 UTC
(In reply to Elleni from comment #0)

> PermissionError: [Errno 13] Permission denied:
> '/var/log/gvm/notus-scanner.log'

Can you check that this file exists and that it is writable for the gvm user?
"gvm" should own /var/log/gvm that needs to be writable.
Comment 3 Elleni 2024-08-09 07:35:55 UTC
I restarted from scratch as I had tried to fix it by modifying permissions. Did emerge -C gvm followed by an emerge --depclean and a rm -rf /var/log/gvm and an rm -rf /etc/gvm, then I emerged gvm again. Following the wiki step by step. 

I did not unmerge nmap, ike-scan and nikto and postresql though. 

After emerging everything I skiped the steps on postgresql as it was not removed nor touched during debugging. 

Added the three lines from wiki in /et/gvm/redis-openvas.conf: 

unixsocket /run/redis-openvas/redis.sock 
unixsocketperm 770 
port 0

Postgresql service is enabled, up and running.

Synced the Greenbone Community Feed again after regenerating the certificate for gvmd automatically. 

After new installation and before fist time trying to start the notus-scanner the situation is the following: 

ls -l /var/log/gvm/
insgesamt 4
-rw-r--r-- 1 gvm gvm 82  9. Aug 07:42 gsad.log
-rw-r--r-- 1 gvm gvm  0  9. Aug 09:15 openvas.log

So no, the file notus-scanner.log is not existing yet. 

The subfolder gvm under /var/log/ - created by the installation process is owned by root: drwxr-xr-x 2 root     root          85  9. Aug 09:15 gvm

I am waiting to try to start notus-scanner till the sync has completed and will report result asap.
Comment 4 Elleni 2024-08-09 07:55:54 UTC
/etc/init.d/notus-scanner start
 * Starting mosquitto ...                                                                                                           [ ok ]
 * /run/notus-scanner: creating directory
 * /run/notus-scanner: correcting owner
 * Starting Greenbone Notus Scanner ...
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.12/notus-scanner", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.12/site-packages/notus/scanner/daemon.py", line 117, in main
    init_logging(
  File "/usr/lib/python3.12/site-packages/notus/scanner/utils.py", line 128, in init_logging
    log_file_handler = WatchedFileHandler(log_file)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/logging/handlers.py", line 475, in __init__
    logging.FileHandler.__init__(self, filename, mode=mode,
  File "/usr/lib/python3.12/logging/__init__.py", line 1231, in __init__
    StreamHandler.__init__(self, self._open())
                                 ^^^^^^^^^^^^
  File "/usr/lib/python3.12/logging/__init__.py", line 1263, in _open
    return open_func(self.baseFilename, self.mode,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/var/log/gvm/notus-scanner.log'
 * start-stop-daemon: failed to start `/usr/bin/notus-scanner'
 * Failed to start Greenbone Notus Scanner                                                                                          [ !! ]
 * ERROR: notus-scanner failed to start
Comment 5 Elleni 2024-08-09 08:32:23 UTC
creating the file with touch and changing ownership by chown gvm:gvm /var/log/gvm/notus-scanner.log enabled the service to start successfully. 

But it did not successfully stop the service by /etc/init.d/notus-scanner stop. 

However I continued and faced the same issue with ospd-openvas service. This one also successfully starts if the corresponding logfile is created manually by touch. 

Same thing with gvmd.log / service
Comment 6 Larry the Git Cow gentoo-dev 2024-09-14 10:09:31 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0a122a0f71c4bd314bd97f712d1aba6d360d47bb

commit 0a122a0f71c4bd314bd97f712d1aba6d360d47bb
Author:     Giuseppe Foti <foti.giuseppe@gmail.com>
AuthorDate: 2024-09-07 21:36:36 +0000
Commit:     Florian Schmaus <flow@gentoo.org>
CommitDate: 2024-09-14 09:57:13 +0000

    net-analyzer/notus-scanner: Adds a check on log's dir owner and the logfile to logrotate
    
    Closes: https://bugs.gentoo.org/937564
    Signed-off-by: Giuseppe Foti <foti.giuseppe@gmail.com>
    Signed-off-by: Florian Schmaus <flow@gentoo.org>

 net-analyzer/notus-scanner/files/notus-scanner.logrotate    | 13 +++++++++++++
 ...nner-22.6.3-r1.ebuild => notus-scanner-22.6.3-r3.ebuild} | 12 +++++++++++-
 2 files changed, 24 insertions(+), 1 deletion(-)