Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel headers not found in /usr/src #176

Open
fandahao17 opened this issue Oct 28, 2021 · 1 comment
Open

Kernel headers not found in /usr/src #176

fandahao17 opened this issue Oct 28, 2021 · 1 comment

Comments

@fandahao17
Copy link

fandahao17 commented Oct 28, 2021

On some distributions (e.g., my CentOS 7) /lib/modules/$(uname -r)/build is a symlink to the real kernel header directory in /usr/src/kernels/$(uname -r).

root@bpftrace-pod:/# ls -al /lib/modules/5.4.146
total 4636
drwxr-xr-x   4 root root    4096 Oct 28 13:00 .
drwxr-xr-x. 10 root root     255 Oct 28 11:20 ..
lrwxrwxrwx   1 root root      24 Oct 28 13:00 build -> /usr/src/kernels/5.4.146
... (Omiited to save space)

Thus, #77 mounted /usr/src in the pod template to include the kernel headers. #103 later mounted the whole /usr/ to avoid potentially creating /usr/src on the host. /usr is mounted as /usr-host in the guest pod and a symlink is created in the pod from /usr/src to /usr-host/src, so bpftrace can still find the kernel headers through the symlink.

However, in #104 this symlink seems to be removed, leaving /usr/src/ empty.

root@bpftrace-pod:/# ls -al /usr/src
total 0
drwxr-xr-x 2 root root  6 Apr 15  2020 .
drwxr-xr-x 1 root root 25 Jun  9 07:27 ..

Consequently, bpftrace is not able to find the kernel headers, which causes /bpftrace/include/clang_workarounds.h:14:10: fatal error: 'linux/types.h' file not found. This repo has multiple issues regarding this error.

I guess re-linking /usr/src to /usr-host could fix this problem.

@rajeeshckr
Copy link

I am facing the same problem.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants