Single User Mode (sometimes known as Maintenance Mode) is a mode in Unix-like operating systems such as Linux operate, where a handful of services are started at system boot for basic functionality to enable a single superuser perform certain critical tasks.
It is runlevel 1 under system SysV init, and runlevel1.target or rescue.target in systemd. Importantly, the services, if any, started at this runlevel/target varies by distribution. It’s generally useful for maintenance or emergency repairs (since it doesn’t offer any network services at all), when a computer is not capable of normal operations.
Once you have decided to enter single user mode for maintenance or recover from crash you will need to VNC to the server or in other words emulation of physical console. Don’t worry about logging into the server at this point, since this process will need you to reboot the server.
The process is the same for both RedHat/CentOS 7 and 8
Once you issue the hard reboot, you may need to click Refresh in the top right of the VNC screen since the hard reboot will reset that connection. You need to click this refresh very quickly otherwise you will miss the boot screen where you can interrupt the boot process.
When the server starts to boot, you will see a GRUB menu/screen. You will need to interrupt the boot by pressing any key.
First restart your RedHat/CentOS machine, once boot process starts, wait for the GRUB boot menu to appear as shown in the screen shot below.
ekey to edit the first boot option. Now use the Down arrow key to find the kernel line (starts with “linux16“), then change the argument
rw init=/sysroot/bin/shas shown in the screen shot below.
Once you have finished the task in the previous step, press
F10 to boot into single user mode (access an emergency shell).
Now mount root
(/) filesystem using the following command.
# chroot /sysroot/
At this point, you can perform all the necessary low-level system maintenance tasks. Once you are done, reboot the system using this command.
# reboot -f