LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Server Unable to Boot bcz of /etc/inittab error (https://www.linuxquestions.org/questions/linux-server-73/server-unable-to-boot-bcz-of-etc-inittab-error-716540/)

RickyJaff 04-03-2009 04:53 AM

Server Unable to Boot bcz of /etc/inittab error
 
Hi,

I have old CentOS 4.6 server and its unable to boot now, I have access to it in Single user mode over KVM and I desperately need help to get it running so that I can take necessary backup, after that I will do OS upgrade and other upgrade such cent os 5.2 etc..

Error I am getting is :
Code:

INIT: /etc/inittab["line_number"] : missing action field
INIT: /etc/inittab["line_number"] : missing action field
INIT: /etc/inittab["line_number"] : missing action field
"NIT: Cannot Execut /etc/rc.d/rc.sysinit

I looked forum and I found that might be bcz I edited /etc/inittab from windows machine as difference of line handling in windows and linux causes problem.

Prior to this problem, I had upgraded PERL using "CPAN" on my server and added MONIT, for Monit I had added following lines in /etc/inittab as per docs. And it is the only Modification I did to inittab.
Code:

#For MONIT
mo:2345:respawn:/usr/local/bin/monit -Ic /etc/monitrc

I later removed it using vi over console but still same error.

Also I had this error lately :
Code:

INIT: "X" respawning too fast
INIT: "X" respawning too fast
INIT: "X" respawning too fast

but server was running and I had plan to troubleshoot it once I upgrade my perl etc.

but now I am unable to boot.
Below is my /etc/inittab
Code:

#
# inittab      This file describes how the INIT process should set up
#              the system in a certain run-level.
#
# Author:      Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
#              Modified for RHS Linux by Marc Ewing and Donnie Barnes
#

# Default runlevel. The runlevels used by RHS are:
#  0 - halt (Do NOT set initdefault to this)
#  1 - Single user mode
#  2 - Multiuser, without NFS (The same as 3, if you do not have networking)
#  3 - Full multiuser mode
#  4 - unused
#  5 - X11
#  6 - reboot (Do NOT set initdefault to this)
#
id:3:initdefault:

# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit

l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6

# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now

#For MONIT
#mo:2345:respawn:/usr/local/bin/monit -Ic /etc/monitrc

# When our UPS tells us power has failed, assume we have a few minutes
# of power left.  Schedule a shutdown for 2 minutes from now.
# This does, of course, assume you have powerd installed and your
# UPS connected and working correctly. 
pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down"

# If power was restored before the shutdown kicked in, cancel it.
pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"


# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6

# Run xdm in runlevel 5
x:5:respawn:/etc/X11/prefdm -nodaemon

Now I am connect to server over KVM in single user mode, please help me what I am supposed to do now ..

Thankyou!

sleddog 04-03-2009 05:31 AM

If the problem is indeed because of bad Windows line endings, you can quickly convert it to Unix format:

[root@server] dos2unix /etc/inittab

If you get a "command not found" then you need to first install the dos2unix utility:

[root@server] yum install dos2unix

RickyJaff 04-03-2009 05:43 AM

Thanx for your insight :)

I had edited it using "vi" and then saved it, isn't it supposed to be in now saved in linux friendly format as saved via linux ?

sleddog 04-03-2009 05:53 AM

No, vi will preserve the DOS/Windows line endings. There maybe a way of forcing vi to save with Unix line endings, I'm not sure. dos2unix is quick and easy :)

RickyJaff 04-03-2009 06:20 AM

Unfortunately what I got is single user mode and I can't install dos2unix and most of the things are not available ! no dos2unix available !

sleddog 04-03-2009 06:31 AM

I quick google turned up the vi answer.

Open the file in vi and:

Code:

:set fileformat=unix
:wq

The conversion can also be done using awk... google "awk convert dos to unix" or something similar.

RickyJaff 04-03-2009 06:42 AM

ya, I was also doing googling and before doing anything, I decided to create a backup of inittab but when I did :
cp /etc/inittab /etc/inittab.bak

I get error
Code:

cannot create regular file : etc/inittab " Read only filesystem
??
Does that means that in single user mode, its readonly mode ?

sleddog 04-03-2009 06:57 AM

Quote:

Originally Posted by RickyJaff (Post 3497111)
Does that means that in single user mode, its readonly mode ?

I didn't think so. See what the 'mount' command tells you, should see (rw) after each mount. Also see what 'dmesg' reports, that's the boot log, look for any signs of errors. Is it possible that you actually have a harddrive problem?

Are you sure your booting into 'single' mode and not 'emergency' mode? I think everything is mounted read-only in emergency mode.

RickyJaff 04-03-2009 07:12 AM

Here is the screenshot.. its seems RW
http://img7.imageshack.us/img7/137/consolemount.jpg

But why its not working, I want to have a backup before doing anything, moreover if its readonly then can't do anything either !

PS: I tried updating using VI and got error that "Unable to open file for writing"

hmm .. just solved the problem by :
Code:

mount -o remount -w /

RickyJaff 04-03-2009 07:38 AM

Kudos..

Vi Trick did the job :)

thnx Buddy. I really appreciate your time :)

I give you Thank :)

sleddog 04-03-2009 05:47 PM

Glad to hear you got it fixed :)


All times are GMT -5. The time now is 12:09 PM.