Solved

Automatically enter root password when FSCK fails

Posted on 2006-06-28
8
639 Views
Last Modified: 2008-01-09
Does anyone know how to automatically enter the root password when FSCK fails @ the following prompt?  I want it to automatically enter the root password or bypass this to bring me to the shell automatically.  Woudl I have to edit any of the rc start-up scripts?  Thanks for any help.


enter root password or <CTRL> D
0
Comment
Question by:techie411
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 22

Expert Comment

by:pjedmond
ID: 17004651
I presume that this is during startup?

There is a good reason for asking for the root prompt, as you have access to the whole file system. In order to avoid this, you need to make the system boot into single mode *unless* you fancy patching the code? Assuming that this was during startup, then someone else may come up with a way of doing this automatically, but at the moment I'm afraid I can't think of any 'obvious' solution.
0
 
LVL 34

Accepted Solution

by:
Duncan Roe earned 168 total points
ID: 17005366
You may be able to find that text ("enter root password ...") in the rc script that runs fsck; or you may find an invocation of sulogin. My copy of sulogin prompts as follows:
Type control-d to proceed with normal startup,
(or give root password for system maintenance):

is that the message you see?
If so, ypu could replace sulogin with bash in the script: that will give you a root shell prompt and no password asked for.
Otherwise, you should find the commands that generate the prompt in the fsck-runnung script (grep for fsck in your rc script directory) - they will be invoked in the case of a serious failure. Again, replace with a simple invocation of bash.
0
 
LVL 22

Assisted Solution

by:pjedmond
pjedmond earned 166 total points
ID: 17007249
OK - Found it - on a Redhat system it's in:

/etc/rc.d/rc.sysinit

search for sulogin and comment out ot replace as appropriate.


Thanks to duncan_roe for the inspiration:

find /etc | awk {'print "echo " $0";cat " $0 " | grep sulogin"'} | /bin/bash > output.txt

gives all scripts and files containing the command sulogin in the /etc dir.

(   (()
(`-' _\
 ''  ''
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 43

Assisted Solution

by:ravenpl
ravenpl earned 166 total points
ID: 17007453
If it's RH or FC, my sollution was to force fsck not to fail. But it may fail for other filesystem than ext2/ext3 - never tested
echo "-y" > /fsckoptions # answer yes to all questions
chattr +i /fsckoptions # prevent from deleting
0
 

Author Comment

by:techie411
ID: 17011338
How do I split points?  I'd like to give them to all 3 of you.  Thanks for your answers!  Much appreciated!! =)
0
 
LVL 22

Expert Comment

by:pjedmond
ID: 17011498
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question