+ All Categories
Home > Documents > LPI 101 Ch09 Startup and Shutdown

LPI 101 Ch09 Startup and Shutdown

Date post: 30-May-2018
Category:
Upload: m3onh0x84
View: 228 times
Download: 0 times
Share this document with a friend

of 22

Transcript
  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    1/22

    SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102

    Chapter 9

    System Startup and Shutdown

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    2/22

    SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102

    Objectives

    Define and explain bootstrap procedure

    Explain single and multi-user run levels

    Identify and configure system startup files

    Perform a clean shutdown procedure

    Explain and define the maintainance mode

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    3/22

    SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102

    Standard Boot Process (LILO)

    System load the Linux bootstrap from default boot device,

    LILO (GRUB), which resides in Master Boot Record of

    hard drive

    The

    bootstrap program has abi

    li

    ty to boot Li

    nux

    to si

    ngle-

    user or multi-user mode

    After the bootstrap has loaded the kernel ( stored in the

    /boot or / partition ) into memory, it relinquishes control to

    this system

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    4/22

    SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102

    Standard Boot Process (LILO)

    The Linux system initializes physical devices, virtual

    memory controller, and its internal control tables for

    processes, files, ..

    The

    i

    ni

    t proce

    ssi

    s starte

    d andi

    t starts all othe

    r use

    rprocesses

    Before handing control over init, the kernel will create any

    other kernel threads

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    5/22

    SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102

    Boot Problems

    Sometimes, lilo will not able to boot the system, it prints the

    letters LILO on screen. The problems: diskcorrupted, the

    information on diskgeometry is incorrect, or since the new

    kernel imageis installed

    Troubleshooting: boot the system from bootable CD or

    floppy and try to repair disk problems or correct the

    /etc/lilo.conf

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    6/22

    SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102

    Manual Boot

    There are times when lilo has loaded the kernel but the kernel

    does NOT work properly because some of hardware can not

    befound,Its possible topass configuration to the kernel

    through lilo at lilo command line when booting:

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    7/22

    SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102

    Manual Boot

    List of someimportant boot prompt arguments :

    root=/dev/hda1 Tell the kernel which device to be mounted asroot file system

    ramdisk_size=2MB Define maximum of ramdisk (up to 4MB )single This actually is a parameter passed to init,

    causes the system to boot in single-usermode

    mem=192MB Tell the kernel amount ofmemory ( RAM size )

    aha1542=0x334 Set the I/O port address for SCSI Interface Card

    hdc=cdrom Specifies the third disk deviceis a CD-ROM

    Instead of typing them at each reboot, these arguments can beincluded into the lilo.conf :

    append=hdc=cdrom

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    8/22

    SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102

    Manual Boot

    Moreinformation about boot prompt and arguments can be

    found at:

    http://www.tldp.org/HOWTO/BootPrompt-HOWTO.html

    Refers to man 5 lilo.conffor a detailed information aboutarguments

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    9/22

    SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102

    Startup Flow Control

    It used to run Linux system at level 3

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    10/22

    SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102

    Run Levels

    Runlevel 0/etc/rc.d/rc0.d

    Shutdown mode. Tasks: killing all processesand unmounting file systems

    Runlevel 1/etc/rc.d/rc1.d

    Single-user mode, generally used by systemadministrator when doingmaintenance/recovery of the system

    Runlevel 2/etc/rc.d/rc2.d

    Multi-user mode, some network services arenot started : NFS,

    Runlevel 3/etc/rc.d/rc3.d

    Multi-user mode, all network services arestarted

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    11/22

    SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102

    Run Levels

    Runlevel 4/etc/rc.d/rc4.d

    User defined run level

    Runlevel 5/etc/rc.d/rc5.d

    Multi-user X11 mode. All services that arestarted in run level 3 are generally started

    Runlevel 6/etc/rc.d/rc6.d

    Reboot runlevel.

    Runlevel s/S/etc/rc.d/rcS.d

    Single-user mode.

    Runlevel a/b/c Pseudo states. (rarely used)

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    12/22

    SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102

    Run Levels Using

    Use /sbin/runlevel to get current run level

    How to start X window ?

    RedHat and TurboLinux : # init 5

    Debian : # init 2 SuSE and Caldera: # init 3

    Slackware : # init 4

    Re

    boot : #i

    ni

    t 6 Shutdown : # init 0

    To manual set default run level at boot time, open

    /etc/inittab and lookfor this line : id:5:initdefault:

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    13/22

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    14/22

    SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102

    Structure of/etc/inittab

    Each line has 4 fields seperated by colons:

    id:level:action:command

    id Uniqueidentifier for line (up to 4 alphanumericcharacters)

    level Run level(s) to activate processs

    action Keyword for how to run processcommand Full path name and parameters of command to

    beexecuted

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    15/22

    SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102

    Structure of/etc/inittab

    The main inittab action keywords are:

    Off Do not run this command. Used to retain an entry butto disableit.

    wait Run command and wait for completion

    once Run command but do not wait. Daemons processesare often started this way

    respawn Run command; If process exists, then rerun it. Usedfor commands that have to start again aftercompletion, like getty and ttymon

    sysinit Run command at first init

    boot Run command at boot time but do not wait

    bootwait Like boot but wait for completion

    initdefault Defines default boot level

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    16/22

    SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102

    /etc/inittab

    # more /etc/inittab

    id:3:initdefault:

    #System initialization

    si::sysinit:/etc/rc.d/rc.sysinit

    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

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    17/22

    SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102

    Run Command Scripts

    The run commands scripts are kept under /etc/rc.d/ and areinitiated by init with directions from /etc/inittab

    The script called rc itself runs startup programs in sub-

    di

    re

    ctorie

    s unde

    r /e

    tc/rc.d/ rc 0 looks in /etc/rc.d/rc0.d for runlevel 0

    rc 1 looks in /etc/rc.d/rc1.d for runlevel 1

    rc 2 looks in /etc/rc.d/rc2.d for runlevel 2

    etc

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    18/22

    SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102

    Run Command Scripts

    These startup programs are symbolic links to the actualscripts in the /etc/init.d/

    The startup link names areformatted:firstcharacter isS

    (starte

    d) orK(ki

    lle

    d or stoppe

    d), the

    next two digitsi

    de

    ntif

    ytheorderthat scripts areexecuted by rc program

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    19/22

    SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102

    Changing Run Levels

    Useinit command to change between run levels. Syntax :

    init

    Examples :

    # init 0 Shutdown system

    # init 6 Reboot system

    # init 3 Change to runlevel 3, multi-user text mode

    # init 5 Change to runlevel 5, multi-user X11 mode

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    20/22

    SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102

    Shuting Down

    Use shutdown commansd. It differs from init 0 whenallowing to specify time to exit, warn users what happens,

    Make sure that you follow the proper shutdown procedure.

    Do NOT simply shut off the power

    # shutdown Default system shutdown (run level1)

    # shutdown r now R eboot the system now (run level6)

    # shutdown h 2:00 Halt the system at 2:00AM (runlevel 0)

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    21/22

    SAIGONLAB 83 Nguyn Th Nh, P9, Q.Tn Bnh, Tp. HCM LPI 102

    Maintenance Mode

    When the system doesnt work because problems. Thesimplest and best solution is to shut down the system to

    maintenance mode (run level 1) or reboot the system to

    single-user mode (run level S) and try to fix problems

  • 8/9/2019 LPI 101 Ch09 Startup and Shutdown

    22/22


Recommended