grafana / beyla

eBPF-based autoinstrumentation of web applications and network metrics
https://grafana.com/oss/beyla-ebpf/
Apache License 2.0
1.23k stars 78 forks source link

beyla 0.3.2 can't run in centos7 #390

Closed kazu12 closed 4 months ago

kazu12 commented 7 months ago

beyla 0.3.2 can‘t run in centos 7: report: ./beyla: /lib64/libc.so.6: versionGLIBC_2.32' not found (required by ./beyla) ./beyla: /lib64/libc.so.6: version GLIBC_2.34' not found (required by ./beyla) system version: CentOS Linux release 7.9.2009 (Core)

mariomac commented 7 months ago

Hi @kazu12, thanks for the report! is this a bug that appeared in Beyla 0.3.2? In other words: did Beyla 0.3.1 worked well?

mariomac commented 7 months ago

Self-response: Centos 7 uses Linux Kernel 3.10 and Beyla requires eBPF features that are available from Kernel 5.4. We can't fix Centos 7.

kazu12 commented 7 months ago

Hi @kazu12, thanks for the report! is this a bug that appeared in Beyla 0.3.2? In other words: did Beyla 0.3.1 worked well?

I've tried all the current versions and I'm getting this bug. I speculate that the reason is that the binary version of the compilation environment is based on a more advanced Linux distribution.

mariomac commented 7 months ago

I'm sorry to not be able to solve your issue. Independently of the version of the Go compiler and the libraries it uses, CentOS 7 ships an outdated version of the Kernel that does not support our eBPF functionalities (required Kernel 5.14+).

kazu12 commented 7 months ago

I'm sorry to not be able to solve your issue. Independently of the version of the Go compiler and the libraries it uses, CentOS 7 ships an outdated version of the Kernel that does not support our eBPF functionalities (required Kernel 5.14+).

The system I'm currently using has upgraded the kernel separately, and the current kernel is 5.4.144. This kernel should support eBPF, right? Ithink the fault happend because of the version issue of libc(or glibc ?)

mariomac commented 7 months ago

Hi @kazu12 yes, this kernel version supports eBPF, but not all the functionalities that Beyla use. Anyway it's true that Beyla should at least start. This seems caused by an older glibc version than the version that the Go compiler uses in our CI.

Could you try compiling Beyla from CentOS7 and see if it works? It should be as simple as:

make compile

If you have Docker, you can compile it by copying the following Dockerfile_centos7 in the project root and build a Beyla image with:

docker build -f Dockerfile_centos7 -t beyla:centos7 .

Dockerfile_centos7:

# Build the autoinstrumenter binary
FROM centos:7 as builder

# TODO: embed software version in executable

ARG GOVERSION="1.21.3"

ARG TARGETARCH

RUN echo "using TARGETARCH: $TARGETARCH"

RUN yum install -y git make unzip
RUN yum clean all

VOLUME ["/src"]

WORKDIR /

# Installs a fairly modern distribution of Go
RUN curl -qL https://go.dev/dl/go$GOVERSION.linux-$TARGETARCH.tar.gz -o go.tar.gz
RUN tar -xzf go.tar.gz
RUN rm go.tar.gz

ENV GOROOT /go
RUN mkdir -p /gopath
ENV GOPATH /gopath

ENV GOBIN $GOPATH/bin
ENV PATH $GOROOT/bin:$GOBIN:$PATH
ENV TOOLS_DIR $GOBIN

ARG TARGETARCH

ENV GOARCH=$TARGETARCH

WORKDIR /opt/app-root

# Copy the go manifests and source
COPY .git/ .git/
COPY bpf/ bpf/
COPY cmd/ cmd/
COPY pkg/ pkg/
COPY vendor/ vendor/
COPY go.mod go.mod
COPY go.sum go.sum
COPY Makefile Makefile
COPY LICENSE LICENSE
COPY NOTICE NOTICE
COPY third_party_licenses.csv third_party_licenses.csv

# Build
RUN make compile

# Create final image from minimal + built binary
FROM debian:bookworm-slim

LABEL maintainer="Grafana Labs <hello@grafana.com>"

WORKDIR /

COPY --from=builder /opt/app-root/bin/beyla .
COPY --from=builder /opt/app-root/LICENSE .
COPY --from=builder /opt/app-root/NOTICE .
COPY --from=builder /opt/app-root/third_party_licenses.csv .

COPY --from=builder /etc/ssl/certs /etc/ssl/certs

USER 0:0

CMD [ "/beyla" ]
grcevski commented 7 months ago

Hi @kazu12,

One other option is to see if you can upgrade the libc on your distro. I was able to do that on an older Debian version when I was testing some functionality.

teliov commented 6 months ago

Adding a comment one this one. When I run the latest version of ./beyla (1.0.2) on an amd machine:

uname -r

5.10.0-26-cloud-amd64

I get:

root@ip-10-15-2-6:/opt/beyla# ./beyla
./beyla: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./beyla)
./beyla: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./beyla)

And the glib version:

ldd --version

ldd (Debian GLIBC 2.31-13+deb11u7) 2.31

The system is running debian 11 - bullseye.

However when I run on an arm64 equivalent I get this I don't get the same error even though it has the same libc version:

ldd --version

ldd (Debian GLIBC 2.31-13+deb11u7) 2.31
mariomac commented 6 months ago

Hi @teliov, if you have go in your system, as a workaround, could you try installing Beyla with:

go install github.com/grafana/beyla/cmd/beyla@latest

?

grcevski commented 6 months ago

I think we need to start producing statically linked binaries or build a distribution version for the older GLIBC.

teliov commented 6 months ago

Thanks @mariomac , the installation via go binary doesn't produce this error.