bpftrace: BEGIN probe not working
$ sudo ./src/bpftrace -e 'BEGIN { printf("hello\n"); }'
Attaching 1 probe...
Could not resolve symbol: /proc/self/exe:BEGIN_trigger
Built from master at time of writing.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 8
- Comments: 22 (13 by maintainers)
Commits related to this issue
- Ensure symbols are exported for bpftrace executable bpftrace executable needs to lookup `BEGIN_trigger` and `END_trigger` symbols. Since the bump of the minimal versin of CMake in 1a1a4a92f7bcb154282... — committed to vincentbernat/bpftrace by vincentbernat 4 years ago
- Ensure symbols are exported for bpftrace executable bpftrace executable needs to lookup `BEGIN_trigger` and `END_trigger` symbols. Since the bump of the minimal versin of CMake in 1a1a4a92f7bcb154282... — committed to bpftrace/bpftrace by vincentbernat 4 years ago
- community/bpftrace: fix BEGIN/END probes Rebuild bpftrace with manual strip call to fix BEGIN/END probes as described in https://github.com/iovisor/bpftrace/issues/954 Fixes #12526. — committed to alpinelinux/aports by martinetd 3 years ago
- dev-util/bpftrace: Statically link (partially), avoid stripping bpftrace bpftrace is currently broken due to BEGIN_trigger symbol missing. To fix this, we need to avoid stripping the binary since it ... — committed to jsmolic/gentoo by jsmolic 3 years ago
- dev-util/bpftrace: Statically link (partially), avoid stripping bpftrace bpftrace is currently broken due to BEGIN_trigger symbol missing. To fix this, we need to avoid stripping the binary since it ... — committed to jsmolic/gentoo by jsmolic 3 years ago
- dev-util/bpftrace: Statically link (partially), avoid stripping bpftrace bpftrace is currently broken due to BEGIN_trigger symbol missing. To fix this, we need to avoid stripping the binary since it ... — committed to gentoo/gentoo by jsmolic 3 years ago
- Keep symbols in the binary We want to preserve at least BEGIN_trigger in order to fix https://github.com/iovisor/bpftrace/issues/954. Unfortunately, `strip.keep_symbols_list` was not found to be work... — committed to danielocfb/bpftrace by danielocfb 2 years ago
- Keep symbols in the binary We want to preserve at least BEGIN_trigger in order to fix https://github.com/iovisor/bpftrace/issues/954. Unfortunately, `strip.keep_symbols_list` was not found to be work... — committed to jeez/bpftrace by danielocfb 2 years ago
- Keep symbols in the binary We want to preserve at least BEGIN_trigger in order to fix https://github.com/iovisor/bpftrace/issues/954. Unfortunately, `strip.keep_symbols_list` was not found to be work... — committed to jeez/bpftrace by danielocfb 2 years ago
- Keep symbols in the binary We want to preserve at least BEGIN_trigger in order to fix https://github.com/iovisor/bpftrace/issues/954. Unfortunately, `strip.keep_symbols_list` was not found to be work... — committed to jeez/bpftrace by danielocfb 2 years ago
- Keep symbols in the binary We want to preserve at least BEGIN_trigger in order to fix https://github.com/iovisor/bpftrace/issues/954. Unfortunately, `strip.keep_symbols_list` was not found to be work... — committed to simpleton/bpftrace by danielocfb 2 years ago
On Ubuntu, I followed the guide to install the dbgsym packages as described here: https://wiki.ubuntu.com/Debug Symbol Packages
Then:
I experience this problem on vanilla ubuntu 22.04
Thx, it works for me 😃
I’m just dropping this comment for anyone else who hits the same issue. I hit this on my bone stock Fedora 31 install and it was resolved by installing the debug package.
dnf debuginfo-install bpftraceThe cause of this was discovered by @fbs.
edit: it may have also just been an overall uprobe issue
The problem is that these executables have been stripped, and they need to leave the symbol
BEGIN_trigger. I’ve added this to the post-processing of the release artifacts of #1041 with the--keep-symbolflag to strip. To verify, just run nm on the bpftrace binary. For it to work you must see:I think this can be closed as solved - don’t strip this symbol as bpftrace’s
BEGINprobe works by probing itself, which I think is the intended behavior, but poses a quirk for released binaries.That doesn’t explain the uprobe error though I’ve just realized, so perhaps this is backwards - because the BEGIN probe is trying to probe itself, it wouldn’t work because uprobes were broken.