Linux Rescue Mode – Single-user mode to gain access to a system

Booting into single user mode is the easiest way to gain access to a Red Hat Enterprise Linux/CentOS server.

At the beginning of the boot process you should see the grub menu pop up with a countdown and some kernel options (or perhaps just one option).
It should be counting down at this point and says: “Press any key to enter the menu”. In this case you would hit any key.
At the bottom of the screen there is an explanation of the few options that are available to use on this page. One of these options is “e” for edit. Hit “e” to edit the boot kernel options.
NOTE: (You can also use “a” for append, although they both accomplish the same thing.)
  • You would now edit the main kernel options, adding either “single” or even just “1” at the end. Once you have completed that hit enter, the “b” for boot.
  •  You are now in single user mode, and be auto logged in as root.
NOTE: for Red Hat Enterprise Linux 6.0 there is a bug that will prevent you from changing your root password in single user mode. This is a result of SELinux. For this situation you would want to temporarily disable SELinux.

# setenforce 0

Now you should be allowed to change your root password.

Take look on the following pictures you will find that grub counting the time to boot the default operating system as mentioned in /etc/grub.conf.

That time press any key to interrupt, you will see the list of kernel that is installed on the machine. In my case there are three kernels.

  1. Updated centos kernel with xen.
  2. Default installed kernel with xen.
  3. Default installed kernel without xen.

Select the kernel in which you want to login by using arrow keys, once selected press ‘e’ to edit the kernel parameters. Once press you will find the screen like below.

Now you go to the third line, which starts with module /vmlinuz-2.6.xx.xxx.x.xen ro root=LABEL=/ rhgb quiet.  Press again “e“ to edit.

At the end of the  line insert word “single”.  It will look like below.

If you see full line, it looks  module /vmlinuz-2.6.xx.xxx.x.xen ro root=LABEL=/ rhgb quiet single

Once done press Enter, you will get the following screen with selection of third line. Press ‘b’ to boot the kernel with edited parameter.

Once booted it will go to hash prompt i.e. root prompt without asking password. See below.

That’s it.

Posted in Troubleshooting

Leave a comment