CT320

Three headers follow: ! Long name of class !! Semester !!! New Chapter 3, replaced by the name of the current page.

CT320: Network and System Administration

Fall 2013

New Chapter 3

Links to the various pages for this class:

Wish I could do this: * Schedule

See this page as a slide show

Administration

Chapter 3: Booting And Shutting Down

Colorado State University
Computer Science Department

Original slides from Dr. James Walden at Northern Kentucky University.

Topics

  1. Booting
  2. Bootstrap loaders
  3. Run levels
  4. Startup scripts
  5. Shutdown and reboot

Booting

  1. ROM boot code (BIOS in PCs)
  2. Master Boot Record (MBR)
  3. Bootloader
  4. Kernel
  5. Hardware detection and configuration
  6. Creation of system processes
  7. Multiuser operation

BIOS

MBR

Bootloader: GRUB

GRUB Installation

    #>> root (hd0,0)
    #>> setup (hd0)
    #>> quit

GRUB Boot

Booting with GRUB

Direct Boot

Chainloading

Config: /boot/grub/menu.lst

    # timeout (sec) before booting default
    timeout 10
    # Ubuntu entry
    title Ubuntu, kernel 2.6.10-5-386
    root (hd1,0)
    kernel /boot/vmlinuz-2.6.10-5-386 root=/dev/hde1 ro quiet splash
    initrd /boot/initrd.img-2.6.10-5-386
    boot
    # Windows entry
    title Windows 2000
    root (hd0,0)
    makeactive
    chainloader +1

GRUB Naming Convention

Kernel

Kernel Arguments

Numeric arguments

Root device options

Kernel Arguments (continued)

Console options

Hardware options

Run Levels

/etc/inittab

    # The default runlevel.
    id:2:initdefault:
    # Boot-time system config/initialization script.
    si::sysinit:/etc/init.d/rcS
    # What to do in single-user mode.
    ~~:S:wait:/sbin/sulogin
    # /etc/init.d executes the start and kill scripts
    l0:0:wait:/etc/init.d/rc 0
    l1:1:wait:/etc/init.d/rc 1
    l2:2:wait:/etc/init.d/rc 2
    l3:3:wait:/etc/init.d/rc 3
    l4:4:wait:/etc/init.d/rc 4
    l5:5:wait:/etc/init.d/rc 5
    l6:6:wait:/etc/init.d/rc 6
    # What to do when CTRL-ALT-DEL is pressed.
    ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now

rc

Scripts in runlevel 2

    $ ls /etc/rc2.d
    S05vbesave         S13gdm          S20openntpd   S89cron
    S08iptables        S18hplip        S20postfix    S91apache2
    S10acpid           S18portmap      S20powernowd  S98usplash
    S10powernowd.early S19cupsys       S20rsync      S99acpi-support
    S10sysklogd        S20apmd         S20ssh        S99rc.local
    S10syslog-ng       S20argus-server S20xinetd     S99rmnologin
    S11klogd           S20hotkey-setup S21nfs-common S99stop-readahead
    S12dbus            S20makedev      S89anacron

Example init.d script

    #! /bin/sh
    case "$1" in
    'start')
        if [ -f /usr/local/sbin/sshd ]; then
            echo "starting SSHD daemon"
            /usr/local/sbin/sshd &
        fi
        ;;
    'stop')
        PID=`ps -e -u 0 | fgrep sshd | awk '{print $1}'`
        if [ ! -z "$PID" ] ; then
            kill ${PID} >/dev/null 2>&1
        fi
        ;;
    *) echo "usage: /etc/init.d/sshd {start|stop}";;
    esac

Turning Services On/Off

Red Hat Service Commands

Starting or stopping a service

    service NAME [start,restart,stop]

is equivalent to

    /etc/init.d/NAME [start,restart,stop]

Enabling or disabling a service at boot time

    chkconfig NAME on –level <runlevels>

is equivalent to

    ln –s /etc/init.d/NAME /etc/init.d/rc.d/rc#.d/S??name

Single User Mode

What if single user mode doesn’t work?

Shutdown

What's wrong with init?

Init Alternatives

Systemd

Systemd (cont’d)

Upstart

References

Modified: 2013-09-18T16:00

User: Guest

Check: HTML CSS
Edit History Source
Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2015 Colorado State University
CS Building