System Startup & Shutdown Objectives –to interpret the Unix startup and shutdown configuration files –to be able to create a customised run level Contents.

Slides:



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

OS Services System calls and their types
Basic Unix system administration
Some history PDP versions BSD/Version 7 split VAX virtual memory implementations End of line 4.4 BSD System V merges Modern versions OSF/1, Solaris, HPUX.
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 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
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.
Hands-On Microsoft Windows Server 2003 Administration Chapter 10 Monitoring and Troubleshooting Windows Server 2003.
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.
Va-scanCopyright 2002, Marchany Unit 4 – The Boot Process Randy Marchany VA Tech Computing Center.
System Startup and Shutdown
Linux System Administration LINUX SYSTEM ADMINISTRATION.
UNIX Startup and Shutdown CSCI N321 – System and Network Administration Copyright © 2000, 2012 by Scott Orr and the Trustees of Indiana University.
Linux Filesystem Management
Booting and boot levels
itec 400 System Startup/Shutdown
Introduction to Unix Administration Objectives –to identify the basic concepts of Unix administration Contents –history of Unix –unix vendors and standards.
Guide to Linux Installation and Administration, 2e1 Chapter 8 Basic Administration Tasks.
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.
2/19/2003 Lecture 3 Computer System Administration Lecture 3 Setup (continued)
UNIX Startup and Shutdown CSCI N321 – System and Network Administration Copyright © 2000, 2010 by Scott Orr and the Trustees of Indiana University.
Linux+ Guide to Linux Certification, Third Edition
The Linux Operating System Lecture 3: Becoming the Superuser and Users and Groups The Tonga Institute of Higher Education.
SUSE Linux Enterprise Server Administration (Course 3037) Chapter 6 Manage Linux Processes and Services.
Guide to Linux Installation and Administration1 Chapter 4 Running a Linux System.
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.
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.
Linux Security. Module 13 – Linux Security ♦ Overview Linux is more prone today to security loopholes and attacks, both inside and outside the network.
Advanced Programming in the UNIX Environment Hop Lee.
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.
System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:
Runlevel initialization. Boot to Linux Grub interface.
UNIX Startup and Shutdown CSCI N321 – System and Network Administration Copyright © 2000, 2009 by Scott Orr and the Trustees of Indiana University.
135 Shutdown and Reboot Version A.01 H3064S Module 17 Slides.
CSC414 “Introduction to UNIX/ Linux” Lecture 6. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
Unix System Administration Booting and Shutting Down Chapter 2.
Sys Admin Course Service Management Fourie Joubert.
1 Figure 6-5: Turning Off Unnecessary Services Unnecessary Services  Operating system vendors used to install many services by default  This made them.
Lecture 4 & 5: System Architecture  File systems  Devices  File system permissions  Review of Linux runlevels  In-class exercise.
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.
Using Networks. Assignment Issues find syntax Permissions HW4 3c /proc vs /tmp vs /var.
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
The Linux Kernel About 6 million lines of code
SYSTEM ADMINISTRATION PART I by İlker Korkmaz and Kaya Oğuz
System Programming and administration CS 308
Chapter 2: System Structures
Linux Start Sequence Summary
Chapter 4 Booting and Shutdown
CONFIGURING HARDWARE DEVICE & START UP PROCESS
OPS235: Week 1 Installing Linux (Lab1: Investigations 4 - )
SUSE Linux Enterprise Desktop Administration
LINUX SYSTEM ADMINISTRATION
Objectives Topic 2.6 Understanding the boot process
Presentation transcript:

System Startup & Shutdown Objectives –to interpret the Unix startup and shutdown configuration files –to be able to create a customised run level Contents –bootstrap procedure –single and multi-user run levels –system startup files (rc files) –standard system processes –clean shutdown procedure –maintenance mode Practicals –to modify the startup sequence of a Unix system Summary

Standard Boot Process The system boot process is hardware-specific –often an automatic boot from hardware into multi-user Unix –high security systems require PROM password for manual boot Once loaded the Unix kernel starts running –initialise devices, virtual memory, etc. –initialise internal tables (processes, files, etc.) –creates scheduler process (number 0) –runs the first process (number 1) /sbin/init System initialisation performed by /sbin/init is user configurable Solaris & AIX bios b boot standard system b -s boot to single user mode b diag boot named program (diagnostics) b unix.bak -s boot backup kernel Solaris & AIX bios b boot standard system b -s boot to single user mode b diag boot named program (diagnostics) b unix.bak -s boot backup kernel

Startup Flow Control run level 0 boot run level 1 single-user maintenance run level 2 multi-user run level 3 multi-user & DFS run level 4 multi-user user defined

RedHat Run-Levels Run levels are standard under RedHat Unix: 0bootstrap or power down levels 1administration mode 2not used 3multi-user with DFS & networking 4not used 5X-Windows 6halt & reboot s/Ssingle-user mode a/b/cpseudo states (rarely used) Use the -r option to who to get the current run level # who -r. run level 3 Jan 01 7: S 3 # shutdown -i6 -g60 clean reboot in 60 seconds # who -r. run level 3 Jan 01 7: S 3 # shutdown -i6 -g60 clean reboot in 60 seconds

The init Control file: /etc/inittab The init process uses /etc/inittab as its control file # Default runlevel. The runlevels used by RHS are: # 0 - halt (Do NOT set initdefault to this) # 1 - Single user mode # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) # 3 - Full multiuser mode # 4 – unused # 5 - X11 # 6 - reboot (Do NOT set initdefault to this) # #id:3:initdefault: # Console Text Mode id:5:initdefault: # Console GUI Mode Processes run from /etc/inittab are daemons –standard I/O attached to /dev/null –I/O usually be redirected to a log file or perhaps the console

Structure of /etc/inittab Each line has 4 fields separated by colons id : level : action : process id unique identifier for line - up to four alphanumerics level run level(s) to activate process action keyword for how to run process command full pathname and parameters of command to be executed Main inittab action keywords are: off don't run the command wait run command and wait for completion once run command, but don't wait respawn run command. If process exits, then repeat the command sysinit run command at first init boot run command at boot-timebut don't wait bootwait like boot, but wait for completion initdefault defines default boot-level

Exercise - /etc/inittab What processes are run at system startup What processes are run at system shutdown # more /etc/inittab id:3:initdefault: 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 ca::ctrlaltdel:/sbin/shutdown -t3 -r now pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure!” pr:12345:powerokwait:/sbin/shutdown -c "Power Restored” 1:2345:respawn:/sbin/mingetty tty1 2:2345:respawn:/sbin/mingetty tty2 # more /etc/inittab id:3:initdefault: 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 ca::ctrlaltdel:/sbin/shutdown -t3 -r now pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure!” pr:12345:powerokwait:/sbin/shutdown -c "Power Restored” 1:2345:respawn:/sbin/mingetty tty1 2:2345:respawn:/sbin/mingetty tty2

Run Command Scripts The run command scripts invoked by init via /etc/inittab Each rc script in /etc/rc.d/ controls changes to named run level Each script runs startup programs in directory /etc/rc?.d rc 0 looks in /etc/rc0.d for levels 0 rc 1 looks in /etc/rc1.d for level 1 rc 2 looks in /etc/rc2.d for levels 2 & 3 rc 3 looks in /etc/rc3.d for level 3 Startup program names of form sNNname s S to start process or K to kill process at this run level NN sequence number name name of script in /etc/init.d –All startup programs in runlevels are links to /etc/rc.d/init.d

# more /etc/init.d/inet case "$1" in start)......;; stop)......;; esac # ln init.d/inet rc0.d/K69inet # ln init.d/inet rc2.d/S69inet # init 2 # init 0 # more /etc/init.d/inet case "$1" in start)......;; stop)......;; esac # ln init.d/inet rc0.d/K69inet # ln init.d/inet rc2.d/S69inet # init 2 # init 0 RC Script Details # sh S69inet start # sh K69inet stop

Set Programs Run At Each runlevel Check, set and move program’s to various runlevels Switch Off Sendmail In Levels 3 and 5 # chkconfig --level 35 sendmail off Switch On Sendmail Starting Up In Levels 3 and 5 # chkconfig --level 35 sendmail on # chkconfig --list keytable 0:off 1:on 2:on 3:on 4:on 5:on 6:off atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off syslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off gpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off kudzu 0:off 1:off 2:off 3:on 4:on 5:on 6:off wlan 0:off 1:off 2:on 3:on 4:on 5:on 6:off sendmail 0:off 1:off 2:off 3:on 4:off 5:on 6:off netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off network 0:off 1:off 2:on 3:on 4:on 5:on 6:off random 0:off 1:off 2:on 3:on 4:on 5:on 6:off... # chkconfig --list keytable 0:off 1:on 2:on 3:on 4:on 5:on 6:off atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off syslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off gpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off kudzu 0:off 1:off 2:off 3:on 4:on 5:on 6:off wlan 0:off 1:off 2:on 3:on 4:on 5:on 6:off sendmail 0:off 1:off 2:off 3:on 4:off 5:on 6:off netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off network 0:off 1:off 2:on 3:on 4:on 5:on 6:off random 0:off 1:off 2:on 3:on 4:on 5:on 6:off...

Manually start and stop services Check if service is running Stop service Start service Reload service after reconfiguring # service vsftpd status vsftpd (pid 6070) is running... # service vsftpd stop Shutting down vsftpd: [ OK ] # service vsftpd start Starting vsftpd for vsftpd: [ OK ] # service vsftpd reload Shutting down vsftpd: [ OK ] Starting vsftpd for vsftpd: [ OK ] # service vsftpd reload Shutting down vsftpd: [ OK ] Starting vsftpd for vsftpd: [ OK ]

Changing run levels Use init to change run levels if users not logged –use to switch to multi-user from single user –use to switch between multi-user levels Use shutdown to close down the system –warns users what is happening –performes a lot of housekeeping routines –issues the init command # init 2 switch to run level 2 # init 3 now switch to run level 3 # shutdown default system shutdown # init 2 switch to run level 2 # init 3 now switch to run level 3 # shutdown default system shutdown

System Shutdown Use /sbin/shutdown when closing down a Unix system shutdown [-y] [-g N ] [-i M ] -y pre-answer yes to confirmation question -g N grace period in seconds (default 60) -i M shutdown level (default S) –wall is used to send broadcasts at set intervals until system shutdown –shutdown is started by init changing to new run level –any process left running are sent a TERM signal –any still running are sent a KILL signal WARNING: databases cannot normally close down quickly enoughwhen receiving a TERM signal during shutdown # shutdown -i6 -g0 -y reboot the system now # shutdown -i0 -g3600 halt system in one hour # shutdown -i6 -g0 -y reboot the system now # shutdown -i0 -g3600 halt system in one hour

BSD Derived Systems (AIX, OSF/1) Only one multi user level –boot up direct to multi-user –boot to single user and go to multi-user on exit from single user root shell –cannot use init to change levels Use shutdown and specify time to exit from multi user Startup/shutdown controlled by command scripts in /etc –scripts must be modified using a text editor –require knowledge of script programming –look for files: rc, rc.local, rc.single, rc.tcpip, rc.boot, rc.shutdown # shutdown -r now reboot the system now # shutdown -h 17:00 halt system at 5pm # shutdown -r now reboot the system now # shutdown -h 17:00 halt system at 5pm # shutdown now password: # sync # halt # shutdown now password: # sync # halt # poweroff

Maintenance mode Maintenance mode is used to get out of trouble –the system won't boot due to password/kernel/init problems If the system is alive and well, use shutdown to run level 1 Otherwise reboot to single user mode –if you have to power cycle the system wait for the disk activity lights to stop blinking If the system won’t boot, insert the installation (boot) media, and boot from this instead –ensure that you do not attempt to reinstall the system at this point –this will give you a system where Unix is running in memory using the installation media as a filesystem. The hard disk may now be able to be fixed (if you are lucky!)

Summary Unix systems start up through a clearly defined sequence The first configurable stage is with the init process using /etc/inittab Run levels provide additional configuration through the run command scripts Link and remove files from the /etc/rc*.d directories to enable/disable sub-systems for different run levels Shutdown Unix using the shutdown command AIX and OSF/1 (BSD) use a different mechanism to RH9, SVR4 (SVR3.2) systems