Why does the agent install fail with "kernel headers cannot be found"?

During an agent installation in an Amazon machine image (AMI) you may encounter the following errors while the installer is trying to compile the Sysdig kernel module: "Unable to find kernel development files for the current kernel version" and "FATAL: Module sysdigcloud-probe not found".

This indicates your machine is running a kernel in an older AMI for which the kernel headers are no longer available in the configured repositories. The issue has to do with Amazon purging packages in the yum repository when new Amazon Linux machine images are released.

The solution is to either update your kernel for which header files are readily available (recommended) or perform a one-time installation of the kernel headers for your older AMI.

Upgrade Your Host's Kernel

The following commands should fix the issue. The first two commands will install a new kernel and reboot your instance:

sudo yum -y install kernelsudo reboot

After rebooting, you may need to issue these remaining 3 commands to install the required header files if the above kernel update did not already add them. Check to see if your host is reporting metrics to your account first and if not, issue:

Install Older Kernel Headers

Although it is recommended to upgrade to the latest kernel for security and performance reasons, you can alternatively install the older headers for your AMI. Use the commands below to find the the AMI version string and install the appropriate headers: