All Products
Search
Document Center

Elastic Compute Service:Boot a Linux ECS instance into single-user mode

Last Updated:Mar 29, 2024

In some scenarios, you may need to use GNU GRand Unified Bootloader (GRUB) to enter the single-user mode for operations like troubleshooting startup errors, configuring disk partitions, and changing the boot user password. In single-user mode, the system loads only basic components and services. You have the permissions of system administrators, which allow you to modify all system configurations to perform troubleshooting. This topic describes how to boot an ECS instance that runs Alibaba Cloud Linux, Debian, SUSE Linux Enterprise Server (SLES), or Ubuntu into single user mode.

Important

In single-user mode, critical configurations of the system can be modified, and misconfiguration may have severe impact on the system. Proceed with caution.

Procedure

The procedure for entering single-user mode varies across operating systems.

Alibaba Cloud Linux

In this example, an ECS instance that runs Alibaba Cloud Linux 3.2104 LTS 64-bit is used.

  1. Connect to the instance.

    For more information, see Connect to an instance by using VNC

    Note

    If you connect to an instance by using Workbench or SSH commands, you are not redirected to the system boot page when you restart the instance by using a command. Therefore, we recommend that you do not connect to an instance by using Workbench or SSH commands.

  2. Run the reboot command to restart the ECS instance and press e on the keyboard when the kernel selection screen appears.

    内核选项界面.png

  3. Move the cursor to the line that starts with linux and replace the content starting from ro with rw init=/bin/sh crashkernel=auto.

    进入单用户模式.png

  4. Press Ctrl+X or F10.

    The system boots into single-user mode.

    alibaba进入单用户模式.png

Debian

In this example, an ECS instance that runs Debian 12.2 64-bit is used.

  1. Connect to the instance.

    For more information, see Connect to an instance by using VNC

    Note

    If you connect to an instance by using Workbench or SSH commands, you are not redirected to the system boot page when you restart the instance by using a command. Therefore, we recommend that you do not connect to an instance by using Workbench or SSH commands.

  2. Run the reboot command to restart the ECS instance and press e on the keyboard when the kernel selection screen appears.

    db1

  3. Move the cursor down to the line that starts with linux and add single to the end of the line.

    db3

  4. Press Ctrl+X or F10 to start the system. Enter the password of the root user.

    The system boots into single-user mode.db4

SLES

In this example, an ECS instance that runs SLES 15 SP1 64-bit is used.

  1. Connect to the instance.

    For more information, see Connect to an instance by using VNC

    Note

    If you connect to an instance by using Workbench or SSH commands, you are not redirected to the system boot page when you restart the instance by using a command. Therefore, we recommend that you do not connect to an instance by using Workbench or SSH commands.

  2. Run the reboot command to restart the ECS instance and press e on the keyboard when the kernel selection screen appears.

    sles1

  3. Move the cursor down to the line that starts with linux and add single to the end of the line.

    sles2

  4. Press Ctrl+X or F10 to start the system. Enter the password of the root user.

    The system boots into single-user mode.sles3

Ubuntu

In this example, an ECS instance that runs Ubuntu 18.04 64-bit is used.

  1. Connect to the instance.

    For more information, see Connect to an instance by using VNC

    Note

    If you connect to an instance by using Workbench or SSH commands, you are not redirected to the system boot page when you restart the instance by using a command. Therefore, we recommend that you do not connect to an instance by using Workbench or SSH commands.

  2. Run the reboot command to restart the ECS instance and long press the Shift key during the restart until the GRUB interface appears.

    ubt1

  3. Use the arrow key to select Advanced options for Ubuntu and then press Enter.

  4. Select recovery mode on the second line and press e on the keyboard.

    ubt2

  5. On the new screen, move the cursor to the line that starts with linux and replace the content starting from ro with rw single init=/bin/bash.

    ubt4

  6. Press Ctrl+X or F10.

    The system boots into single-user mode.ubt5

What to do next

  • In scenarios such as when the root password is locked, you can run the passwd command when in single-user mode to change the password.

    Note

    If the root password is not locked, you can change the password on the ECS console, without the need to use GRUB. For more information, see Reset the logon password of an instance.

  • You can use the single-user mode to perform troubleshooting operations, such as viewing the system logs, checking the service status, and testing network connections. For example, if you plan to use the single-user mode to troubleshoot a system startup failure, you can do the following:

    • If the startup failure is caused by issues in the system configuration file, you can modify the file.

    • If the startup failure is caused by issues in a driver or software package, you can uninstall them.

    Note

    You can also perform troubleshooting by detaching the system disk. For more information, see Detach or attach a system disk.