By using AWS re:Post, you agree to the AWS re:Post Terms of Use

How do I upgrade my standard Amazon Linux 2 kernel version 4.14.x to Amazon Linux Extra kernel versions?

3 minute read
1

I want to upgrade my standard Amazon Linux 2 kernel version 4.14.x to the Amazon Linux Extra versions 5.4.x, 5.10.x, or 5.15.x.

Short description

The default kernel installed on Amazon Linux 2 instances is 4.14.x. You can upgrade the default kernel to an Amazon Linux Extra kernel version 5.4.x, 5.10.x, or 5.15x.

Note: You can upgrade directly from Amazon Linux 2 kernel version 4.14.x directly to 5.10.x or 5.15.x. You don't need to upgrade to 5.4.x first. For more information, see Amazon Linux 2 supported kernels.

Resolution

To upgrade your Amazon Linux 2 default kernel from 4.14.x to Amazon Linux Extra kernel 5.10.x, complete the following steps:

  1. Review the current active kernel version. In the following example, the current system kernel version is 4.14.268-205.500.

    [ec2-user@kernel-upgrade ~]$ uname -r
    4.14.268-205.500.amzn2.x86_64
  2. Patch your Amazon Linux so that it's up to date, and then reboot:

    [ec2-user@kernel-upgrade ~]$ sudo yum -y upgrade
    [ec2-user@kernel-upgrade ~]$ sudo reboot
  3. Review the kernel versions that the amazon-linux-extras repository offers:

    [ec2-user@kernel-upgrade ~]$ sudo amazon-linux-extras | grep kernel
      _  kernel-5.4               available    [ =stable ]
     55  kernel-5.10              available    [ =stable ]
     62  kernel-5.15              available    [ =stable ]

    This output lists the three kernel options available from the Amazon Linux Extra repository:

    • kernel-5.4
    • kernel-5.10
    • kernel-5.15
  4. To install the kernel 5.10, use the amazon-linux-extras tool:

    sudo amazon-linux-extras install kernel-5.10 -y
  5. After the installation completes, verify that the state is changed in amazon-linux-extras:

    [ec2-user@kernel-upgrade ~]$ sudo amazon-linux-extras |grep kernel
      _  kernel-5.4               available    [ =stable ]
     55  kernel-5.10=latest       enabled      [ =stable ]
     62  kernel-5.15              available    [ =stable ]

    The following output line shows that the state is changed from available to enabled:

     55  kernel-5.10=latest       enabled      [ =stable ]
  6. Verify the installed kernels from the RPM database:

    [ec2-user@kernel-upgrade ~]$ rpm -qa | grep kernel
    kernel-tools-4.14.268-205.500.amzn2.x86_64
    kernel-4.14.268-205.500.amzn2.x86_64
    kernel-5.10.201-191.748.amzn2.x86_64
    kernel-tools-5.10.201-191.748.amzn2.x86_64

    There are now two different kernel versions available: kernel-4.14.268-205.500 and 5.10.201-191.748.

    The following example shows that the old kernel is still active:

    [ec2-user@kernel-upgrade ~]$ uname -r
    4.14.268-205.500.amzn2.x86_64
  7. To activate the latest installed kernel version, reboot the instance:

    [ec2-user@kernel-upgrade ~]$ sudo reboot
  8. Log in to the instance again, and then verify that the new kernel is active:

    [ec2-user@kernel-upgrade ~]$ uname -r
    5.10.201-191.748.amzn2.x86_64

Note: To upgrade the Amazon Linux 2 kernel from 5.10.x to Amazon Linux Extra 5.15.x, follow the same steps that are detailed in this article. Replace 5.10 with 5.15 in the example commands used in this article.

AWS OFFICIAL
AWS OFFICIALUpdated 4 months ago
5 Comments

We followed this guide and trying to upgrade from 5.4 to 5.10, but it is not working. The rpm -qa |grep kernel command does not show 5.10 installed, but udo amazon-linux-extras |grep kernel shows it as enabled. Pls help

replied 2 years ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

profile pictureAWS
MODERATOR
replied 2 years ago

Hi AWS team can some one respond for the upgrade of the kernel version from 5.10 to 5.15?

replied 2 years ago

Hi AWS Team! I'm facing the same issue that @rePost-User-5383065 mentioned. Is there any update on this?

profile picture
replied a year ago

I was able to migrate the kernel from version 5.4 to 5.10.

TL;DR

Execute the following steps before attempting to install the new kernel version:

$ sudo yum versionlock list # Find if kernel packages are locked there
$ sudo yum versionlock delete <<KERNEL_PACKAGE>>

Long Explanation

yum-versionlock is a Yum plugin that takes a set of name/versions for packages and excludes all other versions of those packages. This allows you to protect packages from being updated by newer versions.

  1. Try to update the kernel using yum and notice that the plugin versionlock is loaded:

$ sudo yum update kernel

  1. Check if there are any packages locked to their installed versions:

$ sudo yum versionlock list

  1. Discard the list of locked packages, and retry the kernel upgrade:

$ sudo yum versionlock delete <<PACKAGE>>

3.1. [OPTIONAL] To clear all the locked packages use the below command:

$ sudo yum versionlock clear

  1. To display and confirm that the kernel is not locked run the below command:

$ sudo yum versionlock list

  1. Continue installing the new kernel.
profile picture
replied a year ago