4

This morning I was helping a fellow admin with a crash that occurred on a CentOS 5.8 VM. Earlier in the day, the underlying SAN hosting various VMs experienced an issue and ultimately caused some filesystem issues. Upon rebooting the server, we saw a prompt like this:

Checking filesystems
/ contains a file system with errors, check forced. 
/:
Inodes that were part of a corrupted orphan linked list found. 

/: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
             (i.e., without -a or -p options)
                                                      [FAILED]

*** An error occurred during the file system check. 
*** Dropping you to a shell; the system will reboot
*** when you leave the shell. 
Give root password for maintenance
(or type Control-D to continue): 

Initially, neither of us knew the root password so we tried CTRL-D (which rebooted the system).

I thought that I could reset the root password by booting into single user mode (adding the single kernel option) but it came across the same prompt.

Eventually the other admin remembered the appropriate password and could continue on to the maintenance prompt to run fsck.

This got me to thinking though - what if we didn't remember the password? How could we bypass the login prompt and/or reset the root password under this circumstance? Is there a way to boot into single user mode and bypass the fsck check?

  • @goldilocks Apologies if this is a duplicate. I did check ahead of time. I'm not sure if it matches the link you referenced though - my specific issue pertains to a filesystem issue preventing me from resetting the root password by logging in via single user mode. Is there a way to do all of this WITHOUT a recovery CD? Is there a kernel option that can bypass the check so I can reset root via the resident OS itself? – Mike B Dec 23 '14 at 16:57
  • 1
    @goldilocks Sorry - I guess I'm confused and am unclear in the process/procedure I'm trying to achieve. On a stable system, I can absolutely use grub to boot into single user mode. Instructions for that are here: access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/… After I boot into single user mode, I have the authority to change the root password (even if I don't know it). For a scenario like the one I mentioned above, can I do something similar? Maybe via emergency mode? – Mike B Dec 23 '14 at 17:12
  • 3
    See this answer unix.stackexchange.com/a/35938/49439 - in particular, booting with kernel option init=/bin/sh. – Mark Plotnick Dec 23 '14 at 17:17
  • 1
    Yes. It bypasses all the startup stuff. – Mark Plotnick Dec 23 '14 at 17:24
  • 1
    @MarkPlotnick The “powers-that-be” are actually all the users with ≥3000 reputation points — that means YOU! (Well, us.) Click the “close” button under the question, select “duplicate” and search for the target question or paste the link. I disagree that this is a duplicate though: the failed fsck introduces additional complications. – Gilles Dec 23 '14 at 22:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.