Linux Services Organization

Our goal, introduce Linux services to the enterprise world.
Contact us in

Linux Services Organization : Booting Linux Server

Boot process

The boot sequence in a Linux server startup begins with the BIOS initialization that points to the GRUB boot loader located on the appropriate master boot record MBR. The GRUB initializes the Linux Kernel which starts init, the first Linux process. The init process initializes and moves the system into a specific runlevel where the Linux Services are started.

BIOS -> MBR -> Grub -> Kernel -> Init (the first process, /etc/inittab -> starts /etc/rc.sysinit and /etc/rcX.d ). On the runlevel startup /etc/rcX.d first the scripts that begin with K are executed in order to kill the services that not are expected to be running on this runlevel . After this the scripts that begin with S are executed to start the services that form this runlevel. In both cases the order is provided by the numbers that form the script name.

Grub boot loader

The default boot loader for Red Hat Linux is GRUB, the first part of it is installed in the MBR of the first drive and initiated by the BIOS. During the system installation GRUB is installed on the MBR of the first disk where the boot partition resides normally. If for some reason you need to reinstall grub you can use the grub-install command :

$ grub-install /dev/sda --> Be careful, this command can break your system !!!

Once GRUB is started by the BIOS, the boot loader mounts the boot partition, loads the Linux Kernel that starts the init process. The sequence of this process can be seen on the /etc/grub.conf file:

$ cat /etc/grub.conf
title Red Hat Enterprise Linux Server (2.6.18-92.el5)
#Mount /boot partition
root (hd0,0)
#Kernel loading
kernel /vmlinuz-2.6.18-92.el5 ro root=/dev/VolGroup00/LogVol00Root rhgb quiet
#Initial RAM loading
initrd /initrd-2.6.18-92.el5.img

Kernel and drivers loading

The way that uses GRUB to load the Linux Kernel can be customized directly at the console typing "e" following the instructions of the GRUB graphical menu showed at startup or directly modifying the file /etc/grub.conf:

kernel /vmlinuz-2.6.18-53.el5 ro root=/dev/VolGroup01/LogVol00 rhgb quiet s
Single user mode "s" that provides a root shell without root password check. Very useful for root password recovery.

kernel /vmlinuz-2.6.18-53.el5 ro root=/dev/VolGroup01/LogVol00 rhgb quiet emergency
Emergency mode provides a maintenance root shell after root password check.

kernel /vmlinuz-2.6.18-53.el5 ro root=/dev/VolGroup01/LogVol00 rhgb quiet init=/bin/sh
With this configuration you can startup the system skipping the init process. It provides a root shell after root password check.

kernel /vmlinuz-2.6.18-53.el5 ro root=/dev/VolGroup01/LogVol00 rhgb quiet 5
Graphical mode startup, the default behaviour.

kernel /vmlinuz-2.6.18-53.el5 ro root=/dev/VolGroup01/LogVol00 rhgb quiet selinux=0
SElinux can be disabled at kernel boot time with this configuration.

Before the kernel is started a RAM disk is initialized and used to load drivers and modules. This step is performed by GRUB in the initrd directive:

initrd /initrd-2.6.18-53.el5.img

All the users that have access to the server console can gain root access to the server using single user mode. In order to protect who can modify GRUB, the boot loader process can be password protected with a password generated with grub-md5-crypt and placing it at /etc/grub.conf file. Once done when the user at the console trays to modify the mode in which the system is booted, a password confirmation is asked.

Init process

Once GRUB have loaded the Kernel and drivers, Linux hands over boot responsibilities to the Kernel which starts loading the rest of the system calling the First process: init. The init process runs /etc/rc.d/rc.sysinit, which starts network configuration, partitions mounts, system clock, etc. The init process then finds which runlevel it should be searching at the initdefault directive in /etc/inittab.

$ cat /etc/initab

# Default runlevel. The runlevels used 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)

The default runlevel is 5, so init will look in /etc/rc.d/rc5.d and run each "kill" script to stop the services that are not supposed to operate on the runlevel and "start" script to start services that must be running. Scripts are run in numeric order. After the services are stopped and started according to runlevel, the init process executes the virtual console: a command line where you can log into to start using Linux. All this processes are controlled on the /etc/init/*.conf files :

$ cat /etc/init/rc.conf

# rc - System V runlevel compatibility
# This task runs the old sysv-rc runlevel scripts. It
# is usually started by the telinit compatibility wrapper.

start on runlevel [0123456]
stop on runlevel [!$RUNLEVEL]
console output
exec /etc/rc.d/rc $RUNLEVEL

Starts/kills services depending on RUNLEVEL.

$ cat /etc/init/control-alt-delete.conf

# control-alt-delete - emergency keypress handling
# This task is run whenever the Control-Alt-Delete key combination is
# pressed. Usually used to shut down the machine.

start on control-alt-delete
exec /sbin/shutdown -r now "Control-Alt-Delete pressed"

Configure Ctrl+Alt+Del key combination to shutdown the system at console.

$ cat /etc/init/tty.conf

# tty - getty
# This service maintains a getty on the sepcified device.

stop on runlevel [016]
instance $TTY
exec /sbin/mingetty $TTY

Starts virtual consoles at the end of the boot sequence.

$ cat /etc/init/prefdm.conf

# prefdm - preferred display manager
# Starts gdm/xdm/etc by preference

start on stopped rc RUNLEVEL=5
stop on starting rc RUNLEVEL=[!5]
console output
respawn limit 10 120
exec /etc/X11/prefdm -nodaemon

Starts display manager in RUNLEVEL=5

Note: Previous versions of Red Hat used 'System V Init' as init service, where all init directives were located on /etc/inittab file. Red Hat 6 init system uses the 'Upstart init' daemon which reads the configuration files from /etc/init/ directory.


1.- Booting in single user mode will try to mount the root filesystem of your system (true/false)

2.- Which command can be used to see the Kernel loading and runtime messages (true/false)

3.- The root= directive in the kernel loading GRUB command must be pointing to /boot partition (true/false)

4.- Which command we can use in order to recreate the initial RAM disk used by GRUB in the initrd command ?

5.- The /boot partition can be located inside a Logical Volume in order to boot the system without problems (true/false)

6.- You have moved all your system to a new disk (sda). Which command must be used to install grub on the new disk MBR?

7.- Which command must be used by GRUB to mount the boot partition located on /dev/sda2 ?

8.- When booting the system, you receive a grub prompt instead of a list of entries you have defined in your grub.conf file. What happened ?

9.- Which RAID level can be used to allocate the /boot partition ?
A - 1
B - 3
C - 5

10.- On a default Linux installation the partition that contains the kernel is:
A - /
B - /boot
C - /dev
D - /root


1.- Reboot your system. Imagine that you have forgotten your system root password. Set the system root password to "sdeerr123e" without using the root password that you have forgotten.

2.- Make sure that initdefault on /etc/inittab is on runlevel=5. Boot your system in runlevel=3 without changing /etc/inittab .Once your system in runlevel=3 login as root and change the runlevel=5 manually.

3.- Boot your system in init=/bin/sh mode, where init is no executed. Try to startup manually your system into runlevel=3.

-- This page is part of Linux Server online tutorial --