CIT 470: Advanced Network and System Administration

Slides:



Advertisements
Similar presentations
Booting and Shuting Down WeeSan Lee. Roadmap Bootstrapping Boot Loaders Startup/Init Scripts Reboot & Shutdown Q&A.
Advertisements

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+ 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
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.
 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.
S.Ha.R.K. Workshop28/02/05 S.Ha.R.K. Installation HowTo Tullio Facchinetti University of Pavia - Italy.
1 Web Server Administration Chapter 3 Installing the Server.
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.
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.
Linux+ Guide to Linux Certification, Third Edition
CompTIA Linux+ Certification
Linux+ Guide to Linux Certification Chapter Three Linux Installation and Usage.
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
Linux Booting Procedure
CIS 228 Grub Basics and Boot Security How we get there.
Guide to Linux Installation and Administration, 2e1 Chapter 3 Installing Linux.
System Startup & Shutdown Objectives –to interpret the Unix startup and shutdown configuration files –to be able to create a customised run level Contents.
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.
14 Step-by-Step Instructions for an Upgrade Installation n Prepare for the installation Verify that all devices and applications are Windows 2000 compatible.
Linux Administration. Pre-Install Different distributions –Redhat, Caldera, mandrake, SuSE, FreeBSD Redhat Server Install –Check HCL –Significant issues.
Guide to Linux Installation and Administration1 Chapter 4 Running a Linux System.
System Startup & Shutdown
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.
INFO 320 Server Technology I Week 4 Basic Unix commands 1INFO 320 week 4.
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.
UNIX Startup and Shutdown CSCI N321 – System and Network Administration Copyright © 2000, 2009 by Scott Orr and the Trustees of Indiana University.
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.
Sys Admin Course Service Management Fourie Joubert.
System initialization Unit objectives A.Outline steps necessary to boot a Linux system, configure LILO and GRUB boot loaders, and dual boot Linux with.
1 Setup and Compile Linux Kernel Speaker: Yi-Ji Jheng Date:
Overview A) Power on or reset B) 1st stage boot loader C) 2nd stage boot loader D) Operate system.
Linux Introduction Linux was developed in the early 1990’s by Linus Torvald computer science student at the University of Helsinki Linux is distributed.
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.
Day 1 Tasks How do you backup the MBR (Master Boot Record) of a hard disk? How do you backup the primary partition table of an MBR type hard disk? How.
System Administration Startup Process. Why Care? ● Every process on your system comes about by following a specific chain of events from the machine startup.
The GRUB bootloader Michael Opdenacker Thomas Petazzoni Free Electrons
The Linux Kernel About 6 million lines of code
Guide to Linux Installation and Administration, 2e
Booting Up and Shutting Down
CIT 480: Securing Computer Systems
Linux Start Sequence Summary
Files Used in the Boot Process
Booting Up and Shutting Down
CONFIGURING HARDWARE DEVICE & START UP PROCESS
CIS 228 Grub Basics and Boot Security
OPS235: Week 1 Installing Linux (Lab1: Investigations 4 - )
SUSE Linux Enterprise Desktop Administration
Booting Up and Shutting Down
Instructor Materials Chapter 5: Windows Installation
Presentation transcript:

CIT 470: Advanced Network and System Administration Booting and Runlevels CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Topics Booting Bootstrap loaders Run levels Startup scripts Shutdown and reboot CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Booting 4 3 2 1 ROM boot code (BIOS) Bootloader Kernel Init http://eroidays.com/2009/05/28/oen-webinar-chanin-mitch-i-chat-on-bootstrapping/ CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration 1 BIOS Load CMOS settings. Initialize registers and power management. POST (Power On Self Test.)‏ Display system settings (if key pressed.)‏ Activate other BIOSes Disk interfaces Graphics cards Network interfaces Find bootable device. Load MBR. Run MBR program. CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration 1 Dell BIOS Screenshot CIT 470: Advanced Network and System Administration

MBR contains Bootloader 2 MBR contains Bootloader Only 446 bytes! MBR bootloader bootstraps itself by loading larger bootloader program from disk. CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration 2 Bootloader: GRUB http://www.if-not-true-then-false.com/2010/centos-netinstall-network-installation/ CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration 2 GRUB Boot Process Stage 1 (stored in MBR or boot sector)‏ Detect the geometry and the accessing mode of the loading drive. Finds and runs stage 1.5. Stage 1.5 (stored at beginning of partition) Understands filesystem; loads stage 2 from filesystem. Stage 2 (stored in filesystem)‏ Displays menu of OS choices. Often displays boot splashscreen. Loads selected OS kernel. fdisk /mbr will install the DOS MBR NTLDR is the bootloader for MS Windows NT/XP. http://mclevie.com/Debian/The%20Linux%20Boot%20Process.html CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration 2 GRUB Installation At OS Install Time Most distributions install GRUB. Linux Install grub-install /dev/hda Native install Boot with CD and run grub. #>> root (hd0,0)‏ #>> setup (hd0)‏ #>> quit CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration 2 GRUB Boot Automatically boots default OS after timeout. Key sequences bring up Menu of boot options (described in menu.lst)‏ Edit kernel options (runlevel, other features)‏ GRUB command shell A boot prompt password may be required before edit/shell access granted. Can bypass OS security by specifying kernel options or accessing files from GRUB shell. CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration 2 Booting with GRUB Direct Boot Specify OS kernel image to load. Chainloading Specify another bootloader to load. Chainload NTLDR to boot MS Windows. CIT 470: Advanced Network and System Administration

Config: /boot/grub/menu.lst 2 Config: /boot/grub/menu.lst # timeout (sec) before booting default timeout 10 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 title Windows 2000 root (hd0,0)‏ makeactive chainloader +1 CIT 470: Advanced Network and System Administration

GRUB Naming Convention 2 GRUB Naming Convention GRUB uses BIOS hard disk numbers OS may not number disks identically to BIOS. Examples (hd0,0) First partition of first hard disk (hd1,2) Third partition of second hard disk. CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration 3 Kernel Booting CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration 3 Initial RAMDisk Temporary filesystem used for booting. Stored as /boot/initrd-VERSION Loaded into memory by bootloader Contains drivers needed to mount root fs RAID, LVM, NFS or other device drivers Filesystem drivers Allows single kernel to be shipped by vendor Drivers specific to your system on RAMdisk Also supports hibernation for laptops CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration 3 Kernel Arguments Numeric arguments Specify runlevel. single also specifies single user mode Root device options root= specifies which root device to use ro, rw specify access type Console options console=ttyS1,9600 will use serial console Hardware options Enable, disable specific hardware devices/features. http://tldp.org/HOWTO/BootPrompt-HOWTO-3.html CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Run Levels 0 – Shutdown 1 – Single user mode 2 – Multi-user, no networking, no GUI 3 – Multi-user, with networking, no GUI 4 – Unused 5 – Multi-user, networking, and GUI 6 – Reboot Defined in /etc/inittab CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Single User Mode Single user mode has No GUI. No network access. Only one user (root) can use system. Why use single user mode? Run fsck to fix filesystem corruption. Backup files without filesystem active. Fix problems without user interference. May allow access to system without a password in case you have forgotten root’s password. CIT 470: Advanced Network and System Administration

Booting in Single User Mode 4 Booting in Single User Mode At GRUB prompt, select ‘a’ to append args Append this argument to list: single Hit return to complete argument changes Select ‘b’ to boot the kernel Single-user mode differs from run level 1 in that run level 1 runs the scripts for run level 1, then enters single-user mode. CIT 470: Advanced Network and System Administration

What if you lost your root password? 4 What if you lost your root password? At GRUB prompt, select ‘a’ to append arguments Append this argument to list: init=/bin/bash Hit return to complete argument changes Select ‘b’ to boot the kernel At root prompt, remount / mount / -o rw,remount Reset root password passwd Power cycle system CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration /etc/inittab # The default runlevel. id:2:initdefault: # Boot-time system configuration/initialization script. si::sysinit:/etc/init.d/rcS # What to do in single-user mode. ~~:S:wait:/sbin/sulogin # /etc/init.d executes the S and K scripts upon change 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 CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration rc Executed by init with runlevel as argument. Starts and stops services for each runlevel. /etc/rc#.d scripts Symlinks to actual scripts in /etc/init.d Stops services beginning with K* Starts services beginning with S* Executes in ASCII order. CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration 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 CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration 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=`/usr/bin/ps -e -u 0 | /usr/bin/fgrep sshd | /usr/bin/awk '{print $1}'` if [ ! -z "$PID" ] ; then /usr/bin/kill ${PID} >/dev/null 2>&1 *) echo "usage: /etc/init.d/sshd {start|stop}“ esac CIT 470: Advanced Network and System Administration

Turning Services On/Off 4 Turning Services On/Off Add a new service Install startup script in /etc/init.d Create S symlinks in appropriate runlevels Create K symlinks in appropriate runlevels Prevent a service from starting on boot Remove S links from /etc/rc?.d/* Remove K links from /etc/rc?.d/* CIT 470: Advanced Network and System Administration

Red Hat Service Commands 4 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 --level # NAME ln –s /etc/init.d/NAME /etc/init.d/rc.d/rc#.d/S??name CIT 470: Advanced Network and System Administration

Red Hat Service Configuration 4 Red Hat Service Configuration RH Linuxes use files in /etc/sysconfig VARIABLE=value format Documentation in RHEL manuals Examples desktop: select GNOME, KDE, XFCE desktop iptables: firewall configuration network-scripts/ifcfg-eth0: eth0 cfg

CIT 470: Advanced Network and System Administration /etc/sysconfig CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Shutdown shutdown –h now (or init 0)‏ Offers time-delay option (-h time) Runs server stop scripts. Kill remaining processes. Flushes writes to disk. halt Kills processes. Flushes writes to disk (sync). CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Reboot reboot (or init 6) restarts system Ctrl-Alt-Del Defined in /etc/inittab ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now Killing init will often shutdown or reboot system, but may cause kernel panic. CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration What's wrong with init? Performance Starts services sequentially. Shell scripts spawn lots of processes. Manual configuration Order to start services determined manually. i.e. network before authentication before nfs. Reliability Init doesn’t monitor or restart services after boot. Hotplug hardware Drives mounted at boot. What about USB or network drives? CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Init Alternatives iniNG Service config specifies dependencies. need = system/initial net/all; Starts services in parallel once dependencies met. launchd Mac replacement for init, rc, cron, atd, inetd Monitors services, starts on demand. Service Management Facility Sun replacement for init with service monitoring. CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Upstart Event-based init replacement. Events Hardware device has been added. Filesystem has been mounted. Time (cron-replacement) File has been modified. Another job has begun or finished running. Backwards compatible with /etc/init.d scripts. Respawns services that are down. http://netsplit.com/2006/08/26/upstart-in-universe/ CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Boot Process Summary http://www.kbrandt.com/2007/07/mindmap-of-ubuntu-feisty-fawn-boot.html CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration Key Points Boot Steps BIOS Bootloader (GRUB) Kernel init init is PID 1, parent of all processes, started by kernel Uses rc command to run all scripts in /etc.rcN.d dir where N is runlevel RHEL: use chkconfig to configure, /etc/sysconfig for options Run levels 1 and Single user mode (use to fix problems) 3 = multiuser + network (servers) 5 = multiuser + network + GUI (workstations) CIT 470: Advanced Network and System Administration

CIT 470: Advanced Network and System Administration References Aeleen Frisch, Essential System Administration, 3rd edition, O’Reilly, 2002. M. Tim Jones, “Inside the Linux boot process,” http://www.ibm.com/developerworks/library/l-linuxboot/index.html, 2006. M. Tim Jones, “Parallelize applications for faster Linux booting,” http://www.ibm.com/developerworks/linux/library/l-boot-faster/index.html, 2007. Evi Nemeth et al, UNIX System Administration Handbook, 3rd edition, Prentice Hall, 2001. Scott James Remnant, “Upstart in Universe,” http://www.netsplit.com/2006/08/26/upstart-in-universe/, 2006. Starman, “Boot records revealed: MBR details,” http://mirror.href.com/thestarman/asm/mbr/index.html “Extended boot record,” http://en.wikipedia.org/wiki/Extended_Boot_Record. GRUB manual, http://www.gnu.org/software/grub/manual/grub.html “How it works: Master Boot Record (MBR),” http://www.ata- atapi.com/hiwmbr.htm “Replacement Init”, https://wiki.ubuntu.com/ReplacementInit CIT 470: Advanced Network and System Administration