Gvmd install: No package 'libgvm_base' found on version 22.4

hi,
i’m trying to build gvm but it is failing all the time.
I know there was previous topic on this, but i’ve tried everything stated in these topics without any success.

GVM versions

gsad: not installed
gvmd: failed install
openvas-scanner: not installed
**gvm-libs:**successfully installed

Environment

Operating system: Debian 11 Bullseye
Kernel: Linux dsrvvas01 5.10.0-17-amd64 #1 SMP Debian 5.10.136-1 (2022-08-13) x86_64 GNU/Linux
**Installation method / source:**Building 22.4 from Source - Greenbone Community Documentation

Environment variables

$PKG_CONFIG_PATH=/usr/lib/python3/dist-packages/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig
$GVMD_VERSION=22.4.0
$GVM_LIBS_VERSION=22.4.0
$GVM_VERSION=22.4.0

gvm-libs was compiled and installed correctly. I’m following the above link line by line to the point.
Whatever i try i got the following messages with the cmake:

:~/build/gvmd$ cmake $SOURCE_DIR/gvmd-$GVMD_VERSION
-DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX
-DCMAKE_BUILD_TYPE=Release
-DLOCALSTATEDIR=/var
-DSYSCONFDIR=/etc
-DGVM_DATA_DIR=/var
-DGVMD_RUN_DIR=/run/gvmd
-DOPENVAS_DEFAULT_SOCKET=/run/ospd/ospd-openvas.sock
-DGVM_FEED_LOCK_PATH=/var/lib/gvm/feed-update.lock
-DSYSTEMD_SERVICE_DIR=/lib/systemd/system
-DLOGROTATE_DIR=/etc/logrotate.d
– Configuring Greenbone Vulnerability Manager…
– The C compiler identification is GNU 10.2.1
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: /usr/bin/cc - skipped
– Detecting C compile features
– Detecting C compile features - done
– Found PkgConfig: /usr/bin/pkg-config (found version “0.29.2”)
– Could NOT find Git (missing: GIT_EXECUTABLE)
– Install prefix: /usr/local
– Looking for pthread.h
– Looking for pthread.h - found
– Performing Test CMAKE_HAVE_LIBC_PTHREAD
– Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
– Looking for pthread_create in pthreads
– Looking for pthread_create in pthreads - not found
– Looking for pthread_create in pthread
– Looking for pthread_create in pthread - found
– Found Threads: TRUE
– Checking for module ‘libgvm_base>=22.4’
– No package ‘libgvm_base’ found
CMake Error at /usr/share/cmake-3.18/Modules/FindPkgConfig.cmake:545 (message):
A required package was not found
Call Stack (most recent call first):
/usr/share/cmake-3.18/Modules/FindPkgConfig.cmake:733 (_pkg_check_modules_internal)
src/CMakeLists.txt:29 (pkg_check_modules)

– Configuring incomplete, errors occurred!
See also “/home/zargos/build/gvmd/CMakeFiles/CMakeOutput.log”.
See also “/home/zargos/build/gvmd/CMakeFiles/CMakeError.log”.

In the CMakeError.log:
Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /home/zargos/build/gvmd/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake cmTC_13ce5/fast && /usr/bin/gmake -f CMakeFiles/cmTC_13ce5.dir/build.make CMakeFiles/cmTC_13ce5.dir/build
gmake[1] : on entre dans le répertoire « /home/zargos/build/gvmd/CMakeFiles/CMakeTmp »
Building C object CMakeFiles/cmTC_13ce5.dir/src.c.o
/usr/bin/cc -Wall -D_BSD_SOURCE -D_ISOC99_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE -D_FILE_OFFSET_BITS=64 -DCMAKE_HAVE_LIBC_PTHREAD -o CMakeFiles/cmTC_13ce5.dir/src.c.o -c /home/zargos/build/gvmd/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_13ce5
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_13ce5.dir/link.txt --verbose=1
/usr/bin/cc -Wall -D_BSD_SOURCE -D_ISOC99_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE -D_FILE_OFFSET_BITS=64 -DCMAKE_HAVE_LIBC_PTHREAD -rdynamic CMakeFiles/cmTC_13ce5.dir/src.c.o -o cmTC_13ce5
/usr/bin/ld : CMakeFiles/cmTC_13ce5.dir/src.c.o : dans la fonction « main » :
src.c:(.text+0x2f) : référence indéfinie vers « pthread_create »
/usr/bin/ld : src.c:(.text+0x3b) : référence indéfinie vers « pthread_detach »
/usr/bin/ld : src.c:(.text+0x47) : référence indéfinie vers « pthread_cancel »
/usr/bin/ld : src.c:(.text+0x58) : référence indéfinie vers « pthread_join »
collect2: error: ld returned 1 exit status
gmake[1]: *** [CMakeFiles/cmTC_13ce5.dir/build.make:106 : cmTC_13ce5] Erreur 1
gmake[1] : on quitte le répertoire « /home/zargos/build/gvmd/CMakeFiles/CMakeTmp »
gmake: *** [Makefile:140 : cmTC_13ce5/fast] Erreur 2

Source file was:
#include <pthread.h>

void* test_func(void* data)
{
return data;
}

int main(void)
{
pthread_t thread;
pthread_create(&thread, NULL, test_func, NULL);
pthread_detach(thread);
pthread_cancel(thread);
pthread_join(thread, NULL);
pthread_atfork(NULL, NULL, NULL);
pthread_exit(NULL);

return 0;
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/zargos/build/gvmd/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake cmTC_f31ec/fast && /usr/bin/gmake -f CMakeFiles/cmTC_f31ec.dir/build.make CMakeFiles/cmTC_f31ec.dir/build
gmake[1] : on entre dans le répertoire « /home/zargos/build/gvmd/CMakeFiles/CMakeTmp »
Building C object CMakeFiles/cmTC_f31ec.dir/CheckFunctionExists.c.o
/usr/bin/cc -Wall -D_BSD_SOURCE -D_ISOC99_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE -D_FILE_OFFSET_BITS=64 -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_f31ec.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.18/Modules/CheckFunctionExists.c
Linking C executable cmTC_f31ec
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f31ec.dir/link.txt --verbose=1
/usr/bin/cc -Wall -D_BSD_SOURCE -D_ISOC99_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE -D_FILE_OFFSET_BITS=64 -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CMakeFiles/cmTC_f31ec.dir/CheckFunctionExists.c.o -o cmTC_f31ec -lpthreads
/usr/bin/ld : ne peut trouver -lpthreads
collect2: error: ld returned 1 exit status
gmake[1]: *** [CMakeFiles/cmTC_f31ec.dir/build.make:106 : cmTC_f31ec] Erreur 1
gmake[1] : on quitte le répertoire « /home/zargos/build/gvmd/CMakeFiles/CMakeTmp »
gmake: *** [Makefile:140 : cmTC_f31ec/fast] Erreur 2

@Zargos I think something related to threads library is missing?

check that all packages are really installed?

Eero

Already done, all lib are installed. libc dev etc…

@Zargos it should work. try installing build-essential package…

Eero

Already done too…:confused:

@Zargos your system is missing pthread support. I am still sure that documentation is correct.

Eero

IMHO there is something wrong with your build environment. The build of gvm-libs should already have failed if pthread is mssing.

I didn’t say the documentation is not correct. It is correct, but perhaps there is something missing somewhere (regarding debian)

@bricks there is some lib available in debian, but i don’t know which one could be usefull:

libclthreads-dev/stable 2.4.2-1 amd64
POSIX threads C++ access library (development files)

libclthreads2/stable 2.4.2-1 amd64
POSIX threads C++ access library (shared library)

libevent-pthreads-2.1-7/stable 2.1.12-stable-1 amd64
Asynchronous event notification library (pthreads)

libghc-threads-dev/stable 0.5.1.6-4+b1 amd64
Fork threads and wait for their result

libghc-threads-doc/stable 0.5.1.6-4 all
Fork threads and wait for their result; documentation

libghc-threads-prof/stable 0.5.1.6-4+b1 amd64
Fork threads and wait for their result; profiling libraries

I’ve tried all that i had seen but none change anything.

@Zargos Well. what configuration of debian you installed? minimal or normal?

Eero

Minimal added with system utilities and SSH server, build-essential, linux-headers, all thread libraries.

locate pthread

/usr/include/pthread.h
/usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h
/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h
/usr/lib/x86_64-linux-gnu/libevent_pthreads-2.1.so.7
/usr/lib/x86_64-linux-gnu/libevent_pthreads-2.1.so.7.0.1
/usr/lib/x86_64-linux-gnu/libgpgme-pthread.so.11
/usr/lib/x86_64-linux-gnu/libpthread-2.31.so
/usr/lib/x86_64-linux-gnu/libpthread.a
/usr/lib/x86_64-linux-gnu/libpthread.so
/usr/lib/x86_64-linux-gnu/libpthread.so.0
/usr/lib/x86_64-linux-gnu/perl/5.32.1/bits/pthreadtypes-arch.ph
/usr/lib/x86_64-linux-gnu/perl/5.32.1/bits/pthreadtypes.ph
/usr/lib/x86_64-linux-gnu/pkgconfig/pthread-stubs.pc
/usr/lib32/libpthread-2.31.so
/usr/lib32/libpthread.so.0
/usr/share/doc/libevent-pthreads-2.1-7
/usr/share/doc/libpthread-stubs0-dev
/usr/share/doc/libevent-pthreads-2.1-7/changelog.Debian.gz
/usr/share/doc/libevent-pthreads-2.1-7/changelog.gz
/usr/share/doc/libevent-pthreads-2.1-7/copyright
/usr/share/doc/libpthread-stubs0-dev/README
/usr/share/doc/libpthread-stubs0-dev/changelog.Debian.gz
/usr/share/doc/libpthread-stubs0-dev/copyright
/usr/share/gdb/auto-load/lib/x86_64-linux-gnu/libpthread-2.31.so-gdb.py
/usr/share/man/fr/man7/pthreads.7.gz
/usr/share/man/man7/pthreads.7.gz
/var/lib/dpkg/info/libevent-pthreads-2.1-7:amd64.list
/var/lib/dpkg/info/libevent-pthreads-2.1-7:amd64.md5sums
/var/lib/dpkg/info/libevent-pthreads-2.1-7:amd64.shlibs
/var/lib/dpkg/info/libevent-pthreads-2.1-7:amd64.symbols
/var/lib/dpkg/info/libevent-pthreads-2.1-7:amd64.triggers
/var/lib/dpkg/info/libpthread-stubs0-dev:amd64.list
/var/lib/dpkg/info/libpthread-stubs0-dev:amd64.md5sums

@Zargos your system is missing shared libraries for pthreads, not headers (.h) files or the search path does not contain needed path.

you can use strace to find that files linker (ld) is looking for.

Eero

Correct me if i’m wrong but the pthread hints could be misleading:

  1. It was actually found correctly in the provided output – Looking for pthread_create in pthread - found
  2. I’m getting the same errors in CMakeError.log of gvmd when building it but the build is still successful. The errors itself looks more like that these are originating from the previous Performing Test CMAKE_HAVE_LIBC_PTHREAD and Looking for pthread_create in pthreads which are failing and which seems to be expected
  3. The actual error why the build of gvmd is failing is because cmake can’t find the installation of gvm-libs (No package ‘libgvm_base’ found)

For now i would focus on why the cmake build of gvmd isn’t finding the gvm-libs installation, e.g.:

  • PKG_CONFIG_PATH not correctly configured
  • Build of gvm-libs was successful but the make install (means copying it to the correct path) failed or the installation was done to the wrong path

For the records my “build” logs of a successful gvmd build looks like the following which is matching the one of the OP so pthread should be completely fine:

-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Checking for module 'libgvm_base>=21.4.1'
--   Found libgvm_base, version 21.4.5~dev1~git-5751e9c-oldstable
-- Checking for module 'libgvm_util>=21.4.1'
--   Found libgvm_util, version 21.4.5~dev1~git-5751e9c-oldstable
-- Checking for module 'libgvm_osp>=21.4.1'
--   Found libgvm_osp, version 21.4.5~dev1~git-5751e9c-oldstable
-- Checking for module 'libgvm_gmp>=21.4.1'
--   Found libgvm_gmp, version 21.4.5~dev1~git-5751e9c-oldstable

Hi,

The VM used is highly secured, and one of the modified config files is impacting the build.
Using a non secured installation of Debian is working well, thus i have to find which config file or parameter is impacting.
It takes time as i have to redo the installation media and reinstall with it then test the build.
i’ll get back to you all (thanks for help) when i’ll find the threat :slight_smile:

1 Like

And putting a build environment is not securing your VM at all. Should should think about separating build and production if you really care about security.

All my VM are automatically secured that way. I’ve created my own installation media (using simple-cdd).
this Vm is just a test for now. As all builds will be completed, i’ll use only the install files to create a correct production VM and the other won’t be used anymore.

Anyway this VM is not to be UP all the time, it will be used from time to time only. server will be shutdown when not used.

well. your hardened images can lead incorrect scanning results.

as hardenings can block test from working.

Please use normal debian without special settings…

Eero

1 Like

It was the umask in /etcprofile and /etc/bash.bashrc.

It was setup as umask 027
Bu in /etc/login.defs it was setup as 022.

That was the cause of the error :slight_smile: And i stay with my hardened install :smiley:

1 Like