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
Solved

Automatically enter root password when FSCK fails

Posted on 2006-06-28
8
638 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
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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Reset Root Password on CentOS 6 4 69
wipe a usb using python 5 64
How to update  and reset admin password for Linux 5 65
SSL/TLS - openssl troubleshooting 3 39
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

809 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