All Products
Search
Document Center

Alibaba Cloud Linux:What do I do if I cannot upgrade the kernel of an Alibaba Cloud Linux 2 ECS instance?

Last Updated:Dec 08, 2023

This topic describes the cause of the following issue and how to resolve the issue: You cannot upgrade the kernel of an Elastic Compute Service (ECS) instance that runs Alibaba Cloud Linux 2.

Problem description

When you upgrade the kernel of an Alibaba Cloud Linux 2 instance that meets the following conditions, the following grubby error messages are returned. After the kernel of the instance is upgraded, GRand Unified Bootloader (GRUB) startup items cannot be automatically updated and the new kernel feature cannot take effect.

  • Image: aliyun_2_1903_x64_20G_alibase_20200114.qboot.vhd (Qboot image)

  • Kernel version: 4.19.81-17.al7.x86_64

kernel-4.19.91-19.2.al7.x86_64.rpm                                                                                         |  14 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : kernel-4.19.91-19.2.al7.x86_64                                                                              1/1
grubby fatal error: unable to find a suitable template

Broadcast message from systemd-journald@iZbp1XXXXtbay7jZ (Fri 2020-07-31 15:38:45 CST):

dracut[2183]: Failed to install module xen_blkfront

Cause

The initramfs process is removed from the Qboot image startup process. After the instance is started, the following situations occur:

  • The /dev/root device is mounted on the / root directory in the /proc/mounts file.

  • The /dev/root symbolic link is not properly created.

During the kernel upgrade process, the grubby script cannot correctly recognize the device that is mounted on the root partition. As a result, the GRUB configuration information cannot be properly updated.

Solutions

Solution 1: Temporarily resolve the kernel upgrade issue

  • Resolve the "grubby fatal error" issue

    • Temporarily resolve the "grubby fatal error" issue

      Run the following command to create the /dev/root symbolic link:

      ln -sf /dev/vda1 /dev/root
    • Permanently resolve the "grubby fatal error" issue

      Run the following command to create a udev rule to automatically create the /dev/root symbolic link:

    • sed -i '/ACTION=="remove"/a\\n# create symbol link for /dev/root\nACTION!="remove", SUBSYSTEM=="block", ENV{MAJOR}=="254", ENV{MINOR}=="1", SYMLINK+="root"' /usr/lib/udev/rules.d/60-persistent-storage.rules
  • Resolve the "dracut failure" issue

    Run the following command to delete unnecessary dracut configuration files:

    rm -rf /etc/dracut.conf.d/*

Solution 2: Upgrade the image

Upgrade the image of the instance to aliyun_2_1903_x64_20G_qboot_alibase_20200904.vhd or later. The kernel upgrade issue is resolved in aliyun_2_1903_x64_20G_qboot_alibase_20200904.vhd and later Qboot images.