执行/usr/share/bcc/tools/filetop -C报错Exception: Failed to compile BPF module <text>

执行命令/usr/share/bcc/tools/filetop -C,报错:

modprobe: FATAL: Module kheaders not found.
Unable to find kernel headers. Try rebuilding kernel with CONFIG_IKHEADERS=m (module) or installing the kernel development package for your running kernel version.
chdir(/lib/modules/3.10.0-1127.18.2.el7.x86_64/build): No such file or directory
Traceback (most recent call last):
  File "./filetop", line 163, in <module>
    b = BPF(text=bpf_text)
  File "/usr/lib/python2.7/site-packages/bcc/__init__.py", line 359, in __init__
    raise Exception("Failed to compile BPF module %s" % (src_file or "<text>"))
Exception: Failed to compile BPF module <text>

解决方法:
1、http://rpmfind.net/linux/centos/7.8.2003/updates/x86_64/Packages
进入网址,搜索找到对应的内核版本的文件

2、使用命令下载对应版本的内核文件,我的内核版本是3.10.0-1127.18.2.el7.x86_64

wget http://rpmfind.net/linux/centos/7.8.2003/updates/x86_64/Packages/kernel-devel-3.10.0-1127.18.2.el7.x86_64.rpm

3、安装文件

rpm -Uvh kernel-devel-3.10.0-1127.18.2.el7.x86_64.rpm 

4、检查是否安装成功

ls /usr/src/kernels

在这里插入图片描述
5、再次执行/usr/share/bcc/tools/filetop -C,不报错了,问题解决在这里插入图片描述

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值