If system or driver issues prevent you from connecting to your Elastic Compute Service (ECS) instance with tools like Workbench or Session Manager, you can boot into single-user mode. Also known as maintenance mode, this mode bypasses the standard boot process to provide a minimal environment with root permissions for emergency maintenance.
Procedure
Single-user mode grants full control over the system. Incorrect operations can corrupt or damage system files. Before performing maintenance, create a snapshot of the system disk.
Alibaba Cloud Linux
This procedure only applies to Alibaba Cloud Linux 3.
Run the
rebootcommand to restart the operating system.If you cannot log on to VNC, restart the instance from the console.
During the restart process, press and hold the
Ekey to edit the system boot parameters.
Locate the kernel boot line that starts with
linux. Replace the content fromroto the end of the line withrw init=/bin/sh crashkernel=auto. This change grants read-write permissions and specifies/bin/shas the initialization process.Original content:
linux (Sroot) /boot/umlinuz-5.10.134-19.1.a18.x86_64 root=UUID=********-****-**\ **-****-************ ro rhgb quiet cgroup-memory=nokmem crashkernel=0M-2G:0M, \ 2G-8G: 192M, 8G-128G:256M, 128G-3766:384M,376G- :448M spec_rstack overflow-off uri\ ng_force_dma_api kence-sample_interval=100 kfence.booting_max=0-2G:0,2G-32G :2\ M.32G-:32M preempt=none biosdeuname=0 net. ifnames=0 console=tty0 console=ttySO\ , 115200n8 noibrs nume_core.io_timeout=4294967295 nume_core.admin_timeout=42949\ 67295 cryptongr.notests rcupdate.rcu_cpu_stall_timeout=300Modified content:
linux (Sroot) /boot/umlinuz-5.10.134-19.1.a18.x86_64 root=UUID=********-****-**\ **-****-************ rw init=/bin/sh crashkernel=auto
Press
Ctrl+xorF10. The system enters single-user mode.
CentOS/Debian/SLES/Anolis OS
This example uses a CentOS system.
In the VNC window, log on and run the
rebootcommand to restart the instance.During the restart process, press and hold the
Ekey to edit the system boot parameters.
Locate the kernel boot line that starts with
linuxand addsingleto the end of the line.Original content:
linux16 /boot/vmlinuz-*.**.*-****.***.*.***.***_** root=UUID=********-\ ****-****-****-************ ro crashkernel-auto spectre_v2=retpoline rhgb quie\ t net. ifnames=0 console=tty0 console=ttySo, 115200n8 noibrs nume_core.io_timeous\ t=4294967295 nume_core.admin_timeout=4294967295Modified content:
linux16 /boot/vmlinuz-*.**.*-****.***.*.***.***_** root=UUID=********-\ ****-****-****-************ ro crashkernel-auto spectre_v2=retpoline rhgb quie\ t net. ifnames=0 console=tty0 console=ttySo, 115200n8 noibrs nume_core.io_timeous\ t=4294967295 nume_core.admin_timeout=4294967295 single
Press
Ctrl+XorF10. When prompted, enter the root password. The system then enters single-user mode.
Ubuntu
This procedure only applies to Ubuntu 18.04.
Run the
rebootcommand to restart the operating system.If you cannot log on to VNC, restart the instance from the console.
During the restart process, press and hold the
Shiftkey to enter the GRand Unified Bootloader (GRUB) menu.
On the GRUB screen, select the second option,
Advanced options for Ubuntu. On the next screen, selectrecovery mode. Then, pressEto edit the boot entry.Find the kernel boot line that starts with
linux. Replace the content fromroto the end of the line withrw single init=/bin/bash. This change grants read-write permissions and specifies/bin/bashas the initialization process.Original content:
linux /boot/vmlinuz-4.15.0-213-generic root=UUID=d406d971-bc6d-40f2-b\ 572-6+74ac689736 ro recovery nomodeset dis_ucode_ldr vga=792 console=tty@ console=ttySo, 115\ 200n8 net. ifnames=0 noibrs iommu=pt nvme_core.multipathen nvme_core.io_timeout=4294967295 nv\ me_core.admin_timeout=4294967295Modified content:
linux /boot/vmlinuz-4.15.0-213-generic root=UUID=********-****-****-*\ ***-*+********** rw single init=/bin/bash
Press
Ctrl+xorF10. The system enters single-user mode.
FreeBSD
Run the
rebootcommand to restart the operating system.If you cannot log on to VNC, restart the instance from the console.
After the system reboots, the VNC console displays the
Boot Menu. Press5to switch theConsoutput mode toVideo primary.
Press
2to selectBoot Single Userand enter single-user mode.
Next steps
In single-user mode, you can check system logs, inspect service statuses, and test network connectivity to diagnose and fix issues. For example, if a driver conflict prevents the system from booting, you can uninstall the conflicting driver to restore normal operation.