Cosc 4750 Booting and shutdown. Bootstrapping Starting up a computer, load kernel into memory and begin executing. a vulnerable time, since errors in.

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.
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 Booting Procedure
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.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Second Edition
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.
Startup and Shutdown1-1 Booting and Shutting Down  Bootstrapping m The computer must pull itself up m Automatic and manual booting m Steps in the boot.
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.
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.
System Startup and Shutdown
Chapter 2 Booting Up and Shutting Down. Computer Center, CS, NCTU 2 Boot Up?
1. This presentation covers :  User Interface Administration  Files System and Services Management 2.
UNIX Startup and Shutdown CSCI N321 – System and Network Administration Copyright © 2000, 2012 by Scott Orr and the Trustees of Indiana University.
File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.
Booting Up and Shutting Down. Computer Center, CS, NCTU 2 Booting Up  Starting up a computer Load kernel into memory and execute it. (1)BIOS load and.
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.
8 Shell Programming Mauro Jaskelioff. Introduction Environment variables –How to use and assign them –Your PATH variable Introduction to shell programming.
CIT 470: Advanced Network and System AdministrationSlide #1 CIT 470: Advanced Network and System Administration Booting and Runlevels.
UNIX Startup and Shutdown CSCI N321 – System and Network Administration Copyright © 2000, 2010 by Scott Orr and the Trustees of Indiana University.
Linux Administration. Pre-Install Different distributions –Redhat, Caldera, mandrake, SuSE, FreeBSD Redhat Server Install –Check HCL –Significant issues.
Agenda Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Review next lab assignments Break Out Problems.
Guide to Linux Installation and Administration1 Chapter 4 Running a Linux System.
UNIX/LINUX SHELLS.  “A Unix shell is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and.
System Startup & Shutdown
UNIX (Linux) Introduction Module-1. OS Kernel In computing, the kernel is the central component of OS. It is a bridge between applications and the actual.
Unix/Linux cs3353. The Shell The shell is a program that acts as the interface between the user and the kernel. –The shell is fully programmable and will.
ITI Chris Uriarte ITI-481: Unix Administration Meeting 2 Rutgers University Center for Applied Computer Technologies Chris Uriarte, Instructor.
Linux Startup Process Presenter: Dipu Gupta.
©Colin Jamison 2004 Shell scripting in Linux Colin Jamison.
Unix – Linux CS3353 Ssystem Administration. OS The Operating System – Acts as the interface to all software, hardware, and users of a computer. – Requires.
System Administrator Responsible for? Install OS Network Configuration Security Configuration Patching Backup Performance Management Storage Management.
Advanced Programming in the UNIX Environment Hop Lee.
CIT 500: IT Fundamentals Startup. Slide #2 Topics 1.Booting 2.Bootstrap loaders 3.Run levels 4.Startup scripts 5.Shutdown and reboot.
Agenda Positional Parameters / Continued... Command Substitution Bourne Shell / Bash Shell / Korn Shell Mathematical Expressions Bourne Shell / Bash Shell.
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.
System Administrator Responsible for? Install OS Network Configuration Security Configuration Patching Backup Performance Management Storage Management.
Module 1 - Introduction to Linux. Users must log-in Linux is case sensitive File and Directories naming conventions (No spaces!) Files and Directories.
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.
Group, group, group One after the other: cmd1 ; cmd2 One or both: cmd1 && cmd2 Only one of them: cmd1 || cmd2 Cuddling (there):( cmd1 ; cmd2 ) Cuddling.
Agenda The Bourne Shell – Part I Redirection ( >, >>,
System initialization Unit objectives A.Outline steps necessary to boot a Linux system, configure LILO and GRUB boot loaders, and dual boot Linux with.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
Linux Administration – Finding You Way on the Command Line The Linux File Directory or Tree.
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.
Department of Computer Engineering
Booting Up and Shutting Down
Welcome to Linux Chap#1 Hanin Abdulrahman.
Session (1) Secure Unix Administration Who is a system administrator?
Linux Start Sequence Summary
OPS235: Week 1 Installing Linux (Lab1: Investigations 4 - )
Shells, Help, and Paths.
SUSE Linux Enterprise Desktop Administration
Welcome to Linux Chap#1 Hanin Abdulrahman.
Welcome to Linux Chap#1.
Presentation transcript:

Cosc 4750 Booting and shutdown

Bootstrapping Starting up a computer, load kernel into memory and begin executing. a vulnerable time, since errors in configurations files, damaged file systems, failing hardware can prevent the computer from booting.

Booting manual –varies between venders –Linux boots to single user mode many system process are not running and only one user can log in (usually root) only part of the filesystem is mounted / /tmp, sometimes /usr and /var –Redhat 7.3+, all local partitions are mounted. –SGI boot to a command mode no system processes are running and the file system is not mounted. Only basic maintenance tasks can be done.

automatic –Unix boots to multi-user mode. (or mode pre- specified by administrator) –All system process (that are supposed too) are running. –Entire file system is mounted

Steps in booting 1.the boot code that is stored in ROM (BIOS or CMOS) is executed 2.the ROM turns over control to a boot loader (grub for Linux) 3.the boot loader loads and executes the kernel a.device detection and configuration 4.the kernel spawns the system init process, which is PID 1 a.manual boot mode: operator intervention (linux)

5. the init process executes a series of startup scripts in the from the rc.d directory which starts up system process and daemons. rc = run command 6. Multi-user operation

System Processes swapper – process 0 (not linux) init process 1 various memory and kernel handlers 1 getty process (console, not a gui environment)

Mutli-user operation More getty processes to handle logins xdm for X-term logins gdm or dtlogin (SUN) prefdm, X11 windows environment (linux) clogin (SGI)

Boot Loader (linux) Provides a way to boot linux, and other O/S like windows, etc. lilo: –configured with a text file, lilo.conf –specifies where the “kernel” is located can be /unix, but redhat 9 uses /boot/vmlinuz Grub –Configured through /etc/grub.conf, similar to lilo

Dual Boot Grub –List of available linux kernels to boot –And lists the window boot loader. Turns control over to the windows boot loader, which then boots windows Because of this, windows must always be installed first, then linux.

Run Levels level 0 is the level for system shutdown level 1 or S is single-user mode mode level 2-5 are varying multi-user levels –Linux: 3 is none-gui, 5 is gui –linux: 2 no gui and no networking. level 6: is a reboot level specified in /etc/inittab

Shutdown To shutdown a system, use the command: shutdown (normally found in /etc/ or /sbin Takes arguments to change between run- levels. like run level 0, which is shutdown Two versions (sys V and bsd) –shutdown –g0 –i0 –y –shutdown –h now (linux command)

Shutdown is a script that accesses the init process, – except shutdown –n which is a nasty way to shutdown a system. telinit S which simply go to run level 1 telinit 0 which shutdown the system, without telling anyone. Killing the init process will either reboot the system or just cause it to crash (more likely)

startup scripts The run level determines which startup scripts are used. –All of the scripts are located in the /etc/init.d/ directory There are also rcX.d directories –where X is the run level –These contain links to the files in the init.d directory So you only have to modify one file, instead 2 or 3.

Example of /etc/rc.d/rc5.d/ K05innd K30mcserv K80nscd S20random S80sendmail K10pulse K34yppasswdd K84apmd S25netfs S85gpm K15pvmd K35dhcpd K84ypserv S30syslog S85httpd K20bootparamd K45named K92ipchains S35krb5server S90xfs K20isdn K50snmpd K96pcmcia S40atd S91smb K20rstatd K54pxe S05kudzu S40crond S99linuxconf K20rusersd K55routed S06reconfig S50inet S99local K20rwalld K60mars-nwe S10network S55xntpd K20rwhod K61ldap S11portmap S60lpd K25squid K65identd S14nfslock S60nfs K28amd K75gated S18autofs S75keytable

Shell Scripting Shells are the command interface you use on a UNIX system, similar to DOS –Bourne (sh) Most init/startup scripts are written in bourne –c (csh), tcsh –korn (ksh), z (zsh) –Born Again Bourne Shell (bash)

Each is similar in characteristics, but each has it own scripting language. zsh and tcsh are upgrades of csh bash is a (much needed) update to Bourne shell –Startup scripts are done in bash or bourne. This is also the shell for root.

Shell Scripts (with bourne shell) file containing a series of commands One command per line (or separated by a ;) Output –Standard out and Standard Error output –command >file redirects std output –cmd >file 2>file2 directs std to file and stderr to file 2

variables a shell script uses the same environment variables as your shell uses, ie PATH, etc. using variables (in sh) –person=‘jim’ –echo “$person” –output: jim

read command echo –n “Pick a number ” read num echo “You picked: $num” OUPUT: –Pick a number –You picked:

You can define variables as commands dir=`pwd` (note the backquote) echo “You are in $dir” The output is: You are in

Argument variables $0 is the first argument, which is the name of the script $1 - $9 are command line values passed to the script myscript hi $0 contains myscript $1 contains hi

If command if ( T/F ) then fi if ( T/F ) then else fi if ( T/F ) then elif ( T/F ) else fi

other structures while ( T/F ) do done case in value) ;; value) *) ;; esac

Example 1 echo “Do you like UNIX?” read answer case $answer in Y|y ) whoami >>pass echo “good!” ;; N|n ) whoami >>fail echo “To bad.” ;; *) echo “please enter y or n” ;; esac

Example 2 filename=‘jim.txt’ if ( test –r $filename ) then echo “$filename is readable.” elif ( test –f $filename ) then echo “$filename does not exists.” else echo “$filename is not readable.” fi

Typical linux init.d script #!/bin/sh # chkconfig: # description: Starts and stops the Samba smbd and nmbd daemons used to provide SMB network services. … start() { KIND="SMB" echo -n $"Starting $KIND services: " daemon smbd $SMBDOPTIONS RETVAL=$? echo KIND="NMB" echo -n $"Starting $KIND services: " daemon nmbd $NMBDOPTIONS RETVAL2=$? echo [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && touch /var/lock/subsys/smb || \ RETVAL=1 return $RETVAL } stop() { KIND="SMB" echo -n $"Shutting down $KIND services: " killproc smbd RETVAL=$? echo KIND="NMB" echo -n $"Shutting down $KIND services: " killproc nmbd RETVAL2=$? [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && rm -f /var/lock/subsys/smb echo "" return $RETVAL } command line output: #/etc/init.d/smb start Starting SMB services: [OK] Starting NMB services: [OK]

shorter init.d script if test $1 = "start" then /usr/local/bin/sshd elif test $1 = "stop" then killall -9 sshd fi

Q A &