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?

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
Mike B
  • 8,900
  • @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: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/System_Administration_Guide/s1-rescuemode-booting-single.html 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 http://unix.stackexchange.com/a/35938/49439 - in particular, booting with kernel option init=/bin/sh. – Mark Plotnick Dec 23 '14 at 17:17
  • @MarkPlotnick Ahh - that's what I was looking for. So booting with the init=/bin/sh kernal option effectively bypasses the default fsck check? – Mike B Dec 23 '14 at 17:21
  • 1
    Yes. It bypasses all the startup stuff. – Mark Plotnick Dec 23 '14 at 17:24
  • @MarkPlotnick Perfect. Would you like to submit this as an answer? I want to make sure you get credit for the find/explanation. – Mike B Dec 23 '14 at 17:26
  • Thanks, but we are discouraged from writing an answer that duplicates another unix.stackexchange answer. I think the powers-that-be can make your question automatically refer readers to that other question. – Mark Plotnick Dec 23 '14 at 17:29
  • 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 'SO- stop being evil' Dec 23 '14 at 22:05

0 Answers0