I was trying to debug my Linux boot process. If I set the default runlevel to 2 or 3, my system hangs without giving me a prompt. I was able to get to runlevel 1 via a kernel parameter, and ran all scripts in /etc/rc2.d via service ***** start/stop commands and it was fine. But if I do a telinit to runlevel 2 or 3, I can't see my shell prompt. So what is the difference between the two approaches?

I use SysVinit. Content of /etc/inittab (which I haven't modified):


# System initialization.

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

ca::ctrlaltdel:/sbin/shutdown -t3 -r now

# 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"

# agetty on serial port
s0:2345:respawn:/sbin/agetty -L -i 9600 ttyS0 vt100
s1:2345:respawn:/sbin/agetty -L -i 9600 ttyS1 vt100

1:2345:respawn:/sbin/agetty 38400 tty1 linux

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

# Ask for password at single user prompt
  • I am having SysVinit. I dont have anything different in sysVinit. here is what I have pastebin.com/a85aGizM. Which log are you refering to ? can I set any flags to print logs ? – Rahin Aug 25 '14 at 12:38
  • Log messages are in files in /var/log. Look at the recently-modified files to see which ones might have interesting logs. Each log line has a date and time; the relevant log lines are the ones produced before and at the time your system hangs. – Gilles Aug 25 '14 at 12:59

init does more than run the scripts in /etc/rc.d.

For one, it spawns mingetty or getty on each virtual terminal. Check that you haven't commented out, or have a typo near, the following lines:

# 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

(Note that I'm not in front of a RHEL/CentOS system at the moment, so there's no warranty!)

  • thanks for the response Gareth. yeah I didn't comment out them. I am able to get on Shell prompt when I set kernel to runlevel 1 so I assume my tty are spawned when I got into rc 1. which shouldn't be diff for other rcs – Rahin Aug 22 '14 at 11:43

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.