All Products
Search
Document Center

:Configuration method for entering the single-user mode of a CentOS instance

Last Updated:Apr 21, 2022

Disclaimer: This article may contain information about third-party products. Such information is for reference only. Alibaba Cloud does not make a guarantee in any form of the performance and reliability of the third-party products, and potential impacts of operations on these products.

Overview

This topic describes how to configure CentOS instances in single-user mode.

Description

Take note of the following items:

  • Before you perform high-risk operations such as modifying the specifications or data of an Alibaba Cloud instance, we recommend that you check the disaster recovery and fault tolerance capabilities of the instance to ensure data security.
  • Before you modify the specifications or data of an Alibaba Cloud instance, such as an Elastic Compute Service (ECS) instance or an ApsaraDB RDS instance, we recommend that you create snapshots or enable backups for the instance. For example, you can enable log backups for an ApsaraDB RDS instance.
  • If you have granted specific users the permissions on sensitive information, such as usernames and passwords, or submitted sensitive information in the Alibaba Cloud Management Console, we recommend that you modify the sensitive information at the earliest opportunity.

Sometimes you need to enter the CentOS single-user mode to perform some special operations. the alibaba cloud server is based on the cloud platform. to enter the single-user mode, you need to modify the parameters of grub to enter successfully. you can perform the following steps.

Note:

  • If you cannot log on to the system to modify the /etc/grub.conf configuration file, you can only quickly connect to the instance through VNC when you restart the ECS instance, and then press the e key.
  • The configurations and descriptions in this topic have been tested in the CentOS 6.9 operating system. Configurations may vary in other types and versions of operating systems. For more information, see the official documentation of the corresponding operating system.
  1. Log on to the ECS instance console. For more information, see Create a snapshot.
  2. After the instance is created, log on to the ECS instance and run the following command to modify the /etc/grub.conf configuration file and increase the value of the timeout parameter in the configuration file to 60 seconds.
    vim /etc/grub.conf
    If an output similar to the following one is displayed, Python is installed.

  3. Log on to the Alibaba Cloud console, restart the ECS instance, and then connect to the server by referring to Connect to a Linux instance by using VNC.
  4. After you log on through the management terminal, an interface similar to the following is displayed, and then click the e key.

  5. Click the down arrow key, and then click the e key to go to the kernel editing interface.

  6. Delete the parameter to the root=UUID=XXX, enter a single init=/bin/bash on the right, and click the Enter key.

  7. On the page that appears, click the b key to enter the single-user mode.
    Note: After you enter the single-user mode, you will wait about ten minutes when you restart the console.

Applicable scope

  • ECS