Elastic Cloud Server

Booting Linux into Single-User Mode

2025-11-26 06:43:49

Background Information

Introduction to User Modes

The Linux operating system has two important user modes: multi-user mode and single-user mode, which are described as follows:

· Multi-user mode: Multi-user mode is the default operating mode of the Linux system. In multi-user mode, the system can support multiple users to log in at the same time and run various services and processes. The multi-user mode provides a full range of features and services, including web services and graphical interfaces.

· Single-user mode: Single-user mode is a special startup mode that provides a minimal but powerful environment, allowing administrators to operate with root privileges. After entering single-user mode, the system will only load the most basic services and features, with only one command line interface, and will not start the graphical interface or web service.

Single-user Mode Scenario

Single-user mode is usually used in the following scenarios:

· System troubleshooting and repair: When the system experiences startup problems, file system errors, network configuration problems, or other failures. Administrators can log in with root privileges and perform diagnostic, repair, and recovery tasks such as repairing file systems, checking hardware, restoring configuration files, etc.

· System backup and restore: Single-user mode provides full access to system disks. This allows administrators to perform backup and restore operations in single-user mode, including creating and restoring system snapshots, copying important data, repairing corrupted file systems.

· System configuration and maintenance: Single user mode provides a clean and minimal system environment, allowing administrators to perform system configuration and maintenance operations without interference from other services or users. This includes updating packages, rebuilding the bootloader, changing network configurations.

· Security audit: Single-user mode can be used for security audit. Administrators can check system logs, analyze security events, identify potential vulnerabilities, and take necessary measures to harden the system and improve security.

Before You Begin

To enter single-user mode on a Linux system, the following prerequisites usually need to be met:

· The ECS has been purchased on eSurfing Cloud, and the image is selected as Linux operating system, such as CentOS, Ubuntu.

· After entering single-user mode, you will log in as root. So, you need to know the password of the root user or you have other methods to get root privileges.

Restriction and Limitations

· There are some constraints and limitations when entering the single-user mode of the Linux operating system, including back up data in advance: Before entering the single-user mode, be sure to back up important data in advance. Single-user mode is a powerful permission environment, and incorrect operation can lead to data loss or system instability.

· Only one command line interface: Single-user mode does not load the graphical interface and only provides a basic command line interface. This means that user can only use the command-line tools to operate, not the graphical interface.

· Ensure that system files are readable and writable: Single-user mode requires the ability to read and write to system files, so you need to make sure that your file system is not corrupted and that there are no read-only mounts.

· No network connection: By default, single-user mode does not start network services, so network connectivity is not possible. This means that you cannot access network resources, including Internet, LAN, and remote connections.

Procedure

Different Linux distributions use different boot loaders, such as GRUB (Grand Unified Bootloader) or LILO (Linux Loader). In this section, we will enter single-user mode through the system bootloader (GRUB).

CentOS operating system enters single-user mode

In this example, an ECS instance with CentOS8.0 64-bit image operating system will enter the single-user mode.

Log in to the console.

Select a region.

Click Computing > Elastic Cloud Server to enter the cloud server page.

Click the Actions > Remote Login button on the row of the ECS to be operated to connect to the ECS instance remotely.

 

Enter the user name root, and the password is the user-defined password when purchasing the ECS. After successful login, the following figure is shown:

 

Enter the reboot command, and press e on the keyboard when the interface that allows you to choose to start the system during the reboot process (in order to prevent the page from jumping automatically, you need to pay attention to the restart page in time) to jump to the startup item configuration interface. The following figure shows the startup item configuration interface:

 

Use the arrow keys of the keyboard to move the cursor to the line at the beginning of Linux to delete the content from RO to the end of the line and replace it with rw init=/bin/sh crashkernel=auto. The specific modification information can be seen in the figure below:

 

Up to now, the configuration to enter the single-user mode has been basically completed. Now, the user needs to press the ctrl+x key combination of the keyboard or the F10 key, and the system will directly enter the single-user mode. Enter the passwd command to reset the system password, and after the password is entered, you need to enter the password twice to confirm. An example is shown in the figure.

 

At this point, an ECS instance with CentOS8.0 64-bit operating system has entered single-user mode.

Ubuntu operating system enters single-user mode

In this example, an ECS instance with Ubuntu18.04 64-bit image operating system will enter the single-user mode.

Log in to the console.

Select a region.

Click Computing > Elastic Cloud Server to enter the cloud server page.

Click the Actions > Remote Login button on the row of the ECS to be operated to connect to the ECS instance remotely.

 

Enter the user name root, and the password is the user-defined password when purchasing the ECS. After successful login, the following figure is shown:

 

Enter the reboot command and press the shift key during the reboot process to enter the GRUB interface, an example of the GRUB interface is as follows.

 

Use the keyboard arrow keys to move down to select the advanced options on the second line of the GRUB page, and press Enter on the keyboard.

 

Next, select recovery mode on the second line of the new page and press e to edit the startup items.

 

Enter the editing page, use the arrow keys on the keyboard to move the cursor down to the line at the beginning of Linux command, and delete and replace the content from RO to the end of the line with rw single init=/bin/bash. The specific modification information is as follows:

 

Up to now, the configuration to enter the single-user mode has been basically completed. Now, the user needs to press the ctrl+x key combination of the keyboard or the F10 key, and the system will directly enter the single-user mode. Enter the passwd command to reset the system password, and after the password is entered, you need to enter the password twice to confirm. An example is shown in the figure.

 

At this point, an ECS instance with Ubuntu18.04 64-bit operating system has entered single-user mode.


RDkXX6VRGDaf