Linux basics - System startup process

Linux system startup process involves several important steps that Linux users need to know. This is vital in case of system boot up failure. By learning how Linux process start up, user can configure or at least know where to look for when troubleshooting a broken system.

When Linux system startup or bootup, init daemon (process) first read /etc/inittab file. Then, it runs /etc/rc.d/rc.S script. The program then will enable SWAP, mount file system, cleans up log directories, initializes PnP devices, load kernel modules and set up serial ports. After that, it runs 'Run level script' and 'Network Initialization', like the diagram below:

 
init (8)
----------->
/etc/rc.d/rc.S
 
| read
run
|
 
/etc/inittab (5)
 
  • Enable SWAP
  • Mount file system
  • Cleans up log directories
  • Initializes PnP devices
  • Load kernel modules
  • Set up serial ports
 
     
|
 

Network Initialization

  • rc.inet1 - netconfig
  • rc.inet2 - basic network service
  • rc.httpd - Apache
  • rc.samba - Windows sharing
<-----------

Run level script

  • rc.0 - Halt
  • rc.4 - Multi user (X11)
  • rc.6 - reboot
  • rc.K - Single user (1)
  • rc.M - (2,3)
         

Slackware Linux /etc/inittab

This is an example of Slackware Linux /etc/inittab file.


#
# inittab This file describes how the INIT process should set up # the system in a certain run-level. # # Version: @(#)inittab 2.04 17/05/93 MvS # 2.10 02/10/95 PV # 3.00 02/06/1999 PV # 4.00 04/10/2002 PV # # Author: Miquel van Smoorenburg, <[email protected]> # Modified by: Patrick J. Volkerding, <[email protected]> #
# These are the default runlevels in Slackware: # 0 = halt # 1 = single user mode # 2 = unused (but configured the same as runlevel 3) # 3 = multiuser mode (default Slackware runlevel) # 4 = X11 with KDM/GDM/XDM (session managers) # 5 = unused (but configured the same as runlevel 3) # 6 = reboot
# Default runlevel. (Do not set to 0 or 6) id:3:initdefault:
# System initialization (runs when system boots). si:S:sysinit:/etc/rc.d/rc.S
# Script to run when going single user (runlevel 1). su:1S:wait:/etc/rc.d/rc.K
# Script to run when going multi user. rc:2345:wait:/etc/rc.d/rc.M
# What to do at the "Three Finger Salute". # ca::ctrlaltdel:/sbin/shutdown -t5 -r now
# Runlevel 0 halts the system. l0:0:wait:/etc/rc.d/rc.0
# Runlevel 6 reboots the system. l6:6:wait:/etc/rc.d/rc.6
# What to do when power fails. pf::powerfail:/sbin/genpowerfail start
# If power is back, cancel the running shutdown. pg::powerokwait:/sbin/genpowerfail stop
# These are the standard console login getties in multiuser mode: c1:1235:respawn:/sbin/agetty 38400 tty1 linux c2:1235:respawn:/sbin/agetty 38400 tty2 linux c3:1235:respawn:/sbin/agetty 38400 tty3 linux c4:1235:respawn:/sbin/agetty 38400 tty4 linux c5:1235:respawn:/sbin/agetty 38400 tty5 linux c6:12345:respawn:/sbin/agetty 38400 tty6 linux
# Local serial lines: #s1:12345:respawn:/sbin/agetty -L ttyS0 9600 vt100 #s2:12345:respawn:/sbin/agetty -L ttyS1 9600 vt100
# Dialup lines: #d1:12345:respawn:/sbin/agetty -mt60 38400,19200,9600,2400,1200 ttyS0 vt100 #d2:12345:respawn:/sbin/agetty -mt60 38400,19200,9600,2400,1200 ttyS1 vt100
# Runlevel 4 used to be for an X window only system, until we discovered # that it throws init into a loop that keeps your load avg at least 1 all # the time. Thus, there is now one getty opened on tty6. Hopefully no one # will notice. ;^) # It might not be bad to have one text console anyway, in case something # happens to X. x1:4:wait:/etc/rc.d/rc.4
# End of /etc/inittab

As you can see, Slackware linux run level is different from Fedora linux. If you want your slackware to boot directly into xwindow, use vi editor to change the default runlevel which is 3 to 4 (red font color):

id:3:initdefault: change to

id:4:initdefault:

If you don't know how to use vi editor, here's a vi beginner tutorial just for you.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.