sysflow-telemetry / sysflow

SysFlow documentation and issues tracker
Other
45 stars 10 forks source link

Launch-time compilation fails to lookup kernel source #41

Closed COLDTURNIP closed 4 years ago

COLDTURNIP commented 4 years ago

Indicate project collector

Describe the bug Currently sf-collector could not compile sysdig probe ko correctly due to lack of necessary sources even when kernel development packages installed on host.

For RHEL 7.8 host, the kernel version is 3.10.0-1127, thus sysdig probe compilation process must lookup /lib/modules/$(uname -r)/{build,source} for module building. Host provides module-related files by mounting /lib/modules to guest's /host/lib/modules; however, /lib/modules/$(uname -r)/build is a soft link to /usr/src/linux-headers-$(uname -r)/, which does not exists on guest container (since it is build from RHEL 8.1 with kernel 4.1 sources installed)

To reproduce Steps to reproduce the behavior:

  1. on RHEL 7.8 host, and make sure kernel source 3.10.0-1127 is installed
  2. Launch sf-collector (see below)
  3. sf-collector try to compile kernel module, but cannot fetch proper sources from /lib/modules/<kernel_version>/{build,source} :
$ docker run \
    -e EXPORTER_ID=local \
    -e FILTER='container.name!=sf-collector and container.name!=sf-exporter' \
    -e INTERVAL=60 \
    -e OUTPUT=/mnt/data/ \
    -v /var/run/docker.sock:/host/var/run/docker.sock \
    -v /dev:/host/dev \
    -v /proc:/host/proc:ro \
    -v /boot:/host/boot:ro \
    -v /lib/modules:/host/lib/modules:ro \
    -v /usr:/host/usr:ro \
    -v/mnt/data:/mnt/data \
    sysflowtelemetry/sf-collector:latest

* Setting up /usr/src links from host
* Unloading sysdig-probe, if present
* Running dkms install for sysdig

Creating symlink /var/lib/dkms/sysdig/0.26.4/source ->
                 /usr/src/sysdig-0.26.4

DKMS: add completed.
Error! echo
Your kernel headers for kernel 3.10.0-1127.el7.x86_64 cannot be found at
/lib/modules/3.10.0-1127.el7.x86_64/build or /lib/modules/3.10.0-1127.el7.x86_64/source.
* Running dkms build failed, couldn't find /var/lib/dkms/sysdig/0.26.4/build/make.log
* Trying to load a system sysdig-probe, if present
* Trying to find precompiled sysdig-probe for 3.10.0-1127.el7.x86_64
Found kernel config at /boot/config-3.10.0-1127.el7.x86_64
* Trying to download precompiled module from https://s3.amazonaws.com/download.draios.com/stable/sysdig-probe-binaries/sysdig-probe-0.26.4-x86_64-3.10.0-1127.el7.x86_64-5223157266b9a46702625b834cadc6ab.ko
curl: (22) The requested URL returned error: 404 Not Found
Download failed, consider compiling your own sysdig-probe and loading it or getting in touch with the sysdig community
E0511 04:23:26.950556    11 main.cpp:233] Runtime exception caught in main loop: error opening device /host/dev/sysdig0. Make sure you have root credentials and that the sysdig-probe module is loaded.

Expected behavior sf-collector should launch correctly with default configuration even if sysdig probe binary not available on AWS.

Environment (please complete the following information):

araujof commented 4 years ago

Fixed with UBI version upgrade.