Checking the eBPF Environment
- The kernel version of the OS must be 4.1 or later.
- If lock and wait analysis is still not supported after you modify the environment configuration, use openEuler 20.03 (LTS).
- Tasks can run in Docker containers only when the host machine supports extended Berkeley Packet Filter (eBPF).
- The System Profiler is run by common users. Check that common users have the read permission on the /boot/config-$(uname -r) file.
Checking the Environment Configuration
To run tasks in a Docker container, copy the kernel header file and kernel configuration file from the host to the container.
docker exec container_name mkdir -p /lib/modules/$(uname -r) && docker cp -L /lib/modules/$(uname -r)/build container_name:/lib/modules/$(uname -r) docker exec container_name mkdir -p /boot && docker cp -L /boot/config-$(uname -r) container_name:/boot docker cp -L /proc/config.gz container_name:/proc/config.gz
Run either of the second and third commands based on the actual situation.
- Check kernel parameters.
Run the zcat /proc/config.gz or cat /boot/config-$(uname -r) command to check the kernel parameter settings. The following lists eBPF parameters. If the kernel parameters are inconsistent, reconfigure them and recompile the kernel or reinstall the system.
1 2 3 4 5 6
CONFIG_BPF=y CONFIG_BPF_SYSCALL=y CONFIG_BPF_JIT=y CONFIG_HAVE_BPF_JIT=y # When the kernel version is within the range of 4.1 to 4.6 CONFIG_HAVE_EBPF_JIT=y # When the kernel version is 4.7 or later CONFIG_BPF_EVENTS=y
Figure 1 Viewing kernel parameters
- Check the header file directory of the kernel.
1ll /lib/modules/$(uname -r)/build
Check whether the build directory contains a file that points to kernel source files. If yes, the condition is met. Otherwise, the condition is not met.
Figure 2 No such file
Figure 3 Containing such file
- Reinstall the kernel header file if the build directory does not contain a file that points to kernel source files.
On CentOS:
1yum install kernel-headers kernel-headers.aarch64
On Ubuntu:
1sudo apt-get install linux-headers-$(uname -r)
If the file still cannot be found, manually link /usr/src/kernels/$(uname -r).
Parent topic: Common Operations