iovisor / iovisor/bcc

Required dependencies for libbpf-tools?

Open
#3,224 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
22.7k
Forks
4.1k
Avg merge
10d 4h
Merged PRs (30d)
3

Description

Following up on Brendan Gregg's excellent http://www.brendangregg.com/blog/2020-11-04/bpf-co-re-btf-libbpf.html I looked into packaging the `libbpf-tools` binaries (`biolatency`, `biopattern`, `biosnoop`, `biostacks`, `bitesize`, `cpudist`, `drsnoop`, `execsnoop`, `filelife`, `hardirqs`, `llcstat`, `numamove`, `opensnoop`, `readahead`, `runqlat`, `runqlen`, `runqslower`, `softirqs`, `syscount`, `tcpconnect`, `tcpconnlat`, `vfsstat` + `xfsslower`), to be able to use them on systems without having to install lots of additional packages.

I did my packaging work on current Debian testing/bullseye, see https://gist.github.com/mika/e55ab72659bda90d8fecbbb42830d250

Most of the binaries work as intended, though `readahead`, `xfsslower` + `llcstat` are failing for me (both on the system where I built the binaries as well as on another Debian/bullseye system with just the compiled binaries and an according kernel with `CONFIG_DEBUG_INFO_BTF` enabled):

```
% sudo readahead
libbpf: failed to find kernel BTF type ID of '__do_page_cache_readahead': -3
libbpf: failed to load object 'readahead_bpf'
libbpf: failed to load BPF skeleton 'readahead_bpf': -3
failed to open and/or load BPF ojbect

% sudo xfsslower
libbpf: kprobe perf_event_open() failed: No such file or directory
libbpf: prog 'xfs_file_read_iter': failed to create kprobe 'xfs_file_read_iter' perf event: No such file or directory
libbpf: failed to auto-attach program 'xfs_file_read_iter': -2
failed to attach BPF programs

% sudo llcstat
failed to init perf sampling: No such file or directory
% sudo strace -f -s500 llcstat 2>&1 | tail
munmap(0x7f17e10f2000, 360448) = 0
perf_event_open({type=PERF_TYPE_HARDWARE, size=0 /* PERF_ATTR_SIZE_??? */, config=PERF_COUNT_HW_CACHE_MISSES, ...}, -1, 0, -1, 0) = -1 ENOENT (No such file or directory)
write(2, "failed to init perf sampling: No such file or directory\n", 56failed to init perf sampling: No such file or directory) = 56
[...]
```

Any hints what's missing here? (I'd like to ensure the BTF support is as good as possible on Debian/bullseye, being the upcoming stable release of Debian.)

Thanks!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked Debian packaging notes and reproduce readahead, xfsslower, and llcstat on Debian bullseye with CONFIG_DEBUG_INFO_BTF enabled. Trace the failing libbpf and perf_event_open paths, then document the missing runtime or kernel dependencies so the three tools work with the packaged binaries.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux
Domain
observability, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.