CentOS-8.5
kernel:4.18.0-348.7.1.el8_5.x86_64
https://sourceware.org/systemtap/SystemTap_Beginners_Guide.pdf
yum install systemtap systemtap-runtime
## systemtap提供的依赖安装脚本,但不一定能成功
stap-prep
stap-prep后报错,原因是相关的包没有找到
根据stap-prep的报错新中 Need to install the following packages 列出的包名,一个一个下载。
ps:我是一个一个下载的,因为直接用yum有两个问题:
yum源里可能没有对应版本
貌似yum不会给你匹配版本?
最终我下载了以下文件
[root@MiWiFi-RA80-srv install]# ll -h
总用量 1.4G
-rw-r--r--. 1 root root 596M 6月 26 00:33 kernel-debuginfo-4.18.0-348.7.1.el8_5.x86_64.rpm
-rw-r--r--. 1 root root 89M 12月 22 2021 kernel-debuginfo-common-x86_64-4.18.0-348.7.1.el8_5.x86_64.rpm
-rw-r--r--. 1 root root 20M 12月 22 2021 kernel-devel-4.18.0-348.7.1.el8_5.x86_64.rpm
各个包的作用:
kernel-modules-extra- 包含用于默认禁用加载的个别硬件和模块的内核模块。kernel-debug- 包含内核诊断启用大量调试选项的内核,但牺牲了性能降低。kernel-tools- 包含用于操作 Linux 内核和支持文档的工具。kernel-devel- 包含内核标头和 makefile,以根据kernel软件包构建模块。kernel-abi-stablelists- 包含与 RHEL 内核 ABI 相关的信息,包括外部 Linux 内核模块和yum插件辅助功能所需的内核符号列表。kernel-headers- 包含 C 标头文件,用于指定 Linux 内核与用户空间库和程序之间的接口。头文件定义了构建大多数标准程序所需的常量结构和常量。
最终yum list installed 相关的包列表如下
kernel.x86_64 4.18.0-348.7.1.el8_5 @anaconda
kernel-core.x86_64 4.18.0-348.7.1.el8_5 @anaconda
kernel-debuginfo.x86_64 4.18.0-348.7.1.el8_5 @System
kernel-debuginfo-common-x86_64.x86_64 4.18.0-348.7.1.el8_5 @System
kernel-devel.x86_64 4.18.0-348.7.1.el8_5 @@System
kernel-headers.x86_64 4.18.0-348.7.1.el8_5 @anaconda
kernel-modules.x86_64 4.18.0-348.7.1.el8_5 @anaconda
kernel-tools.x86_64 4.18.0-348.7.1.el8_5 @anaconda
kernel-tools-libs.x86_64 4.18.0-348.7.1.el8_5 @anaconda
systemtap.x86_64 4.7-1.el8 @AppStream
systemtap-client.x86_64 4.7-1.el8 @AppStream
systemtap-devel.x86_64 4.7-1.el8 @AppStream
systemtap-runtime.x86_64 4.7-1.el8 @AppStream
http://debuginfo.centos.org/8/x86_64/Packages/
https://centos.pkgs.org/8/centos-baseos-x86_64/kernel-devel-4.18.0-348.7.1.el8_5.x86_64.rpm.html
这一系列包安装完毕后,验证下:
[root@MiWiFi-RA80-srv install]# stap -v -e 'probe kernel.function("vfs_read") {printf("read performed\n"); exit()}'
Pass 1: parsed user script and 486 library scripts using 297392virt/96372res/17972shr/80104data kb, in 190usr/40sys/370real ms.
Pass 2: analyzed script: 2 probes, 1 function, 0 embeds, 0 globals using 356600virt/156440res/19016shr/139312data kb, in 980usr/320sys/1638real ms.
Pass 3: using cached /root/.systemtap/cache/41/stap_4156fc5c97e5fdb9782aa7bdda6aa73c_1355.c
Pass 4: using cached /root/.systemtap/cache/41/stap_4156fc5c97e5fdb9782aa7bdda6aa73c_1355.ko
Pass 5: starting run.
read performed
Pass 5: run completed in 20usr/30sys/367real ms.
##正确走了 Pass 5
同时再执行 stap-prep也不报错了
[root@MiWiFi-RA80-srv install]# stap-prep
Configuring for kernel release 4.18.0-348.7.1.el8_5.x86_64
Debuginfo automatic downloading is not configured via $DEBUGINFOD_URLS