GithubHelp home page GithubHelp logo

Comments (5)

songtao98 avatar songtao98 commented on September 27, 2024 2

don't have a /sys in the container at all

I have /sys in my container but ther is no /sys/kernel/debug/tracing.

-v /sys/fs/debug/tracing:/sys/fs/debug/tracing throws an error of

Error: failed to create containerd task: failed to create shim: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/sys/kernel/debug/tracing" to rootfs at "/sys/kernel/debug/tracing": mkdir /run/containerd/io.containerd.runtime.v2.task/k8s.io/mycontainername/rootfs/sys/kernel/debug/tracing: no such file or directory: unknown

The final solution is use -v /sys/:/sys/

from ebpf.

lmb avatar lmb commented on September 27, 2024 1

Are you using master of the library? We've recently added support for /sys/kernel/tracing:

ebpf/link/perf_event.go

Lines 446 to 462 in 5ea5368

var getTracefsPath = internal.Memoize(func() (string, error) {
for _, p := range []struct {
path string
fsType int64
}{
{"/sys/kernel/tracing", unix.TRACEFS_MAGIC},
{"/sys/kernel/debug/tracing", unix.TRACEFS_MAGIC},
// RHEL/CentOS
{"/sys/kernel/debug/tracing", unix.DEBUGFS_MAGIC},
} {
if fsType, err := internal.FSType(p.path); err == nil && fsType == p.fsType {
return p.path, nil
}
}
return "", errors.New("neither debugfs nor tracefs are mounted")
})

when I use eBPF and tracepoints in container, the volume mount might be changed, and is not /sys/kernel/debug/tracing, what can I do in this circumastance?

Do you have an example for this? Unless there is a good reason, the container runtime should make /sys available to you if you configure it correctly.

from ebpf.

lmb avatar lmb commented on September 27, 2024 1

Anyway, still, is there any reason to make the tracefs path fixed?

My approach in general is to not make something configurable unless necessary. From your SO question it seems like you don't have a /sys in the container at all? If yes I'd argue that the correct fix is to change your container runtime config.

from ebpf.

lmb avatar lmb commented on September 27, 2024 1

Did some more searching, seems like this is a common problem that some container runtimes solve, others don't. Since you've found a workaround I'll close the issue.

from ebpf.

songtao98 avatar songtao98 commented on September 27, 2024

@lmb Thanks for reply and apologize for not checkingout to main branch. getTracefsPath Do support for /sys/kernel/tracing.

Do you have an example for this? Unless there is a good reason, the container runtime should make /sys available to you if you configure it correctly.

Anyway, still, is there any reason to make the tracefs path fixed? Check this question I asked today for my example. https://stackoverflow.com/questions/75808955/error-mounting-sys-kernel-debug-tracing-to-rootfs
In this situation I cannot see /sys/kernel/debug/tracing in my container though I can make it as a volume mount for the whole /sys. But another way might be mount it into container as /host-sys/ directory, and that's when I wanna pass this path into link package.

However, I've noticed that the recent cilium/ebpf uses generics based on go 1.18, and our project uses go 1.17 so it statys at cilium/ebpf v0.8.1 and maybe the solution for me has to be overwrite the /sys in container by volumemount. :)

from ebpf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.