On Alibaba Cloud Linux 3, simulating network conditions such as latency or packet loss requires the sch_netem kernel module. This article describes how to fix the missing sch_netem module on kernels older than 5.10.134-16.
sch_netem is a Linux kernel module for network emulation. It simulates network latency and packet loss for use cases such as network performance testing and Quality of Service (QoS) configuration.
Problem description
When you load sch_netem using modprobe, the system returns an error similar to the following:
# modprobe sch_netem
modprobe: FATAL: Module sch_netem not found in directory /lib/modules/5.10.134-14.al8.x86_64
Cause
Alibaba Cloud Linux 3 distributes kernel modules across multiple RPM packages: kernel-core, kernel-modules, kernel-modules-extra, and kernel-modules-internal. The sch_netem module is included in kernel-modules-extra. Because the default image build and kernel installation include only kernel-core and kernel-modules, the sch_netem module is absent from the system.
Solution
This issue is fixed in kernel version 5.10.134-16. Run uname -r to check your current kernel version.
For earlier kernel versions, install the kernel-modules-extra package for your running kernel:
sudo yum install -y kernel-modules-extra-$(uname -r)
The kernel-modules-internal package contains additional optional modules. To avoid similar issues with other modules, install it as well:
sudo yum install -y kernel-modules-internal-$(uname -r)