Wednesday, June 13, 2012

Chapter 5 - The Boot Process


BIOS/UEFI -> Conf Media Device (Hard drive == MBR) -> GRUB -> init process -> runlevel

runlevel as specified in /etc/inittab

[root@server01 tmp]# tail /etc/inittab
# 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)
#
id:5:initdefault:
The grub.conf (default)

[root@server01 tmp]# cat /boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/mapper/vg_server01-lv_root
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux (2.6.32-131.0.15.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-131.0.15.el6.x86_64 ro root=/dev/mapper/vg_server01-lv_root rd_LVM_LV=vg_server01/lv_root rd_LVM_LV=vg_server01/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet
        initrd /initramfs-2.6.32-131.0.15.el6.x86_64.img
[root@server01 tmp]#


GRUB Menu : (you have to catch it quick on boot of thr system ) Boot to varying runlevels :






Enter 'a' for append :



Enter "space 1" at the end of the line to boot into single user mode (run level 1), then press enter and watch her boot up to level 1 !!



Looks like level 1 to me ...!


That change is not permanent, on the next reboot, it brings back up your pretty GNOME desktop environment :)

Going to GRUB -> A -> Remove the rhgb quiet -> Enter space and '2' -> Press Enter to boot :



Appending the GRUB menu with "space init=/bin/sh"


FYI :



  • To update the bootloader, simply run the 'grub-install' command .
  • When the grub file at /boot/grub/grub.conf is changed, no additional commands or steps are required.
  • To get into the "grub>" menu, Press Enter on start-up -> Press "C" for commandline
NOTE : Practice rescue mode !!!




To get into the "grub>" menu, Press Enter on start-up -> Press "C" for commandline
enter 'grub-like' commands ! :)

Commands for system control :

  • runlevel
  • init 3
  • telinit 0
  • poweroff
  • initctl
  • halt
  • shutdown
  • reboot
The Upstart Configuration file :

/etc/sysconfig/init

[root@server01 ~]# cat /etc/sysconfig/init
# color => new RH6.0 bootup
# verbose => old-style bootup
# anything else => new style bootup without ANSI colors or positioning
BOOTUP=color
# column to start "[  OK  ]" label in
RES_COL=60
# terminal sequence to move to that column. You could change this
# to something like "tput hpa ${RES_COL}" if your terminal supports it
MOVE_TO_COL="echo -en
\\033[${RES_COL}G"
# terminal sequence to set color to a 'success' color (currently: green)
SETCOLOR_SUCCESS="echo -en
\\033[0;32m"
# terminal sequence to set color to a 'failure' color (currently: red)
SETCOLOR_FAILURE="echo -en
\\033[0;31m"
# terminal sequence to set color to a 'warning' color (currently: yellow)
SETCOLOR_WARNING="echo -en
\\033[0;33m"
# terminal sequence to reset to the default color.
SETCOLOR_NORMAL="echo -en
\\033[0;39m"
# Set to anything other than 'no' to allow hotkey interactive startup...
PROMPT=yes
# Set to 'yes' to allow probing for devices with swap signatures
AUTOSWAP=no
# What ttys should gettys be started on?
ACTIVE_CONSOLES=/dev/tty[1-6]
# Set to '/sbin/sulogin' to prompt for password on single-user mode
# Set to '/sbin/sushell' otherwise
SINGLE=/sbin/sushell


The CTRL-ALT-DEL file

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

[root@server01 ~]# 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"

[root@server01 ~]# cat /etc/init/init-system-dbus.conf
# init-system-dbus - tell init process to connect to system dbus server

start on started messagebus
task
exec /bin/kill -USR1 1


Script run by the init process :

/etc/rc.d/rc.sysinit

The chkconfig command will control standard service runlevels.

# chkconfig postfix off
# chkconfig postfix on

[root@server01 ~]# ntysysv --level 2345

# yum install system-config-services.noarch -y




Network configuration and tools are re-visted in this chapter ??? idk why ?

NOTE : More practice needed with 'ifconfig' , 'route' and 'arp' commands :

NTP configuration :

/etc/ntp.conf

[root@server01 ~]# cat /etc/ntp.conf | grep server | grep -v "#"
server 0.rhel.pool.ntp.org
server 1.rhel.pool.ntp.org
server 2.rhel.pool.ntp.org














No comments:

Post a Comment