CentOS

How to Boot into a Single User Mode in CentOS/RHEL 8

The single user mode is also known as emergency mode or maintenance mode which is an important feature in the Linux system management. This mode allows a single user which is often the root user to operate a Linux system. This mode makes it suitable to perform a critical system operations and repairs.

Let us explain about the single user mode in this article. We will also explain how we can easily boot into a single user mode in CentOS/RHEL 8 using two methods.

Definition of a Single User Mode in the Linux System

The single user mode is a critical operating state that is used for system recovery and maintenance in a Linux system. This mode is very effective for resolving the serious system issues that cannot be resolved in a multi-user environment.

The system mounts all local file systems, ensuring that the critical resources are available for troubleshooting activities in this single user mode. Furthermore, since the network interfaces remain deactivated in this mode, this mode results in a secure and isolated environment.

This operational state is especially useful for operations like restoring the faulty file systems with tools like “fsck”, resetting a lost root password, correcting the mistakes in the “fstab” file, and disabling/enabling the systemctl services that may interrupt the system functionality. The single user mode gives the system administrators with a secure and controlled environment in which to troubleshoot the problems and maintain the integrity and operation of a Linux system.

Use “Rd.Break” to Boot into a Single User Mode in CentOS/RHEL 8

This method offers a straightforward way to access the single user mode in CentOS/RHEL 8. Here are the steps to follow:

  • At first, we need to reboot our CentOS/RHEL 8 system. Then, at the boot menu, we need to select the GRUB menu. We need to press the “e” key to edit the selected kernel.
  • Then, locate the line that contains “linux” and add a keywork called “rd.break” at the end of this line. This means that we want to start the single user mode in the CentOS/RHEL 8 system.
  • After adding the “rd.break” keyword, we need to press “Ctrl-x” to boot the system into a single user mode. The system will boot, and we will find ourselves at the single user mode prompt.
  • Then, we need to remount the “/sysroot” file system for read and write mode. We can type the following commands to perform this:
switch_root:/# mount -o remount, rw /sysroot
switch_root:/# chroot /sysroot
sh-4.4#
  • If we now want to change our password, we can type the following commands:
sh-4.4# echo "p@p@n#44 | passwd --stdin root
sh-4.4# touch /.autorelabel
  • After we have done our tasks, we need to reboot the system by running the following command:
sh-4.4# reboot -f

This command causes a reboot of the system.

Replace “Rhgb Quiet” to Boot CentOS/RHEL 8 in a Single User Mode

Another method to boot the CentOS/RHEL 7/8 systems into a single user mode involves replacing the “rhgb quiet” parameter with “init=/bin/bash” or “init=/bin/sh” in the kernel line. Follow these steps:

  • Start a system reboot and reach the GRUB menu. Then, we need to press the “e” key when you see the GRUB menu to enter the editing mode.
  • After that, we need to locate the line that starts with “linux”. Then, go to the last line.
  • At the end of the line, replace the “rhgb quiet” parameter with either “init=/bin/bash” or “init=/bin/sh”.
  • Press “Ctrl+x” to boot into a single user mode. The system now starts in this maintenance state.
  • Then, we need to remount the root filesystem with the write permissions using the following command:
mount -o remount, rw /

This allows us to perform the various maintenance and repair tasks. With an access to the single user mode in CentOS/RHEL 8, we can solve the issues, make configuration changes, reset the passwords, and resolve the filesystem errors.

Conclusion

By understanding this article, we must be able to boot into a single user mode on CentOS/RHEL 8. It offers a secure environment for troubleshooting and maintenance operations such as password recovery and filesystem repairs. The “rd.break” and “init=/bin/bash” techniques reduce this procedure and allow the critical tasks to be completed rapidly and securely.

Similar Posts