This topic describes how an ECS instance running a CentOS, Debian, SUSE Linux Enterprise Server (SLES), or Ubuntu image enters the single user mode.

Prerequisites

Background information

The single user mode is one of the modes in which Linux distributions are booted. GRUB can be used to boot a Linux distribution into single user mode. After entering the single user mode, you will have system administrator permissions and can modify all system configuration information. This mode is usually used in the following scenarios:
  • Change the system password
  • Troubleshoot startup problems
  • Fix system exceptions
  • Maintain partitions of hard disk drives (HDD)
Notice In single user mode, you can modify critical system configurations. We recommend that you set this mode only when necessary and proceed with caution.

References

Example 1: How a CentOS ECS instance enters the single user mode

In this example, an ECS instance running a CentOS 8.0 64-bit operating system is used.

  1. Connect to the ECS instance.
    For more information, see Overview.
  2. Run the reboot command to restart the ECS instance. When the interface for selecting a boot system appears, press the E key to go to the configuration interface for boot options.
    The following figure shows the configuration interface for boot options.os-step-1
  3. Move the pointer to the line that starts with linux by using the arrow keys on the keyboard. Replace the content from ro to the end of the line with rw init=/bin/sh creashkernel=auto.
    The following figure shows the information after the change is made.os-step-2
  4. Press the Ctrl + X composite key or the F10 key.
    The system enters the single user mode. The following figure shows the interface for resetting the system password.os-step-3

Example 2: How a Debian ECS instance enters the single user mode

In this example, an ECS instance running a Debian 10.2 64-bit operating system is used.

  1. Connect to the ECS instance.
    For more information, see Overview.
  2. Run the reboot command to restart the ECS instance. When the configuration interface for kernel options appears, press the E key to go to the GRUB interface.
    The following figure shows the GRUB interface.db-step-1
  3. Move the pointer to the line that starts with linux by using the arrow keys on the keyboard. Append single to the end of the line.
    The following figure shows the information after the change is made.db-step-3
  4. Press the Ctrl + X composite key or the F10 key to start the system. Enter the password of the root user.
    The system enters the single user mode.db-step-4

Example 3: How a SLES instance enters the single user mode

In this example, an ECS instance running a SLES 15 SP1 64-bit operating system is used.

  1. Connect to the ECS instance.
    For more information, see Overview.
  2. Run the reboot command to restart the ECS instance. When the configuration interface for kernel options appears, press the E key to go to the GRUB interface.
    The following figure shows the GRUB interface.sles-step-1
  3. Move the pointer to the line that starts with linux by using the arrow keys on the keyboard. Append single to the end of the line.
    The following figure shows the information after the change is made.sles-step-2
  4. Press the Ctrl + X composite key or the F10 key to start the system. Enter the password of the root user.
    The system enters the single user mode.sles-step-3

Example 4: How an Ubuntu ECS instance enters the single user mode

In this example, an ECS instance running an Ubuntu 18.04 64-bit operating system is used.

  1. Connect to the ECS instance.
    For more information, see Overview.
  2. Run the reboot command to restart the ECS instance. During the restarting process, press the Shift key to go to the GRUB interface.
    The following figure shows the GRUB interface.ubt-step-1
  3. Select the Advanced options for Ubuntu in the second line of the GRUB interface and press the Enter key.
  4. Select the recovery mode in the second line on the interface that appears and press the E key to edit the boot options.
    ubt-step-2
  5. On the editing page, move the pointer to the line that starts with linux by using the arrow keys on the keyboard. Replace the content from ro to the end of the line with rw single inti=/bin/bash.
    The following figure shows the information after the change is made.ubt-step-4
  6. Press the Ctrl + X composite key or the F10 key.
    The system enters the single user mode. The following figure shows the interface for resetting the system password.ubt-step-5