Understanding System Initialization - PowerPoint PPT Presentation

1 / 39
About This Presentation
Title:

Understanding System Initialization

Description:

CPU begins executing commands in BIOS ... Journaling file system ... Journaling file system. Means file systems are unlikely to ever be corrupted by power loss ... – PowerPoint PPT presentation

Number of Views:72
Avg rating:3.0/5.0
Slides: 40
Provided by: pbcc
Category:

less

Transcript and Presenter's Notes

Title: Understanding System Initialization


1
Understanding System Initialization
  • Chapter 9

2
Hardware Initialization
  • Basic process for bootstrapping
  • CPU begins executing commands in BIOS
  • BIOS passes control to boot loader
  • Boot loader passes control to Linux kernel

3
Hardware Initialization (continued)
  • After PC-type computer started
  • CPU initializes itself
  • Sends signals to control other parts of computer
  • BIOS performs power-on self test (POST)
  • Checks memory and other hardware
  • BIOS sends signal to SCSI controller card telling
    it to initialize itself
  • SCSI controllers usually contain own BIOS

4
Hardware Initialization (continued)
  • After PC-type computer started (continued)
  • Other hardware components instructed to
    initialize themselves
  • BIOS determines which devices to search for
    operating system
  • BIOS loads boot loader into memory and passes
    control it

5
Hardware Initialization (continued)
6
The Boot Loader
  • Boot loader or boot manager
  • Small program loaded by BIOS
  • Commonly used
  • LILO (Linux loader)
  • GRUB (grand unified boot loader)
  • Default on most systems
  • BIOS looks for executable program in first sector
    of 3.5-inch disk or CD-ROM

7
The Boot Loader (continued)
8
The Boot Loader (continued)
  • Chained boot loader
  • One boot loader passes control to another boot
    loader instead of operating system
  • Use boot loader to start different versions of
    Linux installed on separate partitions

9
The Boot Loader (continued)
  • uname command
  • Display information about kernel
  • Full version number of current kernel
  • uname -a
  • Timestamp of kernel
  • uname -v

10
Starting the Kernel
  • Initial piece of kernel
  • Loads rest of kernel into memory
  • Uncompresses it
  • dmesg command
  • View messages stored by kernel during boot process

11
Starting the Kernel (continued)
12
Starting the Kernel (continued)
  • Kernel ring buffer
  • Area of memory
  • Stores messages from kernel
  • more /var/log/dmesg
  • 4294667.296000 Linux version 2.6.15-23-386
    (buildd_at_rothera) (gcc version 4.0.3 (Ubuntu
    4.0.3-1ubuntu5)) 1 PREEMPT Tue May 23 134940
    UTC 2006
  • 4294667.296000 BIOS-provided physical RAM map
  • 4294667.296000 BIOS-e820 0000000000000000 -
    00000000000a0000 (usable)
  • 94667.296000 896MB LOWMEM available.

13
Using Boot Parameters
  • Boot parameters
  • Instruct Linux how to operate or access parts of
    computer systems hardware
  • Use to activate features of Linux
  • To enter
  • GRUB
  • Press Esc or a
  • LILO
  • Enter after operating system name

14
Configuring Boot Loaders
  • Configuration files
  • Created by installation program
  • Examine how boot loader operates
  • Usually no need to change

15
Using LILO
  • Simpler than GRUB
  • To use
  • Create configuration file describing operating
    systems LILO should start
  • Run lilo command
  • Examines lilo.conf file
  • Stores appropriate information in either
  • MBR
  • Boot record you have indicated

16
Using LILO (continued)
  • Boot image
  • Each version of Linux
  • Parameters
  • boot
  • delay
  • image
  • other

17
Using GRUB
  • Installed by default for many versions of Linux
  • /boot/grub/grub.conf
  • Configuration file for GRUB
  • RedHat
  • Similar in layout and syntax to lilo.conf
  • /boot/grub/menu.lst
  • Ubuntu

18
Using GRUB (continued)
19
init and its Scripts
  • init program
  • Master control program
  • Starts many other programs
  • Runs scripts to initialize system services
  • Controlled by /etc/inittab configuration file
  • Three main configuration files located in
    /etc/rc.d
  • rc.sysinit
  • rc
  • rc.local

20
init and its Scripts
  • cat /etc/inittab edit to set default run level
    settings
  • /etc/inittab init(8) configuration.
  • Id inittab,v 1.91 2002/01/25 133521 miquels
    Exp
  • The default runlevel.
  • id2initdefault
  • Boot-time system configuration/initialization
    script.
  • This is run first except when booting in
    emergency (-b) mode.
  • sisysinit/etc/init.d/rcS

21
Understanding Run Levels
  • Run level
  • Numbered mode of operation
  • Preconfigured set of services is activated
  • Defined in /etc/inittab file
  • Default run level 5
  • init or telinit command
  • Change to different run level
  • Commonly done only to restart or halt system

22
Understanding Run Levels (continued)
23
Understanding rc Scripts
  • rc script
  • Located in /etc/rc.d directory
  • Started with parameter that includes run level
  • Starts appropriate system services based on
    selected run level
  • Each run level is associated with subdirectory
  • Located in /etc/rc.d directory
  • /etc/rd2.d for instance for the default multiuser
    run level with graphics on Ubuntu

24
Understanding rc Scripts (continued)
  • Each file begins with K or S followed by
    two-digit number
  • Begin with K? (killed) stopped
  • Begin with S?started
  • Files symbolic links to scripts that stop and
    start services
  • Rename files in rc.d with K or S to create
    custom run time systems
  • Files are symbolic links to executable scripts
  • lrwxrwxrwx 1 root root 13 2007-03-13 1001
    /etc/rc2.d/S20ssh -gt ../init.d/ssh

25
Understanding rc Scripts (continued)
  • Run level 2 example
  • /etc/rc2.d
  • S05vbesave S20avgd S20rwhod
    S89cron
  • S10acpid S20dbus S20ssh
    S91apache2
  • S10powernowd.early S20festival S20ssh-krb5
    S98usplash
  • S10sysklogd S20hotkey-setup S21quotarpc
    S99acpi-support
  • S11klogd S20inetd S21sendmail
    S99rc.local
  • S13gdm S20laptop-mode
    S25bluez-utils S99rmnologin
  • S14ppp S20makedev S25mdadm
    S99stop-readahead
  • S18hplip S20nvidia-kernel S50proftpd
  • S19cupsys S20powernowd S89anacron
  • S20apmd S20rsync S89atd

26
Understanding rc Scripts (continued)
27
Controlling Services
  • Many services listed in run-level directories
    relate to networking
  • Scripts allow user to change almost anything on
    Linux system without restarting computer

28
Managing Services
  • service command
  • Control service
  • Must know service name
  • Examples
  • RedHat
  • service lpd restart
  • service named start
  • service named status
  • Ubuntu
  • /etc/init.d/ssh restart
  • restart, start, and stop are options

29
Managing Services
  • more ../init.d/ssh
  • ! /bin/sh
  • set -e
  • /etc/init.d/ssh start and stop the OpenBSD
    "secure shell(tm)" daemon
  • test -x /usr/sbin/sshd exit 0
  • ( /usr/sbin/sshd -\? 2gt1 grep -q OpenSSH )
    2gt/dev/null exit 0
  • if test -f /etc/default/ssh then
  • . /etc/default/ssh
  • fi

30
Managing Services (continued)
  • chkconfig command on RedHat
  • Alter files in run-level directories
  • Modify services started or stopped each time
    system started
  • By default alters run levels 2 through 5
  • Example chkconfig named on

31
Managing Services Graphically
  • Service configuration utility
  • Main window lists services available on system
  • Determined by contents of /etc/rc.d/init.d
  • Active services
  • Shown with check mark next to them

32
Managing Services Graphically (continued)
33
Managing Services Graphically (continued)
34
Configuring System Services
  • Initialization scripts in /etc/rc.d/init.d
  • Typically use configuration information located
    in /etc/sysconfig directory and subdirectories
  • Files in /etc/sysconfig
  • Named for services
  • Each file contains name-value pairs
  • Define configuration options for service

35
Configuring System Services (continued)
  • Use system-config-network utility to configure
  • /etc/sysconfig/ network file
  • Files within /etc/sysconfig/network-scripts
  • system-config-securitylevel utility
  • Alters /etc/sysconfig/system-config-securitylevel
    file
  • Based on firewall selections
  • Service itself often has another set of
    configuration files in /etc directory

36
Shutting Down Linux
  • Turning off Linux computer without shutting it
    down in orderly way can cause data loss
  • Journaling file system
  • Tracks each disk operation to ensure it is either
    completed or not done at all
  • Journal permits operating system to back out of
    disk operation if not completed successfully

37
Shutting Down Linux (continued)
  • Journaling file system
  • Means file systems are unlikely to ever be
    corrupted by power loss
  • Graceful shutdown
  • Orderly or methodical shutdown of Linux
  • All Linux services are stopped
  • All data is written to disk
  • Kernel changes to run level 0 or 6

38
Shutting Down Linux (continued)
  • Shut down Linux gracefully
  • Use reboot command
  • Use halt command
  • Use shutdown command
  • shutdown -h now
  • Pressing CtrlAltDel
  • Entering the command telinit 0 or init 0
  • Halt system
  • Entering command telinit 6 or init 1
  • Restart system

39
Shutting Down Linux (continued)
  • Graphical desktop
  • Use log out item on main menu of GNOME or KDE
  • On servers or multiuser Linux systems
  • Only system administrator should be allowed to
    shut down system
Write a Comment
User Comments (0)
About PowerShow.com