Runlevel initialization. Boot to Linux Grub interface.

Slides:



Advertisements
Similar presentations
Introduction to Linux Linux startup process Unix Shells and scripts.
Advertisements

Basic Unix system administration
Booting and Shuting Down WeeSan Lee. Roadmap Bootstrapping Boot Loaders Startup/Init Scripts Reboot & Shutdown Q&A.
Genesis: from raw hardware to processes System booting sequence: how does a machine come into life.
Chapter 9: Understanding System Initialization The Complete Guide To Linux System Administration.
Booting and Halting Chapter 4. Chapter Objectives Examine the sequence of events that occur when a system is booted. Examine the methods used to modify.
Week 8 System Initialization and X Windows. Objectives  Summarize the major steps necessary to boot a Linux system  Configure the LILO and GRUB boot.
Booting and Shutting Down the UNIX Operating System Arcadio A. Sincero Jr. 6/6/2001 CMSC 691X, Section 6080.
Linux+ Guide to Linux Certification Chapter Nine System Initialization.
Linux+ Guide to Linux Certification, Second Edition
Linux can be generally divided into four major components: 1. KERNEL – OS, ultimate boss The kernel is the core program that runs programs and manages.
Booting the Linux Kernel Dr. Michael L. Collard 1.
Linux+ Guide to Linux Certification, Third Edition
CIS238/DL1 Chapter 15 Rebuilding the Linux Kernel Preparing the Source Code Locating the Source Code Installing the Source Code Read the Documentation.
Booting And Shutting Down. Bootstrapping  Bootstrapping is standard term for “starting up a computer”  During bootstrapping the kernel is loaded into.
Chapter 2 Booting and Shutting Down Kim Grempler (Sections 2.0 to 2.3) Leon Dague (Sections 2.4 to 2.7)
 Starting up a computer › Load kernel into memory and execute it. (1)BIOS load and run the MBR (Master Boot Record) (2)MBR searches for the bootable.
Linux+ Guide to Linux Certification, Second Edition Chapter 3 Linux Installation and Usage.
Linux Intro Linux, the do it yourself OS Linux, successor to MINIX Linux, Unix for the masses (PC users) History:
Linux Boot Up Process Bootstrapping –Bootstrapping is the standard term for “ starting up a computer”. During bootstrapping, the kernel is loaded into.
Unix kernel Kernel refers to the core part of an operating system Historically, UNIX kernels are monolithic Newer versions of UNIX allow part of the kernel.
S.Ha.R.K. Workshop28/02/05 S.Ha.R.K. Installation HowTo Tullio Facchinetti University of Pavia - Italy.
Bootloader / multi-boot
Starting and Stopping Linux. Boot Process BIOS initializes hardware –Loads the boot sector MBR loads the bootloader –Point to kernel Kernel initializes.
Processes & Daemons Chapter IV / Part III. Commands Internal commands: alias, cd, echo, pwd, time External commands, code is in a file: grep, ls, more.
Va-scanCopyright 2002, Marchany Unit 4 – The Boot Process Randy Marchany VA Tech Computing Center.
System Startup and Shutdown
Chapter 2 Booting Up and Shutting Down. Computer Center, CS, NCTU 2 Boot Up?
UNIX Startup and Shutdown CSCI N321 – System and Network Administration Copyright © 2000, 2012 by Scott Orr and the Trustees of Indiana University.
IT2204: Systems Administration I 8. The Operating System and Booting.
Linux+ Guide to Linux Certification Chapter Three Linux Installation and Usage.
Linux Installation and Administration – Lesson 5 Tutor: George Papamarkos Topic: Devices in Linux.
Booting and boot levels
System Startup & Shutdown Objectives –to interpret the Unix startup and shutdown configuration files –to be able to create a customised run level Contents.
1 Linux Basics for Networking. 2 Module - Linux Basics for Networking ♦ Overview This module focuses on the basics of networking using Redhat Enterprise.
CIT 470: Advanced Network and System AdministrationSlide #1 CIT 470: Advanced Network and System Administration Booting and Runlevels.
COSC 4750 Customizing and maintenance. Installing software Redhat/Fedora (and linux in general) has a package installer, called rpm Many programs will.
UNIX Startup and Shutdown CSCI N321 – System and Network Administration Copyright © 2000, 2010 by Scott Orr and the Trustees of Indiana University.
The Linux Operating System Lecture 3: Becoming the Superuser and Users and Groups The Tonga Institute of Higher Education.
Guide to Linux Installation and Administration1 Chapter 4 Running a Linux System.
System Startup & Shutdown
Operating Systems Lab. (#1) University of Tehran – ECE Dept. Fall 2005 Reza Shokri
ITI Chris Uriarte ITI-481: Unix Administration Meeting 2 Rutgers University Center for Applied Computer Technologies Chris Uriarte, Instructor.
CIS Lesson 5 Lesson 5 New Skills Boot time GRUB edits (review) Changing BIOS boot order on a VM (review) Mounting CD ISO and floppy Image files on.
Chapter 3 & 6 Root Status and users File Ownership Every file has a owner and group –These give read,write, and execute priv’s to the owner, group, and.
Linux Startup Process Presenter: Dipu Gupta.
COMP075 OS2 Managing Linux Services. Services? Services are processes that start, usually when the system starts, and run, usually, until the system stops.
CIT 500: IT Fundamentals Startup. Slide #2 Topics 1.Booting 2.Bootstrap loaders 3.Run levels 4.Startup scripts 5.Shutdown and reboot.
Linux booting How does it work?. First the bootloader The first step is for the bootloader to run BIOS indicates what devices to examine Bootstrap program.
Genesis: From Raw Hardware to Processes Andy Wang Operating Systems COP 4610 / CGS 5765.
UNIX Startup and Shutdown CSCI N321 – System and Network Administration Copyright © 2000, 2009 by Scott Orr and the Trustees of Indiana University.
Unix System Administration Booting and Shutting Down Chapter 2.
The Linux Operating System R.Bigelow. What is an Operating System An operating system is a collection of programs that manage a computer's resources.
Basic UNIX system administration CS 2204 Class meeting 14 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
System initialization Unit objectives A.Outline steps necessary to boot a Linux system, configure LILO and GRUB boot loaders, and dual boot Linux with.
Overview A) Power on or reset B) 1st stage boot loader C) 2nd stage boot loader D) Operate system.
Chap- 2 BOOTING & SHUTDOWN LINUX SYSTEM Created by: Asst. Prof. Ashish Shah, J.M.PATEL COLLEGE, GOREGOAN W 1.
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com The GRUB bootloader Michael.
The Linux startup process Jerry Feldman The Linux Expertise Center Hewlett-Packard Company Document produced via OpenOffice.org.
System Administration Startup Process. Why Care? ● Every process on your system comes about by following a specific chain of events from the machine startup.
LPI 2010 NLLGG Trainer: Jeroen van Pelt Bijeenkomst 3: Systeem opstarten en werken met filesystemen
Getting Started with Linux
The GRUB bootloader Michael Opdenacker Thomas Petazzoni Free Electrons
The Linux Kernel About 6 million lines of code
Booting Up and Shutting Down
Advanced Operating Systems
Linux Start Sequence Summary
SUSE Linux Enterprise Desktop Administration
Lecture 10 review Booting sequence in Brief
Objectives Topic 2.6 Understanding the boot process
Presentation transcript:

Runlevel initialization

Boot to Linux

Grub interface

LILO interface  Once LILO has successfully loaded, you will see a LILO prompt.  You may let LILO time out (after 10 seconds), which will boot the default the Linux partition.  Second, you can press the TAB key, which will list a selection of operating systems to boot from. In our example we would get "Linux" and "WindowsXP" as our options. Typing either of these will load up that OS.

Changing runlevel at boot time  LILO: append the runlevel to the boot command : LILO: linux 3 or LILO: linux 5  GRUB: press the `e' key to edit the boot configuration append the runlevel to the end of the boot command as shown: kernel /vmlinuz ro root=/dev/hda1 5

Kernel is loaded into memory GRUB also passes “kernel command line” (255bytes) to the loaded Linux kernel

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,1) # kernel /vmlinuz-version ro root=/dev/hdb3 # initrd /initrd-version.img #boot=/dev/hdb default=0 timeout=10 splashimage=(hd0,1)/grub/splash.xpm.gz title Linux Fedora ( smp) root (hd0,1) kernel /vmlinuz smp ro root=LABEL=/ rhgb quiet initrd /initrd smp.img title Linux Fedora-up ( ) root (hd0,1) kernel /vmlinuz ro root=LABEL=/ rhgb quiet initrd /initrd img title Windows 2000 rootnoverify (hd0,0) chainloader +1 Specifies the default boot image will be the first hard entry Grub will wait for 10 seconds for input from the user before continuing to boot. The root partition is the second partition on the first hard drive.

Example lilo.conf File boot=/dev/hda map=/boot/map install=/boot/boot.b prompt timeout=50 default=linux image=/boot/vmlinuz label=linux initrd=/boot/initrd img read-only root=/dev/hda1

Kernel starts the init process Kernel passes desired runlevel to the init pocess as argument If runlevel not specified, then

System V initialization system RHEL 4 BOOTFLAGS It is possible to pass a number of flags to init from the boot monitor (eg. LILO). Init accepts the following flags: -s, S, single - Single user mode boot. In this mode /etc/inittab is examined and the bootup rc scripts are usually run before the single user mode shell is started Runlevel to boot into. -b, emergency - Boot directly into a single user shell without running any other startup scripts. -a, auto - The LILO boot loader adds the word "auto" to the command line if it booted the kernel with the default command line (without user intervention). If this is found init sets the "AUTOBOOT" environment variable to "yes". -z xxx - The argument to -z is ignored. You can use this to expand the command line a bit, so that it takes some more space on the stack. Init can then manipulate the command line so that ps(1) shows the current runlevel.

/etc/inittab # The default runlevel is defined here id:5:initdefault: # First script to be executed si::sysinit:/etc/rc.d/rc.sysinit # /etc/init.d/rc takes care of # runlevel handling 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 ls:S:wait:/etc/init.d/rc S # what to do when CTRL-ALT-DEL is pressed ca::ctrlaltdel:/sbin/shutdown -r -t 4 now # getty-programs for the normal runlevels # The "id" field MUST be the same as the # last characters of the device name 1:2345:respawn:/sbin/mingetty --noclear tty1 2:2345:respawn:/sbin/mingetty tty2 3:2345:respawn:/sbin/mingetty tty3 4:2345:respawn:/sbin/mingetty tty4 5:2345:respawn:/sbin/mingetty tty5 6:2345:respawn:/sbin/mingetty tty6

rc.sysinit  Setting the path and the hostname, and checking whether networking is activated.  Mounting the /proc filesystem  Setting the kernel parameters  Setting the system clock  Loading keymaps and fonts  Starting swapping  Initializing the USB controller along with the attached devices.  Checking the root filesystem.  Remounting the root filesystem as read-write.  Loading modules as appropriate.

/etc/init.d/rc  All initialization scripts are located in /etc/init.d.  Scripts for changing the runlevel are also found there, but are called through symbolic links from one of the subdirectories ( /etc/init.d/rc0.d to /etc/init.d/rc6.d ).  Because every script can be executed as both a start and a stop script, these scripts must understand the parameters start and stop.  Possible init Script Options  OptionDescription  start Start service.  stop Stop service.  restart If the service is running, stop it then restart it. If it is not running, start it.  reload Reload the configuration without stopping and restarting the service.  force-reload Reload the configuration if the service supports this. Otherwise, do the same as if restart had been given.  status Show the current status of service.

/sbin/rc unix root # more /sbin/rc #!/bin/bash trap ":" INT QUIT TSTP source /sbin/functions.sh # Only source this when this is a livecd booting... [ -f /sbin/livecd-functions.sh ] && source /sbin/livecd-functions.sh umask 022 try() { local errstr local retval=0 if [ -c /dev/null ]; then errstr="$((eval $*) 2>&1 >/dev/null)" else errstr="$((eval $*) 2>&1)" fi retval=$? if [ "${retval}" -ne 0 ] then # Progressbar begin if [ -c /dev/null ]; then rc_splash "stop" &>/dev/null & else rc_splash "stop" & fi # Progressbar end...

init scripts start other processes The system first runs the scripts whose names start with K to kill the associated processes  /etc/rc.d/init.d/ stop The system runs the scripts whose names start with S to start the processes  /etc/rc.d/init.d/ start

System V initialization system RHEL 4 rc4.d]$ pwd /etc/rc.d/rc4.d rc4.d]$ ls –l... lrwxrwxrwx 1 root root 19 Jun K05saslauthd ->../init.d/saslauthd lrwxrwxrwx 1 root root 13 Jun K20nfs ->../init.d/nfs lrwxrwxrwx 1 root root 14 Jun K24irda ->../init.d/irda lrwxrwxrwx 1 root root 15 Jun K25squid ->../init.d/squid lrwxrwxrwx 1 root root 16 Jun S09pcmcia ->../init.d/pcmcia lrwxrwxrwx 1 root root 16 Jun S40smartd ->../init.d/smartd lrwxrwxrwx 1 root root 14 Jun S55sshd ->../init.d/sshd lrwxrwxrwx 1 root root 16 Aug S55sshdlp ->../init.d/sshdlp... lrwxrwxrwx 1 root root 15 Jun S97rhnsd ->../init.d/rhnsd lrwxrwxrwx 1 root root 11 Jun S99local ->../rc.local rc4.d]

Benefits of init Scripts  One of the benefits of using init directory scripts is that they are easily tested. The scripts may be manually invoked with the stop and start arguments as a check to determine whether they function correctly before creating the links to the rc directories, and trying them under actual system boot conditions. This procedure is recommended because it can help you catch mistakes that might interrupt the boot process and leave the system unusable.

System V initialization  System service manipulation command init.d]$ /sbin/service Usage: service | --status-all | [ service_name [ command | --full-restart ] ] init.d]$ /sbin/service sshdlp Usage: /etc/init.d/sshdlp {start|stop|restart|reload|condrestart|status} init.d]$

Changing Run Levels  The following commands are typically reserved for system maintenance activities. UNIX shutdown Command The System V init 0 Command The telinit Command NOTE: The shutdown, telinit, and init 0 commands can only be executed with root access.

System V initialization SIGHUPHas the same effect as telinit q. SIGUSR1On receipt of this signals, init closes and re-opens its control fifo, /dev/initctl. Useful for bootscripts when /dev is remounted. SIGINTNormally the kernel sends this signal to init when CTRL-ALT-DEL is pressed. It activates the ctrlaltdel action. SIGWINCHThe kernel sends this signal when the keyboardSignal key is hit. It activates the kbrequest action. Init reacts to several signals

The OS Kernel  UNIX Run Levels All flavors of UNIX, and UNIX- work-alikes use similar foundations for the system run modes. As far as UNIX and its ilk are concerned, there are basically two run modes: single user (sometimes called maintenance mode), and multi-user.  There may be several forms of the multi-user mode (with services, without services, and so on) on any given UNIX OS.

The OS Kernel  Typically, BSD variants include a r un c ontrol (also known as an rc) script in the /etc directory. This allows the administrator to edit a single /etc/rc script to make it start a new service at boot time.  Other BSD variants have simply increased the number of rc files in the /etc directory. For example, the FreeBSD start-up directory contains scripts with names such as /etc/rc.atm, /etc/rc.firewall, and /etc/rc.network. These individual scripts, respectively, configure the ATM network cards, cause the system to become a firewall, and configure the network links respectively. These scripts are called by the master script, /etc/rc

Sample BSD Startup Scripts /etc/rc.boot  First rc script to run is /etc/rc.boot The first two lines set HOME and PATH environment variables Executes basic system commands during boot hostname file in /etc for each network interface enables IP networking on each interface Find hostname from other machine on NW using hostconfig program and use NFS to mount filesystems System Administrator intervene to fix problem