All Products
Document Center

:How to modify the boot sequence of the Linux kernel

Last Updated:Dec 15, 2020

Disclaimer: this document may contain information about third-party products that are for reference only. Alibaba Cloud does not make any guarantee, express or implied, with respect to the performance and reliability of third-party products, as well as potential impacts of operations on the products.



This article describes how to modify the boot sequence of the Linux kernel.


Detailed information

Alibaba Cloud reminds you that:

  • If you have any risky operations on an instance or data, pay attention to the disaster tolerance and fault tolerance capabilities of the instance to ensure data security.
  • If you modify the configuration and data of an instance (including but not limited to ECS and RDS), we recommend that you create snapshots or enable RDS log backup.
  • If you have granted permissions on the Alibaba Cloud platform or submitted security information such as the logon account and password, we recommend that you modify the information as soon as possible.

Related configurations and descriptions in this article have been tested in CentOS6.X and centos7.0. The operating system configurations of other types and versions may be different. For more information, see the official documentation of the operating system.


CentOS6.X: changes the startup sequence of the kernel

  1. By connect to a Linux instance by using a management Terminal connect to the ECS instance, and view /etc/grub.conf confirm the system kernel. The following figure shows that the system has two kernels. The kernel versions from top to bottom are 2.6.32-573.18.1.el6.x86 _64 and 2.6.32-431.23.3.el6.x86 _64 respectively.

  2. The parameter that determines which kernel version to use for boot in the grub.conf file is default. The default value is 0, indicating to boot from the latest kernel. Indicates that the number of started kernel versions is 0, 1, 2, and so on from top to bottom.
  3. If you want to start from an earlier kernel, that is, the initial kernel, change the default value of 1 to 1, and restart the server to boot from the new kernel.


CentOS 7.0 changes the startup sequence of the kernel

CentOS7 uses grub2 as the bootstrapper and therefore differs from CentOS6. /etc/grub.conf to adjust startup items.

  1. Run the following command to check how many cores the system has.
    cat /boot/grub2/grub.cfg |grep menuentry
    A similar output is displayed, where the middle of the quotation marks is the kernel name.

  2. Run the following command to configure startup from the default kernel. Replace the kernel name with the actual name obtained internally.
    grub2-set-default “CentOS Linux (3.10.0-123.9.3.el7.x86_64) 7 (Core)" 
  3. Run the following command to confirm that the configuration is successful:
    grub2-editenv list
    A similar output is displayed.


Applicable to

  • Elastic Compute Service