All Products
Search
Document Center

Alibaba Cloud Linux:What do I do if Alibaba Cloud Linux 3 that runs on an ECS instance cannot switch to an earlier kernel version?

Last Updated:Aug 06, 2024

This topic describes the cause of and solutions to the following issue: When you install a kernel version on an Elastic Compute Service (ECS) instance that runs Alibaba Cloud Linux 3 and the kernel version is earlier than the current kernel version on the instance, Alibaba Cloud Linux 3 cannot automatically switch to the earlier kernel version.

Problem description

An ECS instance runs an Alibaba Cloud Linux 3 image whose ID is aliyun_3_9_x64_20G_alibase_20231219.vhd or aliyun_3_9_x64_20G_dengbao_alibase_20231219.vhd. After you install a kernel version that is earlier than the current kernel version on the ECS instance and restart the instance, Alibaba Cloud Linux 3 that runs on the instance cannot automatically switch to the earlier kernel version.

Note
  • You can run the uname -r command to view the kernel version.

  • You can run the cat /etc/image-id command to view the ID and version of the image.

Cause

Alibaba Cloud Linux 3 loads files rather than symbolic links from the /boot/grub2/ directory at boot time. As a result, the GRand Unified Bootloader (GRUB) cannot obtain the grubenv file from the symbolic links and automatically boots the latest kernel version that is available on the ECS instance.

Note

grubenv in the /boot/grub2/ directory is a symbolic link that points to the grubenv file in the /boot/efi/EFI/alinux/ directory.

Solutions

You can use one of the following solutions to resolve the preceding issue based on whether you run business on the ECS instance.

  • If you run business on the ECS instance and do not want to replace the image of the instance, you can use Solution 1 to resolve the issue.

  • If you do not run business on the ECS instance, you can use Solution 2 to resolve the issue.

Solution 1: Replace the grubenv symbolic link with the /boot/efi/EFI/alinux/grubenv file

  1. Run the following command to delete the grubenv symbolic link:

    sudo rm /boot/grub2/grubenv
  2. Enter y and press the Enter key to confirm the deletion.

  3. Run the following command to copy the grubenv file from the /boot/efi/EFI/alinux/ directory to the /boot/grub2/ directory:

    sudo cp /boot/efi/EFI/alinux/grubenv /boot/grub2/
  4. Run the following command to restart the ECS instance:

    sudo reboot

Solution 2: Replace the image of the ECS instance with an Alibaba Cloud Linux 3.2104 U9.1 or later image

For information about Alibaba Cloud Linux 3 image versions, see Release notes for Alibaba Cloud Linux 3.