CentOS and RedHat Stuck at boot asking for Root Password

Recently I have been into a situation when one of the entry in Fstab was wrong and system was stuck at boot. Asking for root password to proceed. Unfortunately I did not have root password and client did not know that either.

When pressing ctrl D the system used to reboot and after reboot started to ask the same root password.

I gone through several methods to reset root password through Grub which included adding the word single on the kernel parameter line in Grub. Unfortunately this did not fix the issue.

The below method did the trick:

1. Reboot the system

2. As the Grub appears on screen hit the button “a” on keyboard to append options

3. Now add init=/bin/bash at the end of the kernel command line and press enter. The system will boot and show a shell prompt like ‘bash-3.2#’. Here you can enter the below command to mount the file system with read/write permissions.

mount -o remount,rw /

Now you make any changes you want in file system or reset root password by simply entering “passwd” command.

Now press ctrl+alt+del to reboot.


Leave a Reply

Your email address will not be published.