July 7, 2016

Resetting Root Password for fsck when even Single user mode does not work

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Here is a short tutorial on how to reset root password when running a force fsck and even single user mode asks for root password:

1) Boot your system and press a space bar on your grub menu to pause the system from booting the OS and going on the fsck prompt and asking for root password which unfortunately you don’t know/remember

2) Select the kernel that you want to use to boot and press ‘e’

3) Go to the link similar to below and press ‘e’:

“kernel /vmlinuz-x.x.x.x root=UUID.x.x.x.x ro rhgb quiet”

4) Delete ‘ro’ from the line and append ‘init= /bin/bash’ for CentOS or ‘init= /bin/sh’ for Debian

5) Press ‘Enter’ or ‘Return” key to save and the press ‘b’ to boot into single user mode

6) Now the system should directly take you to your single user mode bash shell. Now type below command to mount the / file system in read write mdoe

mount -o remount rw /

7) Once / FS is mounted, you can then change the root password with:

passwd
Now just reboot the machine and once it is up to the fsck, you should be able to enter the new password and continue the fsck.

For Linux Servers with IPMI, Free DDOS Protection and Unmetered bandwidth check out – https://rectified.net/ddos-protected-dedicated-servers.php

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Leave a Reply

Your email address will not be published. Required fields are marked *