Search code examples
amazon-web-servicesamazon-eksamazon-ami

Building custom AWS AMI with kernel 5.0.0-23-generic


I am trying to build an AMI with an specific linux kernel (5.0.0-23-generic) for AWS EKS.

Till now, I have followed the instructions available on: https://github.com/aws-samples/amazon-eks-custom-amis. This assumes usage of packer to build automated machine images.

I have built an Ubuntu 18.04 AMI, but on closer inspection, kernel 5.4 is used on the deployed EC2 Instance. Using the previous solution, I didn't find a way to name a specific kernel.

Are there any solutions to achieve the purpose of deploying an EKS compatible AMI with kernel 5.0.0-23-generic?


Solution

  • I've downgraded kernel to 5.0.0-23-generic from 5.4 using the following set of commands after AMI deployment:

    $ apt update
    $ apt install -y linux-image-5.0.0-23-generic
    $ apt install -y linux-headers-5.0.0-23-generic
    $ apt install -y linux-modules-extra-5.0.0-23-generic
    $ apt install -y linux-tools-5.0.0-23-generic
    $ apt install -y linux-cloud-tools-5.0.0-23-generic
    $ apt install -y make build-essential
    $ sed -i 's/GRUB_DEFAULT=[0-9]*/GRUB_DEFAULT="1>2"/g' /etc/default/grub
    $ update-grub
    $ reboot