How To Install bpftrace on Fedora 34

bpftrace is High-level tracing language for Linux eBPF

Introduction

In this tutorial we learn how to install bpftrace on Fedora 34.

What is bpftrace

BPFtrace is a high-level tracing language for Linux enhanced Berkeley Packet Filter (eBPF) available in recent Linux kernels (4.x). BPFtrace uses LLVM as a backend to compile scripts to BPF-bytecode and makes use of BCC for interacting with the Linux BPF system, as well as existing Linux tracing capabilities (uprobes), and tracepoints. The BPFtrace language is inspired by awk and C, and predecessor tracers such as DTrace and SystemTap

We can use yum or dnf to install bpftrace on Fedora 34. In this tutorial we discuss both methods but you only need to choose one of method to install bpftrace.

Install bpftrace on Fedora 34 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

Fedora 34 - x86_64                               20 kB/s | 6.6 kB     00:00
Fedora 34 openh264 (From Cisco) - x86_64        1.4 kB/s | 989  B     00:00
Fedora Modular 34 - x86_64                       68 kB/s | 6.5 kB     00:00
Fedora 34 - x86_64 - Updates                    3.5 kB/s | 6.2 kB     00:01
Fedora Modular 34 - x86_64 - Updates             17 kB/s | 5.9 kB     00:00
Metadata cache created.

After updating yum database, We can install bpftrace using dnf by running the following command:

sudo dnf -y install bpftrace

Install bpftrace on Fedora 34 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

Fedora 34 - x86_64                               20 kB/s | 6.6 kB     00:00
Fedora 34 openh264 (From Cisco) - x86_64        1.4 kB/s | 989  B     00:00
Fedora Modular 34 - x86_64                       68 kB/s | 6.5 kB     00:00
Fedora 34 - x86_64 - Updates                    3.5 kB/s | 6.2 kB     00:01
Fedora Modular 34 - x86_64 - Updates             17 kB/s | 5.9 kB     00:00
Metadata cache created.

After updating yum database, We can install bpftrace using yum by running the following command:

sudo yum -y install bpftrace

How To Uninstall bpftrace on Fedora 34

To uninstall only the bpftrace package we can use the following command:

sudo dnf remove bpftrace

bpftrace Package Contents on Fedora 34

/usr/bin/bpftrace
/usr/lib/.build-id
/usr/lib/.build-id/7b
/usr/lib/.build-id/7b/ab0c218e2e9c81a41d5b89efea16de8068aaeb
/usr/share/bpftrace
/usr/share/bpftrace/tools
/usr/share/bpftrace/tools/bashreadline.bt
/usr/share/bpftrace/tools/biolatency.bt
/usr/share/bpftrace/tools/biosnoop.bt
/usr/share/bpftrace/tools/biostacks.bt
/usr/share/bpftrace/tools/bitesize.bt
/usr/share/bpftrace/tools/capable.bt
/usr/share/bpftrace/tools/cpuwalk.bt
/usr/share/bpftrace/tools/dcsnoop.bt
/usr/share/bpftrace/tools/doc
/usr/share/bpftrace/tools/doc/bashreadline_example.txt
/usr/share/bpftrace/tools/doc/biolatency_example.txt
/usr/share/bpftrace/tools/doc/biosnoop_example.txt
/usr/share/bpftrace/tools/doc/biostacks_example.txt
/usr/share/bpftrace/tools/doc/bitesize_example.txt
/usr/share/bpftrace/tools/doc/capable_example.txt
/usr/share/bpftrace/tools/doc/cpuwalk_example.txt
/usr/share/bpftrace/tools/doc/dcsnoop_example.txt
/usr/share/bpftrace/tools/doc/execsnoop_example.txt
/usr/share/bpftrace/tools/doc/gethostlatency_example.txt
/usr/share/bpftrace/tools/doc/killsnoop_example.txt
/usr/share/bpftrace/tools/doc/loads_example.txt
/usr/share/bpftrace/tools/doc/mdflush_example.txt
/usr/share/bpftrace/tools/doc/naptime_example.txt
/usr/share/bpftrace/tools/doc/oomkill_example.txt
/usr/share/bpftrace/tools/doc/opensnoop_example.txt
/usr/share/bpftrace/tools/doc/pidpersec_example.txt
/usr/share/bpftrace/tools/doc/runqlat_example.txt
/usr/share/bpftrace/tools/doc/runqlen_example.txt
/usr/share/bpftrace/tools/doc/setuids_example.txt
/usr/share/bpftrace/tools/doc/statsnoop_example.txt
/usr/share/bpftrace/tools/doc/swapin_example.txt
/usr/share/bpftrace/tools/doc/syncsnoop_example.txt
/usr/share/bpftrace/tools/doc/syscount_example.txt
/usr/share/bpftrace/tools/doc/tcpaccept_example.txt
/usr/share/bpftrace/tools/doc/tcpconnect_example.txt
/usr/share/bpftrace/tools/doc/tcpdrop_example.txt
/usr/share/bpftrace/tools/doc/tcplife_example.txt
/usr/share/bpftrace/tools/doc/tcpretrans_example.txt
/usr/share/bpftrace/tools/doc/tcpsynbl_example.txt
/usr/share/bpftrace/tools/doc/threadsnoop_example.txt
/usr/share/bpftrace/tools/doc/vfscount_example.txt
/usr/share/bpftrace/tools/doc/vfsstat_example.txt
/usr/share/bpftrace/tools/doc/writeback_example.txt
/usr/share/bpftrace/tools/doc/xfsdist_example.txt
/usr/share/bpftrace/tools/execsnoop.bt
/usr/share/bpftrace/tools/gethostlatency.bt
/usr/share/bpftrace/tools/killsnoop.bt
/usr/share/bpftrace/tools/loads.bt
/usr/share/bpftrace/tools/mdflush.bt
/usr/share/bpftrace/tools/naptime.bt
/usr/share/bpftrace/tools/oomkill.bt
/usr/share/bpftrace/tools/opensnoop.bt
/usr/share/bpftrace/tools/pidpersec.bt
/usr/share/bpftrace/tools/runqlat.bt
/usr/share/bpftrace/tools/runqlen.bt
/usr/share/bpftrace/tools/setuids.bt
/usr/share/bpftrace/tools/statsnoop.bt
/usr/share/bpftrace/tools/swapin.bt
/usr/share/bpftrace/tools/syncsnoop.bt
/usr/share/bpftrace/tools/syscount.bt
/usr/share/bpftrace/tools/tcpaccept.bt
/usr/share/bpftrace/tools/tcpconnect.bt
/usr/share/bpftrace/tools/tcpdrop.bt
/usr/share/bpftrace/tools/tcplife.bt
/usr/share/bpftrace/tools/tcpretrans.bt
/usr/share/bpftrace/tools/tcpsynbl.bt
/usr/share/bpftrace/tools/threadsnoop.bt
/usr/share/bpftrace/tools/vfscount.bt
/usr/share/bpftrace/tools/vfsstat.bt
/usr/share/bpftrace/tools/writeback.bt
/usr/share/bpftrace/tools/xfsdist.bt
/usr/share/doc/bpftrace
/usr/share/doc/bpftrace/CONTRIBUTING-TOOLS.md
/usr/share/doc/bpftrace/README.md
/usr/share/doc/bpftrace/reference_guide.md
/usr/share/doc/bpftrace/tutorial_one_liners.md
/usr/share/licenses/bpftrace
/usr/share/licenses/bpftrace/LICENSE
/usr/share/man/man8/bashreadline.8.gz
/usr/share/man/man8/biolatency.8.gz
/usr/share/man/man8/biosnoop.8.gz
/usr/share/man/man8/biostacks.8.gz
/usr/share/man/man8/bitesize.8.gz
/usr/share/man/man8/bpftrace.8.gz
/usr/share/man/man8/capable.8.gz
/usr/share/man/man8/cpuwalk.8.gz
/usr/share/man/man8/dcsnoop.8.gz
/usr/share/man/man8/execsnoop.8.gz
/usr/share/man/man8/gethostlatency.8.gz
/usr/share/man/man8/killsnoop.8.gz
/usr/share/man/man8/loads.8.gz
/usr/share/man/man8/mdflush.8.gz
/usr/share/man/man8/naptime.8.gz
/usr/share/man/man8/oomkill.8.gz
/usr/share/man/man8/opensnoop.8.gz
/usr/share/man/man8/pidpersec.8.gz
/usr/share/man/man8/runqlat.8.gz
/usr/share/man/man8/runqlen.8.gz
/usr/share/man/man8/setuids.8.gz
/usr/share/man/man8/statsnoop.8.gz
/usr/share/man/man8/swapin.8.gz
/usr/share/man/man8/syncsnoop.8.gz
/usr/share/man/man8/syscount.8.gz
/usr/share/man/man8/tcpaccept.8.gz
/usr/share/man/man8/tcpconnect.8.gz
/usr/share/man/man8/tcpdrop.8.gz
/usr/share/man/man8/tcplife.8.gz
/usr/share/man/man8/tcpretrans.8.gz
/usr/share/man/man8/tcpsynbl.8.gz
/usr/share/man/man8/threadsnoop.8.gz
/usr/share/man/man8/vfscount.8.gz
/usr/share/man/man8/vfsstat.8.gz
/usr/share/man/man8/writeback.8.gz
/usr/share/man/man8/xfsdist.8.gz
/usr/bin/bpftrace
/usr/lib/.build-id
/usr/lib/.build-id/a2
/usr/lib/.build-id/a2/b17d3d9e05882430ac9368597a10545774fcb7
/usr/share/bpftrace
/usr/share/bpftrace/tools
/usr/share/bpftrace/tools/bashreadline.bt
/usr/share/bpftrace/tools/biolatency.bt
/usr/share/bpftrace/tools/biosnoop.bt
/usr/share/bpftrace/tools/biostacks.bt
/usr/share/bpftrace/tools/bitesize.bt
/usr/share/bpftrace/tools/capable.bt
/usr/share/bpftrace/tools/cpuwalk.bt
/usr/share/bpftrace/tools/dcsnoop.bt
/usr/share/bpftrace/tools/doc
/usr/share/bpftrace/tools/doc/bashreadline_example.txt
/usr/share/bpftrace/tools/doc/biolatency_example.txt
/usr/share/bpftrace/tools/doc/biosnoop_example.txt
/usr/share/bpftrace/tools/doc/biostacks_example.txt
/usr/share/bpftrace/tools/doc/bitesize_example.txt
/usr/share/bpftrace/tools/doc/capable_example.txt
/usr/share/bpftrace/tools/doc/cpuwalk_example.txt
/usr/share/bpftrace/tools/doc/dcsnoop_example.txt
/usr/share/bpftrace/tools/doc/execsnoop_example.txt
/usr/share/bpftrace/tools/doc/gethostlatency_example.txt
/usr/share/bpftrace/tools/doc/killsnoop_example.txt
/usr/share/bpftrace/tools/doc/loads_example.txt
/usr/share/bpftrace/tools/doc/mdflush_example.txt
/usr/share/bpftrace/tools/doc/naptime_example.txt
/usr/share/bpftrace/tools/doc/oomkill_example.txt
/usr/share/bpftrace/tools/doc/opensnoop_example.txt
/usr/share/bpftrace/tools/doc/pidpersec_example.txt
/usr/share/bpftrace/tools/doc/runqlat_example.txt
/usr/share/bpftrace/tools/doc/runqlen_example.txt
/usr/share/bpftrace/tools/doc/setuids_example.txt
/usr/share/bpftrace/tools/doc/statsnoop_example.txt
/usr/share/bpftrace/tools/doc/swapin_example.txt
/usr/share/bpftrace/tools/doc/syncsnoop_example.txt
/usr/share/bpftrace/tools/doc/syscount_example.txt
/usr/share/bpftrace/tools/doc/tcpaccept_example.txt
/usr/share/bpftrace/tools/doc/tcpconnect_example.txt
/usr/share/bpftrace/tools/doc/tcpdrop_example.txt
/usr/share/bpftrace/tools/doc/tcplife_example.txt
/usr/share/bpftrace/tools/doc/tcpretrans_example.txt
/usr/share/bpftrace/tools/doc/tcpsynbl_example.txt
/usr/share/bpftrace/tools/doc/threadsnoop_example.txt
/usr/share/bpftrace/tools/doc/vfscount_example.txt
/usr/share/bpftrace/tools/doc/vfsstat_example.txt
/usr/share/bpftrace/tools/doc/writeback_example.txt
/usr/share/bpftrace/tools/doc/xfsdist_example.txt
/usr/share/bpftrace/tools/execsnoop.bt
/usr/share/bpftrace/tools/gethostlatency.bt
/usr/share/bpftrace/tools/killsnoop.bt
/usr/share/bpftrace/tools/loads.bt
/usr/share/bpftrace/tools/mdflush.bt
/usr/share/bpftrace/tools/naptime.bt
/usr/share/bpftrace/tools/oomkill.bt
/usr/share/bpftrace/tools/opensnoop.bt
/usr/share/bpftrace/tools/pidpersec.bt
/usr/share/bpftrace/tools/runqlat.bt
/usr/share/bpftrace/tools/runqlen.bt
/usr/share/bpftrace/tools/setuids.bt
/usr/share/bpftrace/tools/statsnoop.bt
/usr/share/bpftrace/tools/swapin.bt
/usr/share/bpftrace/tools/syncsnoop.bt
/usr/share/bpftrace/tools/syscount.bt
/usr/share/bpftrace/tools/tcpaccept.bt
/usr/share/bpftrace/tools/tcpconnect.bt
/usr/share/bpftrace/tools/tcpdrop.bt
/usr/share/bpftrace/tools/tcplife.bt
/usr/share/bpftrace/tools/tcpretrans.bt
/usr/share/bpftrace/tools/tcpsynbl.bt
/usr/share/bpftrace/tools/threadsnoop.bt
/usr/share/bpftrace/tools/vfscount.bt
/usr/share/bpftrace/tools/vfsstat.bt
/usr/share/bpftrace/tools/writeback.bt
/usr/share/bpftrace/tools/xfsdist.bt
/usr/share/doc/bpftrace
/usr/share/doc/bpftrace/CONTRIBUTING-TOOLS.md
/usr/share/doc/bpftrace/README.md
/usr/share/doc/bpftrace/reference_guide.md
/usr/share/doc/bpftrace/tutorial_one_liners.md
/usr/share/licenses/bpftrace
/usr/share/licenses/bpftrace/LICENSE
/usr/share/man/man8/bashreadline.8.gz
/usr/share/man/man8/biolatency.8.gz
/usr/share/man/man8/biosnoop.8.gz
/usr/share/man/man8/biostacks.8.gz
/usr/share/man/man8/bitesize.8.gz
/usr/share/man/man8/bpftrace.8.gz
/usr/share/man/man8/capable.8.gz
/usr/share/man/man8/cpuwalk.8.gz
/usr/share/man/man8/dcsnoop.8.gz
/usr/share/man/man8/execsnoop.8.gz
/usr/share/man/man8/gethostlatency.8.gz
/usr/share/man/man8/killsnoop.8.gz
/usr/share/man/man8/loads.8.gz
/usr/share/man/man8/mdflush.8.gz
/usr/share/man/man8/naptime.8.gz
/usr/share/man/man8/oomkill.8.gz
/usr/share/man/man8/opensnoop.8.gz
/usr/share/man/man8/pidpersec.8.gz
/usr/share/man/man8/runqlat.8.gz
/usr/share/man/man8/runqlen.8.gz
/usr/share/man/man8/setuids.8.gz
/usr/share/man/man8/statsnoop.8.gz
/usr/share/man/man8/swapin.8.gz
/usr/share/man/man8/syncsnoop.8.gz
/usr/share/man/man8/syscount.8.gz
/usr/share/man/man8/tcpaccept.8.gz
/usr/share/man/man8/tcpconnect.8.gz
/usr/share/man/man8/tcpdrop.8.gz
/usr/share/man/man8/tcplife.8.gz
/usr/share/man/man8/tcpretrans.8.gz
/usr/share/man/man8/tcpsynbl.8.gz
/usr/share/man/man8/threadsnoop.8.gz
/usr/share/man/man8/vfscount.8.gz
/usr/share/man/man8/vfsstat.8.gz
/usr/share/man/man8/writeback.8.gz
/usr/share/man/man8/xfsdist.8.gz

References

Summary

In this tutorial we learn how to install bpftrace on Fedora 34 using yum and dnf.