Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Elastic Cloud Server/ FAQs/ OS/ How Can I Upgrade the Kernel of a Linux ECS?

How Can I Upgrade the Kernel of a Linux ECS?

Updated on 2025-01-10 GMT+08:00

Scenario

If the kernel of a Linux ECS has stability or performance issues such as system breakdown, freezing, and memory leakage, or new kernel functions are required, you can upgrade the OS kernel.

Constraints

CAUTION:

Upgrading the OS kernel may cause system instability or compatibility issues. Before the upgrade, you should know the problems that may occur during the upgrade, back up important data, and perform the upgrade with caution.

For details about how to back up the ECS, see Backup Overview.

  • After the OS kernel is upgraded, the Linux ECS may not be able to identify the network interfaces. This will lead to network access failure.
  • After the OS kernel is upgraded, the Linux ECS may not be able to identify data disks. As a result, starting system mount points fails, and the ECS cannot start.

Procedure

This section uses the Huawei Cloud EulerOS, CentOS, Ubuntu, and Debian as examples to describe how to update the OS kernel.

Upgrading the Kernel (Huawei Cloud EulerOS or CentOS)

  1. Log in to the ECS.
  2. Run the following command to query the OS kernel version:

    uname -r

  3. Run the following command to check whether there is any OS kernel that can be upgraded:

    sudo yum list kernel

    • If no OS kernel can be upgraded:
      You are advised to replace the OS with Huawei Cloud EulerOS 2.0. For details, see Changing the OS.
      NOTE:

      CentOS 6, CentOS 7, and CentOS 8 are no longer maintained and will not be supported by Huawei Cloud. For details, see What Do I Do If CentOS Linux Is No Longer Maintained?

    • If there is an OS kernel that can be upgraded:
      1. Run the following command to check whether the initrd or initramfs file contains the virtio-blk or xen-blkfront driver:

        sudo lsinitrd /boot/initramfs-`uname -r`.img | grep -E 'virtio|xen'

        If information similar to the following is displayed, the virtio-blk or xen-blkfront driver is contained. Otherwise, the driver is not included. Go to the next step.

        -rwxr--r--   1 root     root        23888 Feb 10  2022 lib/modules/2.6.32-754.35.1.el6.x86_64/kernel/drivers/block/virtio_blk.ko
        -rwxr--r--   1 root     root        55064 Feb 10  2022 lib/modules/2.6.32-754.35.1.el6.x86_64/kernel/drivers/block/xen-blkfront.ko
      2. (Optional) Run the following command to add the virtio-blk or xen-blkfront driver to the initrd or initramfs file.

        Perform this step only when the initrd or initramfs file does not contain the virtio-blk or xen-blkfront driver.

        sudo sh -c 'echo 'add_drivers+="xen-blkfront virtio_blk"' >> /etc/dracut.conf.d/virt-drivers.conf'

  4. Run the following command to upgrade the OS kernel version:

    sudo yum update -y

  5. Run the following command to update the GRUB file so that the ECS can select the target kernel version during startup:

    sudo grub2-mkconfig -o /boot/grub2/grub.cfg

  6. Run the following command to restart the ECS:

    sudo reboot

  7. Run the following command to check whether the kernel version has been upgraded:

    uname -r

    If the new kernel version is returned, the kernel has been upgraded.

Upgrading the Kernel (Ubuntu or Debian)

  1. Log in to the ECS.
  2. Run the following command to query the OS kernel version:

    uname -r

  3. Run the following commands to update the system software package list and check whether the OS kernel can be upgraded:

    sudo apt update

    apt-cache search linux-image

    • If no OS kernel can be upgraded:

      You are advised to change the OS kernel to a later version. For details, see Changing the OS.

    • If there is an OS kernel that can be upgraded:
      1. Run the following command to upgrade the OS kernel version:

        sudo apt-get install linux-image-<target-kernel-package-name>

      2. (Optional) Upgrade the additional modules of the OS kernel.

        For an ECS running Ubuntu, you need to upgrade additional modules after the OS kernel is upgraded.

        sudo apt-get install linux-modules-extra-<target-kernel-package-name>

        For example, to update the kernel of Ubuntu 20.04 to 5.15.0, run the following commands:

        sudo apt update

        apt-cache search linux-image | grep '5.15' | grep generic

        sudo apt-get install linux-image-5.15.0-122-generic

        sudo apt-get install linux-modules-extra-5.15.0-122-generic

  4. Run the following command to update the GRUB file so that the ECS can select the kernel version during startup.

    sudo update-grub

  5. Run the following command to restart the ECS:

    sudo reboot

  6. Run the following command to check whether the kernel version has been upgraded:

    uname -r

    If the new kernel version is returned, the kernel has been upgraded.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback