Skip to content

bpftool does not build on newer kernel versions

I've seen the issue on Openshift build, rockylinux:8 latest versions and U22 latest kernel versions (6.5).

If your U22 host is still on 5.x kernel version or 6.2 kernel version, you should be OK.

How to reproduce: create a U22 VM:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install -y linux-image-6.5.0-15-generic
sudo reboot
....
uname -r
6.5.0-15-generic
...
sudo apt-get install -y git vim psmisc
git clone https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-upf.git
cd oai-cn5g-upf/
git checkout develop
git submodule update --init
cd build/scripts/
./build_upf --install-deps --force

Error message when building bpftool:

make[1]: Leaving directory '/home/ubuntu/oai-cn5g-upf/build/ext/linux-5.15/tools/lib/bpf'
  LINK    /home/ubuntu/oai-cn5g-upf/build/ext/linux-5.15/tools/bpf/bpftool/bootstrap/bpftool
  GEN     vmlinux.h
Error: failed to load BTF from /sys/kernel/btf/vmlinux: Invalid argument
make: *** [Makefile:158: vmlinux.h] Error 22
~/oai-cn5g-upf/build/scripts
Error: UPF deps installation failed