How to Boot Single User Mode in RedHat/CentOS

Edit Grub Boot OptionsSingle 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.

CentOS 7 Grub Menu
CentOS 7 Grub Menu
Next, select your Kernel version from the grub menu item and press e key to edit the first boot option. Now use the Down arrow key to find the kernel line (starts with “linux16“), then change the argument ro to rw init=/sysroot/bin/sh as shown in the screen shot below.

 

Edit Grub Boot Options
Edit Grub Boot Options

Once you have finished the task in the previous step, press Ctrl-X or F10 to boot into single user mode (access an emergency shell).

CentOS 7 Emergency Shell
CentOS 7 Emergency Shell

Now mount root (/) filesystem using the following command.

At this point, you can perform all the necessary low-level system maintenance tasks. Once you are done, reboot the system using this command.

Good luck!

Want me to do this for you? Drop me a line: itgalaxyzzz {at} gmail [dot] com