![在内核 4.19.232 的 linux-tools-common 中找不到 linux bpftool](https://linux22.com/image/214210/%E5%9C%A8%E5%86%85%E6%A0%B8%204.19.232%20%E7%9A%84%20linux-tools-common%20%E4%B8%AD%E6%89%BE%E4%B8%8D%E5%88%B0%20linux%20bpftool.png)
我正在尝试检查是否bpf
已正确安装在我的 Linux 内核中。它在内核中启用,如下所示:
jakew@desktop:~$ cat config | grep BPF
CONFIG_CGROUP_BPF=y
CONFIG_BPF=y
CONFIG_BPF_SYSCALL=y
CONFIG_BPF_JIT_ALWAYS_ON=y
# CONFIG_BPF_UNPRIV_DEFAULT_OFF is not set
CONFIG_IPV6_SEG6_BPF=y
CONFIG_NETFILTER_XT_MATCH_BPF=y
CONFIG_BPFILTER=y
CONFIG_BPFILTER_UMH=m
CONFIG_NET_CLS_BPF=y
CONFIG_NET_ACT_BPF=y
CONFIG_BPF_JIT=y
CONFIG_BPF_STREAM_PARSER=y
CONFIG_LWTUNNEL_BPF=y
CONFIG_HAVE_EBPF_JIT=y
CONFIG_BPF_EVENTS=y
# CONFIG_TEST_BPF is not set
我尝试安装bpftool
以检查bpf
,似乎我需要通过 linux_tools_common 来安装它:sudo apt install linux_tools_common
。当我尝试运行时bpftool
,它显示了以下错误:
WARNING: bpftool not found for kernel 4.19.232
You may need to install the following packages for this specific kernel:
linux-tools-4.19.232-4.19.232
linux-cloud-tools-4.19.232-4.19.232
You may also want to install one of the following packages to keep up to date:
linux-tools-4.19.232
linux-cloud-tools-4.19.232
但是,sudo apt install linux-tools-4.19.232
显示错误说找不到包。
不知道如何开始bpftool
工作以便能够进行更多探索bpf
?
谢谢
答案1
这可能更容易从源安装。这样您也一定会拥有最新版本。
git clone --recurse-submodules https://github.com/libbpf/bpftool.git
cd bpftool/src
make -j$(nproc)
sudo ./bpftool prog