Skip to content

bpftool not found for kernel 6.5.0-26 #1

Description

@lneto

Firstly, thank you very much for this example! I'm opening this issue because it might be useful for others. I tried to run it on Ubuntu 22.04 with kernel 6.5 and I needed to update linux-tools as described below:

$ uname -a
Linux ubuntu 6.5.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Mar 12 19:16:50 UTC 2 aarch64 aarch64 aarch64 GNU/Linux
$ make
bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h
WARNING: bpftool not found for kernel 6.5.0-26

  You may need to install the following packages for this specific kernel:
    linux-tools-6.5.0-26-generic
    linux-cloud-tools-6.5.0-26-generic

  You may also want to install one of the following packages to keep up to date:
    linux-tools-generic
    linux-cloud-tools-generic
make: *** [Makefile:4: vmlinux] Error 2
$ sudo apt-get install linux-tools-6.5.0-26-generic
$ make
bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h
clang -target bpf -Wall -O2 -c example.bpf.c
bpftool gen skeleton example.bpf.o > example.skel.h
gcc -Wall -o test test.c -lbpf
$ sudo ./test
[success] drop ICMP packets
[success] pass non-ICMP packets

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions