CIS 191 – Lesson 4 Lesson Module Status Slides - draft Flash cards – 14 No-stress quiz – done Web calendar summary – done Web book pages – done Commands.

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 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.
2.1 © 2004 Pearson Education, Inc. Exam Managing and Maintaining a Microsoft® Windows® Server 2003 Environment Lesson 2: Installing Windows Server.
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:
Lesson 15 – INSTALL AND SET UP NETWARE 5.1. Understanding NetWare 5.1 Preparing for installation Installing NetWare 5.1 Configuring NetWare 5.1 client.
1 Web Server Administration Chapter 3 Installing the Server.
Starting and Stopping Linux. Boot Process BIOS initializes hardware –Loads the boot sector MBR loads the bootloader –Point to kernel Kernel initializes.
System Startup and Shutdown
CCNA 2 v3.1 Module 2.
© 2010 VMware Inc. All rights reserved VMware ESX and ESXi Module 3.
Linux System Administration LINUX SYSTEM ADMINISTRATION.
Linux Operations and Administration
UNIX Startup and Shutdown CSCI N321 – System and Network Administration Copyright © 2000, 2012 by Scott Orr and the Trustees of Indiana University.
1 Chapter 2 ROUTER FUNDAMENTALS By: Tassos Tassou.
Linux+ Guide to Linux Certification, Third Edition
CompTIA Linux+ Certification
Linux+ Guide to Linux Certification Chapter Three Linux Installation and Usage.
Booting and boot levels
CIS Lesson 4 Booting the System. CIS Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot.
Guide to Linux Installation and Administration, 2e1 Chapter 3 Installing Linux.
Hands-On Virtual Computing
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.
CIS 191 – Lesson 5 Lesson Module Status Slides – draft Properties - done Flash cards – 9 No-stress quiz – done Web Calendar summary – done Web book pages.
University of Management & Technology 1 Operating Systems & Utility Programs.
UNIX Startup and Shutdown CSCI N321 – System and Network Administration Copyright © 2000, 2010 by Scott Orr and the Trustees of Indiana University.
Guide to Linux Installation and Administration, 2e1 Chapter 2 Planning Your System.
System Startup & Shutdown
Setting the BIOS BIOS – Part 3 Richard L. Goldman March 2000.
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.
Linux Startup Process Presenter: Dipu Gupta.
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.
CSC190 Introduction to Computing Operating Systems and Utility Programs.
Chapter 8: Installing Linux The Complete Guide To Linux System Administration.
Linux Operations and Administration
Runlevel initialization. Boot to Linux Grub interface.
© 2006 Cisco Systems, Inc. All rights reserved.Cisco PublicITE I Chapter 6 1 Router Initialization steps.
UNIX Startup and Shutdown CSCI N321 – System and Network Administration Copyright © 2000, 2009 by Scott Orr and the Trustees of Indiana University.
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:
Using Networks. Assignment Issues find syntax Permissions HW4 3c /proc vs /tmp vs /var.
Local Area Tracking system System Control Unit. Goals Configure Spartan 3 FPGA development board to boot and run uClinux OS Configure Spartan 3 FPGA development.
Linux Introduction Linux was developed in the early 1990’s by Linus Torvald computer science student at the University of Helsinki Linux is distributed.
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
LINUX SYSTEM ADMINISTRATION
VMware ESX and ESXi Module 3.
Chapter Objectives In this chapter, you will learn:
Guide to Linux Installation and Administration, 2e
System Programming and administration CS 308
Linux Start Sequence Summary
Securing Network Services
SUSE Linux Enterprise Desktop Administration
LINUX SYSTEM ADMINISTRATION
Presentation transcript:

CIS 191 – Lesson 4 Lesson Module Status Slides - draft Flash cards – 14 No-stress quiz – done Web calendar summary – done Web book pages – done Commands – done Skills pacing - done Next lab – done Software – cis191-rh9, duke vms centos, knoppix iso Chocolate – done Make copies of test -

CIS 191 – Lesson 4 ObjectivesAgenda Install openSUSE 11 Walk through system startup and shutdown Change default run level Customize run levels Manage services Questions from last week Test Exercise: Test Lab 2 pen drive boots Skills needed Booting the system Rooting the system * Init and Runlevels Shutting down the system Startup & shutdown walkthrough OpenSUSE inittab Exercise: Start Lab3 (CentOS) Wrap up  = hands on exercise for topic System Startup and Shutdown

CIS 191A Lesson 1 VMware Server Ubuntu 8.04 Lesson 2 Partitioning Make file systems RH9 Lesson 3 Booting Dual boot Fedora 8/DOS Lesson 6 RPM, apt-get Tarballs Custom Distro Lesson 5 Troubleshooting OpenSUSE Lesson 4 Rooting CentOS Lesson 7 X windows Debian Install Review Final Course Skills Pacing

CIS Lesson 4 Last weeks Assignment Questions on previous material or assignments? Lab 2 and five posts due midnight today

CIS Lesson 4 Housekeeping

CIS Lesson 4 Last weeks Assignment Code names for grades page Hand back graded work

CIS Lesson 4 Test Flashcards (random for practise) Monitors off Books closed You may use one double-sided crib sheet

CIS Lesson 4 Boot USB Pen Drive (Lab2)

CIS Lesson 4 Test Pen Drives made in Lab 2 Consultants and Clients exercise Things that could go wrong: not ext3 path issues in grub.conf no init= on kernel line Used different Linux than Fedora 8 or 9 to make (possible initrd issues) Use: if needed Redo with Duke VM if all else fails If your pen drive boots on class PC: You are a consultant and your job is to find a client to get their pen drive to boot. If your pen drive does not boot yet: Raise your hand for a consultant to come and assist. When all pen drives are booting: Dark chocolate will appear

CIS Lesson 4 Skills Needed

CIS Lesson 4 Lesson 4 Skills Needed Know where to find key logs and scripts Read logs to monitor startup and shutdown Be able to show and set the default run level Password protect single user mode Be able to customize run levels (Red Hat systems) Manually stop and start a service

CIS Lesson 4 Booting the System

CIS Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot Record. 3.MBR read its partition table to determine which partition to boot into. 4.MBR loads the boot program in the active partition. 5.Boot program presents user with boot prompt menu. 6.Based upon user selection, boot program loads desired kernel along with and supplied boot options 7.Kernel uncompresses and loads into memory. 8.Kernel detects hardware and initializes its data.

CIS Lesson 4 Rooting the System

CIS Lesson 4 Rooting the System 1.Kernel mounts the root file system 2.Kernel creates and starts the init process 3. init reads /etc/inittab for its instructions 4. init performs system initialization: presents some kind of welcome banner allows for and interactive startup set up keyboard mapping, system fonts, plug and play devices, … checks for dirty file systems, can cleans them if necessary checks disk quotas and swap space mounts all file systems 5.Chooses which runlevel to come up in and executes those scripts via rc script 6.daemons load 7.getty processes are spawned on terminal devices

CIS Lesson 4 Init and runlevels

CIS Lesson 4 Init and Runlevels The /etc/inittab file: A two letter system identifier id A list of runlevels for specified actions An action – how and when should a command be run The process – which command to run Runlevels Runlevel 0 Runlevel 1 Runlevel 2 Runlevel 3, 4, 5 Runlevel 6 rc scripts and/or rc.d directories for each run level RC script naming conventions Start with S or K A number A daemon shell script

CIS Lesson 4 /etc/inittab Red Hat 9 – Page 1 root]# cat /etc/inittab # # inittab This file describes how the INIT process should set up # the system in a certain run-level. # # Author: Miquel van Smoorenburg, # Modified for RHS Linux by Marc Ewing and Donnie Barnes # # 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:5:initdefault: # System initialization. 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

CIS Lesson 4 /etc/inittab Red Hat 9 – Page 1 root]# cat /etc/inittab # # inittab This file describes how the INIT process should set up # the system in a certain run-level. # # Author: Miquel van Smoorenburg, # Modified for RHS Linux by Marc Ewing and Donnie Barnes # # 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:5:initdefault: # System initialization. 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 The /etc/inittab file used by the init program Instruction syntax: id:runlevels:action:process id - A two letter system identifier runlevels - A list of runlevels for specified actions action – how and when should a command be run process – the command or script to run Set default system runlevel

CIS Lesson 4 /etc/inittab Red Hat 9 – Page 1 root]# cat /etc/inittab # # inittab This file describes how the INIT process should set up # the system in a certain run-level. # # Author: Miquel van Smoorenburg, # Modified for RHS Linux by Marc Ewing and Donnie Barnes # # 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:5:initdefault: # System initialization. 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 The /etc/inittab file used by the init program Instruction syntax: id:runlevels:action:process id - A two letter system identifier runlevels - A list of runlevels for specified actions action – how and when should a command be run process – the command or script to run Initialize system (applies to all runlevels)

CIS Lesson 4 /etc/inittab Red Hat 9 – Page 1 root]# cat /etc/inittab # # inittab This file describes how the INIT process should set up # the system in a certain run-level. # # Author: Miquel van Smoorenburg, # Modified for RHS Linux by Marc Ewing and Donnie Barnes # # 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:5:initdefault: # System initialization. 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 The /etc/inittab file used by the init program Instruction syntax: id:runlevels:action:process id - A two letter system identifier runlevels - A list of runlevels for specified actions action – how and when should a command be run process – the command or script to run Transition to specific runlevel

CIS Lesson 4 /etc/inittab Red Hat 9 – Page 1 root]# cat /etc/inittab # # inittab This file describes how the INIT process should set up # the system in a certain run-level. # # Author: Miquel van Smoorenburg, # Modified for RHS Linux by Marc Ewing and Donnie Barnes # # 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:5:initdefault: # System initialization. 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 Modify this number to change default runlevel Instructions for the init program System initialization script Runlevel transition script

CIS Lesson 4 /etc/inittab Red Hat 9 – Page 1 root]# cat /etc/inittab # # inittab This file describes how the INIT process should set up # the system in a certain run-level. # # Author: Miquel van Smoorenburg, # Modified for RHS Linux by Marc Ewing and Donnie Barnes # # 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:5:initdefault: # System initialization. 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 To force user to login with root password for singe user mode add: s0:S:wait:/sbin/sulogin (more in CIS 193)

CIS Lesson 4 /etc/inittab Red Hat 9 – page 2 # Trap CTRL-ALT-DELETE ca::ctrlaltdel:/sbin/shutdown -t3 -r now # When our UPS tells us power has failed, assume we have a few minutes # of power left. Schedule a shutdown for 2 minutes from now. # This does, of course, assume you have powerd installed and your # UPS connected and working correctly. pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down" # If power was restored before the shutdown kicked in, cancel it. pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled" # Run gettys in standard runlevels 1:2345:respawn:/sbin/mingetty 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 # Run xdm in runlevel 5 x:5:respawn:/etc/X11/prefdm -nodaemon root]# mingetty prompts for a username then initiates login process on ttys respawn fires up programs again when they end Note: Runlevel 1 is single user mode Action to take on ctrl-alt-del To disable, comment out with # Runlevel 5 is graphics mode using X

CIS Lesson 4 /etc/inittab password protection in single user mode During GRUB boot, edit the kernel line and add "single" to boot into single user mode Without s0:S:wait:/sbin/sulogin in /etc/inittab Logged in as root without entering a password With s0:S:wait:/sbin/sulogin in /etc/inittab Must enter password to be logged in as root

CIS Lesson 4 runlevel command show previous and current runlevels root]# runlevel N 5 root]# Previous runlevel (N=None) Current runlevel

CIS Lesson 4 Important log files dmesg command or /var/log/dmesg var/log/dmesg – kernel boot messages root]# dmesg | more Linux version (gcc version (Red Hat Linux )) #1 Thu Feb 27 10:06:59 EST 2003 BIOS-provided physical RAM map: BIOS-e820: f800 (usable) BIOS-e820: f a0000 (reserved) BIOS-e820: ca cc000 (reserved) BIOS-e820: dc e0000 (reserved) BIOS-e820: e (reserved) BIOS-e820: fef0000 (usable) BIOS-e820: fef feff000 (ACPI data) BIOS-e820: feff ff00000 (ACPI NVS) BIOS-e820: ff (usable) BIOS-e820: fec fec10000 (reserved) BIOS-e820: fee fee01000 (reserved) BIOS-e820: fffe (reserved) 0MB HIGHMEM available. 256MB LOWMEM available. On node 0 totalpages: zone(0): 4096 pages. zone(1): pages. zone(2): 0 pages. Kernel command line: ro root=LABEL=/

CIS Lesson 4 Important log files /var/log/boot.log var/log/boot.log – show services root]# more /var/log/boot.log Aug 13 07:55:46 rh9 syslog: syslogd startup succeeded Aug 13 07:55:46 rh9 syslog: klogd startup succeeded Aug 13 07:55:46 rh9 portmap: portmap startup succeeded Aug 13 07:55:46 rh9 nfslock: rpc.statd startup succeeded Aug 13 07:55:46 rh9 keytable: Loading keymap: Aug 13 07:55:46 rh9 keytable: Aug 13 07:55:46 rh9 rc: Starting keytable: succeeded Aug 13 07:55:47 rh9 random: Initializing random number generator: succeeded Aug 13 07:55:47 rh9 rc: Starting pcmcia: succeeded Aug 13 07:55:47 rh9 netfs: Mounting other filesystems: succeeded Aug 13 07:55:47 rh9 apmd: apmd startup succeeded Aug 13 07:55:47 rh9 autofs: automount startup succeeded Aug 13 07:55:48 rh9 sshd: RSA1 key generation succeeded Aug 13 07:55:48 rh9 sshd: RSA key generation succeeded Aug 13 07:55:46 rh9 ifup: failed; no link present. Check cable? Aug 13 07:55:46 rh9 network: Bringing up interface eth0: failed Aug 13 07:55:49 rh9 sshd: DSA key generation succeeded Aug 13 07:55:49 rh9 sshd: succeeded Aug 13 07:55:53 rh9 xinetd: xinetd startup succeeded Aug 13 07:55:53 rh9 sendmail: sendmail startup succeeded Aug 13 07:55:54 rh9 sendmail: sm-client startup succeeded

CIS Lesson 4 Red Hat Runlevels - /etc/rc.d/ rc.d]# ls -R.: init.d rc rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d rc.local rc.sysinit./init.d: anacron autofs firstboot halt isdn killall network nscd portmap rhnsd single vmware-tools ypbind apmd crond functions iptables kdcrotate kudzu nfs ntpd random saslauthd sshd xfs atd cups gpm irda keytable netfs nfslock pcmcia rawdevices sendmail syslog xinetd./rc0.d: K03rhnsd K05keytable K10cups K20nfs K30sendmail K60crond K74ntpd K86nfslock K90network K95firstboot S00killall K05anacron K05saslauthd K10xfs K24irda K44rawdevices K72autofs K75netfs K87portmap K91isdn K95kudzu S01halt K05atd K08vmware-tools K15gpm K25sshd K50xinetd K74apmd K80random K88syslog K92iptables K96pcmcia./rc1.d: K03rhnsd K05saslauthd K10xfs K24irda K44rawdevices K72autofs K75netfs K87portmap K91isdn K95kudzu S17keytable K05anacron K08vmware-tools K15gpm K25sshd K50xinetd K74apmd K80random K88syslog K92iptables K96pcmcia K05atd K10cups K20nfs K30sendmail K60crond K74ntpd K86nfslock K90network K95firstboot S00single./rc2.d: K03rhnsd K20nfs K50xinetd K75netfs K95firstboot S09isdn S17keytable S24pcmcia S80sendmail S90cups S99local K05atd K24irda K72autofs K86nfslock K95kudzu S10network S19vmware-tools S26apmd S85gpm S90xfs K05saslauthd K44rawdevices K74ntpd K87portmap S08iptables S12syslog S20random S55sshd S90crond S95anacron./rc3.d: K05saslauthd K74ntpd S08iptables S12syslog S17keytable S24pcmcia S28autofs S56xinetd S90crond S95anacron S99local K20nfs K95firstboot S09isdn S13portmap S19vmware-tools S25netfs S55sshd S80sendmail S90cups S95atd K24irda S05kudzu S10network S14nfslock S20random S26apmd S56rawdevices S85gpm S90xfs S97rhnsd./rc4.d: K05saslauthd K24irda S05kudzu S10network S14nfslock S24pcmcia S28autofs S56xinetd S90crond S95anacron S99local K08vmware-tools K74ntpd S08iptables S12syslog S17keytable S25netfs S55sshd S80sendmail S90cups S95atd K20nfs K95firstboot S09isdn S13portmap S20random S26apmd S56rawdevices S85gpm S90xfs S97rhnsd./rc5.d: K05saslauthd K74ntpd S08iptables S12syslog S17keytable S24pcmcia S28autofs S56xinetd S90crond S95anacron S99local K20nfs K95firstboot S09isdn S13portmap S19vmware-tools S25netfs S55sshd S80sendmail S90cups S95atd K24irda S05kudzu S10network S14nfslock S20random S26apmd S56rawdevices S85gpm S90xfs S97rhnsd./rc6.d: K03rhnsd K05keytable K10cups K20nfs K30sendmail K60crond K74ntpd K86nfslock K90network K95firstboot S00killall K05anacron K05saslauthd K10xfs K24irda K44rawdevices K72autofs K75netfs K87portmap K91isdn K95kudzu S01reboot K05atd K08vmware-tools K15gpm K25sshd K50xinetd K74apmd K80random K88syslog K92iptables K96pcmcia rc.d]# Directory name specifies the runlevel File names specify action, order, and service: S = Start, K=Kill Two digit sequence order Name of service(daemon) to start or kill From /etc/inittab 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

CIS Lesson 4 Red Hat Runlevel 3 - /etc/rc.d/rc3.d Directory name specifies the runlevel File names specify action, order, and service: S = Start, K=Kill Two digit start/stop sequence order Name of service(daemon) to start or kill Symbolic links used to actual scripts in /etc/rc.d/int.d/

CIS Lesson 4 Red Hat Runlevel 3 - /etc/rc.d/rc3.d/S55sshd This is the script that is run by the rc script to start and stop the ssh service

CIS Lesson 4 init command Change runlevels now

CIS Lesson 4 show and customize runlevels service and chkconfig commands root]# service cups stop Stopping cups: [ OK ] root]# service cups start Starting cups: [ OK ] root]# service cups restart Stopping cups: [ OK ] Starting cups: [ OK ] root]# service cups status cupsd (pid 1774) is running... root]# rc.d]# chkconfig --list cups cups 0:off 1:off 2:on 3:on 4:on 5:on 6:off rc.d]# chkconfig --level 3 cups off rc.d]# chkconfig --list cups cups 0:off 1:off 2:on 3:off 4:on 5:on 6:off rc.d]# chkconfig --level 3 cups on rc.d]# chkconfig --list cups cups 0:off 1:off 2:on 3:on 4:on 5:on 6:off rc.d]# To stop and start a service (will stay until next reboot) To stop and start a service permanently (won't take place until next reboot)

CIS Lesson 4 chkconfig command customize runlevels rc.d]# ls rc3.d K05saslauthd S08iptables S17keytable S28autofs S90crond S99local K20nfs S09isdn S19vmware-tools S55sshd S90cups K24irda S10network S20random S56rawdevices S90xfs K74ntpd S12syslog S24pcmcia S56xinetd S95anacron K95firstboot S13portmap S25netfs S80sendmail S95atd S05kudzu S14nfslock S26apmd S85gpm S97rhnsd rc.d]# chkconfig --level 3 cups off rc.d]# ls rc3.d K05saslauthd S05kudzu S14nfslock S26apmd S85gpm S99local K10cups S08iptables S17keytable S28autofs S90crond K20nfs S09isdn S19vmware-tools S55sshd S90xfs K24irda S10network S20random S56rawdevices S95anacron K74ntpd S12syslog S24pcmcia S56xinetd S95atd K95firstboot S13portmap S25netfs S80sendmail S97rhnsd rc.d]# chkconfig --level 3 cups on rc.d]# ls rc3.d K05saslauthd S08iptables S17keytable S28autofs S90crond S99local K20nfs S09isdn S19vmware-tools S55sshd S90cups K24irda S10network S20random S56rawdevices S90xfs K74ntpd S12syslog S24pcmcia S56xinetd S95anacron K95firstboot S13portmap S25netfs S80sendmail S95atd S05kudzu S14nfslock S26apmd S85gpm S97rhnsd rc.d]#

CIS Lesson 4 chkconfig command show all services and runlevels rc.d]# chkconfig --list vmware-tools 0:off 1:off 2:on 3:on 4:off 5:on 6:off kudzu 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 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 rawdevices 0:off 1:off 2:off 3:on 4:on 5:on 6:off pcmcia 0:off 1:off 2:on 3:on 4:on 5:on 6:off saslauthd 0:off 1:off 2:off 3:off 4:off 5:off 6:off keytable 0:off 1:on 2:on 3:on 4:on 5:on 6:off apmd 0:off 1:off 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 gpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off autofs 0:off 1:off 2:off 3:on 4:on 5:on 6:off iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off irda 0:off 1:off 2:off 3:off 4:off 5:off 6:off isdn 0:off 1:off 2:on 3:on 4:on 5:on 6:off sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off portmap 0:off 1:off 2:off 3:on 4:on 5:on 6:off nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off sendmail 0:off 1:off 2:on 3:on 4:on 5:on 6:off rhnsd 0:off 1:off 2:off 3:on 4:on 5:on 6:off crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off anacron 0:off 1:off 2:on 3:on 4:on 5:on 6:off xfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off xinetd 0:off 1:off 2:off 3:on 4:on 5:on 6:off cups 0:off 1:off 2:on 3:on 4:on 5:on 6:off ntpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off firstboot 0:off 1:off 2:off 3:off 4:off 5:off 6:off

CIS Lesson 4 Exercise: Runlevels 1.Find out what your current runlevel is. 2.Start and stop the cups service. 3.Configure cups service to not start for runlevel 3 4.Change from run level 5 to runlevel 2 5.Check cups service (hint: service cups status ) 6.Change from 2 to 3 7.Check cups service 8.Reconfigure cups service back to original setting for runlevel 3 and start the service manually. Note: If you mouse starts acting "weird" in your VM after changing runlevles, then restart the gpm service: service gpm restart

CIS Lesson 4 Shutting down the system

CIS Lesson 4 Shutting down the system Shutting down: Users log out Services halt Data is saved File systems are unmounted System powers off Types of shutdowns: init 0 – no user warning shutdown [-hcr] time – warns users before shutting down halt and reboot – shortcuts for shutdown Ctrl-Alt-Del – shutdown behavior can be disabled

CIS Lesson 4 shutdown command Schedule for a time in the future

CIS Lesson 4 shutdown command Cancelling a pending shutdown

CIS Lesson 4 halt command shortcut to shutdown

CIS Lesson 4 Startup and Shutdown walk-through

CIS Lesson 4 /etc/inittab Red Hat 9 – Page 1 root]# cat /etc/inittab # # inittab This file describes how the INIT process should set up # the system in a certain run-level. # # Author: Miquel van Smoorenburg, # Modified for RHS Linux by Marc Ewing and Donnie Barnes # # 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:5:initdefault: # System initialization. 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

CIS Lesson 4 /etc/inittab Red Hat 9 – page 2 # Trap CTRL-ALT-DELETE ca::ctrlaltdel:/sbin/shutdown -t3 -r now # When our UPS tells us power has failed, assume we have a few minutes # of power left. Schedule a shutdown for 2 minutes from now. # This does, of course, assume you have powerd installed and your # UPS connected and working correctly. pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down" # If power was restored before the shutdown kicked in, cancel it. pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled" # Run gettys in standard runlevels 1:2345:respawn:/sbin/mingetty 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 # Run xdm in runlevel 5 x:5:respawn:/etc/X11/prefdm -nodaemon root]#

CIS Lesson 4 Red Hat 9 Starting Up GRUB boot code runs root]# cat /boot/grub/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,0) # kernel /vmlinuz-version ro root=/dev/sda2 # initrd /initrd-version.img #boot=/dev/sda default=0 timeout=10 splashimage=(hd0,0)/grub/splash.xpm.gz title Red Hat Linux ( ) root (hd0,0) kernel /vmlinuz ro root=LABEL=/ initrd /initrd img root]#

CIS Lesson 4 Red Hat 9 Starting Up GRUB boot code uncompresses kernel

CIS Lesson 4 Red Hat 9 Starting Up kernel starts up – screen capture and dmesg dmesg output (snipped) root]# dmesg Linux version (gcc version (Red Hat Linux )) #1 Thu Feb 27 10:06:59 EST 2003 BIOS-provided physical RAM map: BIOS-e820: f800 (usable) BIOS-e820: f a0000 (reserved) BIOS-e820: ca cc000 (reserved) BIOS-e820: dc e0000 (reserved) BIOS-e820: e (reserved) BIOS-e820: fef0000 (usable) BIOS-e820: fef feff000 (ACPI data) BIOS-e820: feff ff00000 (ACPI NVS) BIOS-e820: ff (usable) BIOS-e820: fec fec10000 (reserved) BIOS-e820: fee fee01000 (reserved) BIOS-e820: fffe (reserved)

CIS Lesson 4 Red Hat 9 Starting Up kernel starts up – screen capture and dmesg BIOS-e820: fffe (reserved) 0MB HIGHMEM available. 256MB LOWMEM available. On node 0 totalpages: zone(0): 4096 pages. zone(1): pages. zone(2): 0 pages. Kernel command line: ro root=LABEL=/ Initializing CPU#0 Detected MHz processor. Console: colour VGA+ 80x25 Calibrating delay loop BogoMIPS Memory: k/262144k available (1347k kernel code, 6812k reserved, 999k data, 132k init, 0k highmem) Dentry cache hash table entries: (order: 6, bytes) Inode cache hash table entries: (order: 5, bytes) Mount cache hash table entries: 512 (order: 0, 4096 bytes) Buffer-cache hash table entries: (order: 4, bytes) Page-cache hash table entries: (order: 6, bytes) Intel machine check architecture supported. Intel machine check reporting enabled on CPU#0. CPU: After generic, caps: 0febfbff CPU: Common caps: 0febfbff CPU: Intel(R) Core(TM)2 Duo CPU 2.50GHz stepping 06 Enabling fast FPU save and restore... done. Enabling unmasked SIMD FPU exception support... done. Checking 'hlt' instruction... OK.

CIS Lesson 4 Checking 'hlt' instruction... OK. POSIX conformance testing by UNIFIX mtrr: v1.40 ( ) Richard Gooch mtrr: detected mtrr type: Intel PCI: PCI BIOS revision 2.10 entry at 0xfd8a0, last bus=1 PCI: Using configuration type 1 PCI: Probing PCI hardware PCI: Using IRQ router PIIX [8086/7110] at 00:07.0 Limiting direct PCI/PCI transfers. isapnp: Scanning for PnP cards... Red Hat 9 Starting Up kernel starts up – dmesg

CIS Lesson 4 dmesg output (snipped) isapnp: Scanning for PnP cards... isapnp: No Plug & Play device found Linux NET4.0 for Linux 2.4 Based upon Swansea University Computer Society NET3.039 Initializing RT netlink socket apm: BIOS version 1.2 Flags 0x03 (Driver version 1.16) Starting kswapd VFS: Disk quotas vdquot_6.5.1 pty: 2048 Unix98 ptys configured Serial driver version 5.05c ( ) with MANY_PORTS MULTIPORT SHARE_IRQ SERIAL_PCI ISAPNP enabled ttyS0 at 0x03f8 (irq = 4) is a 16550A ttyS1 at 0x02f8 (irq = 3) is a 16550A Red Hat 9 Starting Up kernel starts up – screen capture and dmesg

CIS Lesson 4 Red Hat 9 Starting Up kernel starts up – screen capture and dmesg ttyS1 at 0x02f8 (irq = 3) is a 16550A Real Time Clock Driver v1.10e Floppy drive(s): fd0 is 1.44M FDC 0 is a post NET4: Frame Diverter 0.46 RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize Uniform Multi-Platform E-IDE driver Revision: 7.00beta-2.4 ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx PIIX4: IDE controller at PCI slot 00:07.1 PIIX4: chipset revision 1 PIIX4: not 100% native mode: will probe irqs later ide1: BM-DMA at 0x1408-0x140f, BIOS settings: hdc:DMA, hdd:pio hdc: VMware Virtual IDE CDROM Drive, ATAPI CD/DVD-ROM drive ide1 at 0x170-0x177,0x376 on irq 15 ide-floppy driver 0.99.newide md: md driver MAX_MD_DEVS=256, MD_SB_DISKS=27 md: Autodetecting RAID arrays. md: autorun... md:... autorun DONE. NET4: Linux TCP/IP 1.0 for NET4.0 IP Protocols: ICMP, UDP, TCP, IGMP IP: routing cache hash table of 2048 buckets, 16Kbytes TCP: Hash tables configured (established bind 32768) Linux IP multicast router 0.06 plus PIM-SM NET4: Unix domain sockets 1.0/SMP for Linux NET4.0. RAMDISK: Compressed image found at block 0 Freeing initrd memory: 248k freed

CIS Lesson 4 Red Hat 9 Starting Up kernel starts up – screen capture and dmesg dmesg output (snipped) Freeing initrd memory: 248k freed VFS: Mounted root (ext2 filesystem). SCSI subsystem driver Revision: 1.00 PCI: Found IRQ 11 for device 00:10.0 scsi: ***** BusLogic SCSI Driver Version of 17 August 1998 ***** scsi: Copyright by Leonard N. Zubkoff scsi0: Configuring BusLogic Model BT-958 PCI Wide Ultra SCSI Host Adapter scsi0: Firmware Version: 5.07B, I/O Address: 0x1060, IRQ Channel: 11/Level scsi0: PCI Bus: 0, Device: 16, Address: 0xE , Host Adapter SCSI ID: 7 scsi0: Parity Checking: Enabled, Extended Translation: Enabled scsi0: Synchronous Negotiation: Ultra, Wide Negotiation: Enabled scsi0: Disconnect/Reconnect: Enabled, Tagged Queuing: Enabled scsi0: Scatter/Gather Limit: 128 of 8192 segments, Mailboxes: 211 scsi0: Driver Queue Depth: 211, Host Adapter Queue Depth: 192 scsi0: Tagged Queue Depth: Automatic, Untagged Queue Depth: 3 scsi0: Error Recovery Strategy: Default, SCSI Bus Reset: Enabled scsi0: *** BusLogic BT-958 Initialized Successfully *** scsi0 : BusLogic BT-958 Vendor: VMware, Model: VMware Virtual S Rev: 1.0 Type: Direct-Access ANSI SCSI revision: 02 Vendor: VMware, Model: VMware Virtual S Rev: 1.0 Type: Direct-Access ANSI SCSI revision: 02 scsi0: Target 0: Queue Depth 28, Asynchronous scsi0: Target 1: Queue Depth 28, Asynchronous * * * * * - Not all screen messages are in dmesg output

CIS Lesson 4 dmesg output (snipped) Attached scsi disk sda at scsi0, channel 0, id 0, lun 0 Attached scsi disk sdb at scsi0, channel 0, id 1, lun 0 SCSI device sda: byte hdwr sectors (5369 MB) Partition check: sda: sda1 sda2 sda3 sda4 SCSI device sdb: byte hdwr sectors (2147 MB) sdb: unknown partition table Journalled Block Device driver loaded kjournald starting. Commit interval 5 seconds EXT3-fs: mounted filesystem with ordered data mode. Freeing unused kernel memory: 132k freed scsi0: Tagged Queuing now active for Target 0 Red Hat 9 Starting Up kernel finds and starts init program * * * * * * * - Not all screen messages are in dmesg output Init program starts File system mounted

CIS Lesson 4 Red Hat 9 Starting Up init program uses instructions in /etc/inittab Snippet from /etc/rc.d/rc.sysinit # Print a text banner. echo -en $"\t\tWelcome to " if LC_ALL=C grep -q "Red Hat" /etc/redhat-release ; then [ "$BOOTUP" = "color" ] && echo -en "\\033[0;31m" echo -en "Red Hat" [ "$BOOTUP" = "color" ] && echo -en "\\033[0;39m" PRODUCT=`sed "s/Red Hat \(.*\) release.*/\1/" /etc/redhat- release` echo " $PRODUCT" else PRODUCT=`sed "s/ release.*//g" /etc/redhat-release` echo "$PRODUCT" fi From /etc/inittab # System initialization. si::sysinit:/etc/rc.d/rc.sysinit init program starts /etc/rc.d/rc.sysinit init checks file system allows for interactive startup

CIS Lesson 4 Red Hat 9 Starting Up init runs – /etc/rc.d/rc.sysinit and /etc/rc.d/rc scripts /etc/rc.d/rc.sysinit /etc/rc.d/rc 5 Snippet from /etc/inittab l5:5:wait:/etc/rc.d/rc 5 From /etc/inittab # System initialization. si::sysinit:/etc/rc.d/rc.sysinit init checks file system allows for interactive startup

CIS Lesson 4 Red Hat 9 Starting Up init - starting /etc/rc.d/rc 5 Snippet from /etc/rc.d/rc: # See if we want to be in user confirmation mode if [ "$previous" = "N" ]; then if [ -f /var/run/confirm ] \ || grep -i confirm /proc/cmdline >/dev/null ; then rm -f /var/run/confirm CONFIRM=yes export CONFIRM echo $"Entering interactive startup" else echo $"Entering non-interactive startup" fi Snippet from /etc/inittab l5:5:wait:/etc/rc.d/rc 5 check disk quotas and enable swap space

CIS Lesson 4 root]# ls /etc/rc.d/rc5.d K05saslauthd S09isdn S20random S56xinetd S95atd K20nfs S10network S24pcmcia S80sendmail S97rhnsd K24irda S12syslog S25netfs S85gpm S99local K74ntpd S13portmap S26apmd S90crond K95firstboot S14nfslock S28autofs S90cups S05kudzu S17keytable S55sshd S90xfs S08iptables S19vmware-tools S56rawdevices S95anacron root]# S05 S08 S10 S12 S13 S14 Red Hat 9 Starting Up init – starting services in /etc/rc.d/rc 5 Snippet from /var/log/boot.log Note, no entries before system logging daemon started! Aug 13 12:20:58 rh9 syslog: syslogd startup succeeded Aug 13 12:20:58 rh9 syslog: klogd startup succeeded Aug 13 12:20:58 rh9 portmap: portmap startup succeeded Aug 13 12:20:58 rh9 nfslock: rpc.statd startup succeeded Snippet from /etc/inittab l5:5:wait:/etc/rc.d/rc 5

CIS Lesson 4 root]# ls /etc/rc.d/rc5.d K05saslauthd S09isdn S20random S56xinetd S95atd K20nfs S10network S24pcmcia S80sendmail S97rhnsd K24irda S12syslog S25netfs S85gpm S99local K74ntpd S13portmap S26apmd S90crond K95firstboot S14nfslock S28autofs S90cups S05kudzu S17keytable S55sshd S90xfs S08iptables S19vmware-tools S56rawdevices S95anacron root]# S05 S08 S10 S12 S13 S14 Red Hat 9 Starting Up init – starting services in /etc/rc.d/rc 5 Snippet from /etc/inittab l5:5:wait:/etc/rc.d/rc 5 Snippet from: /etc/rc.d/rc5.d/S10network action $"Setting network parameters: " sysctl -e -p /etc/sysctl.conf # bring up loopback interface action $"Bringing up loopback interface: "./ifup ifcfg-lo

CIS Lesson 4 Red Hat 9 Starting Up init – starting services in /etc/rc.d/rc 5 root]# ls /etc/rc.d/rc5.d K05saslauthd S09isdn S20random S56xinetd S95atd K20nfs S10network S24pcmcia S80sendmail S97rhnsd K24irda S12syslog S25netfs S85gpm S99local K74ntpd S13portmap S26apmd S90crond K95firstboot S14nfslock S28autofs S90cups S05kudzu S17keytable S55sshd S90xfs S08iptables S19vmware-tools S56rawdevices S95anacron root]# Snippet from /etc/inittab l5:5:wait:/etc/rc.d/rc 5 Snippet from /var/log/boot.log Aug 13 12:20:58 rh9 nfslock: rpc.statd startup succeeded Aug 13 12:20:58 rh9 keytable: Aug 13 12:20:58 rh9 keytable: Loading system font: Aug 13 12:20:58 rh9 keytable: Aug 13 12:20:58 rh9 rc: Starting keytable: succeeded Aug 13 12:20:58 rh9 ifup: iptables: No chain/target/match by that name Aug 13 12:20:58 rh9 network: Bringing up interface eth0: succeeded Aug 13 12:21:00 rh9 random: Initializing random number generator: succeeded Aug 13 12:21:00 rh9 rc: Starting pcmcia: succeeded Aug 13 12:21:01 rh9 netfs: Mounting other filesystems: succeeded Aug 13 12:21:01 rh9 apmd: apmd startup succeeded Aug 13 12:21:01 rh9 autofs: automount startup succeeded Aug 13 12:21:02 rh9 sshd: succeeded Aug 13 12:21:05 rh9 xinetd: xinetd startup succeeded Aug 13 12:21:06 rh9 sendmail: sendmail startup succeeded Aug 13 12:21:06 rh9 sendmail: sm-client startup succeeded Aug 13 12:21:06 rh9 gpm: gpm startup succeeded Aug 13 12:21:07 rh9 crond: crond startup succeeded Aug 13 12:21:09 rh9 cups: cupsd startup succeeded Aug 13 12:21:10 rh9 xfs: xfs startup succeeded Aug 13 12:21:10 rh9 anacron: anacron startup succeeded S14 S17 S95 S80 S26 S19 S90 S85 S20 S24 S25 S55

CIS Lesson 4 Red Hat 9 Starting Up init – starting services in /etc/rc.d/rc 5 Snippet from /etc/inittab l5:5:wait:/etc/rc.d/rc 5 # Run xdm in runlevel 5 x:5:respawn:/etc/X11/prefdm -nodaemon

CIS Lesson 4 root]# ls /etc/rc.d/rc6.d K03rhnsd K10cups K30sendmail K74ntpd K90network S00killall K05anacron K10xfs K44rawdevices K75netfs K91isdn S01reboot K05atd K15gpm K50xinetd K80random K92iptables K05keytable K20nfs K60crond K86nfslock K95firstboot K05saslauthd K24irda K72autofs K87portmap K95kudzu K08vmware-tools K25sshd K74apmd K88syslog K96pcmcia root]# Red Hat 9 Rebooting init – stopping services in /etc/rc.d/rc 6 K05 K10 K15 K92 K87 K88 K90 K80 K60 K50 K30 K25 K74 S00 Snippet from /etc/inittab l6:6:wait:/etc/rc.d/rc 6 S01

CIS Lesson 4 OpenSUSE inittab

CIS Lesson 4 /etc/inittab openSUSE 11 – Page 1 of 4 opensuse11:~ # cat /etc/inittab # # /etc/inittab # # Copyright (c) SuSE Linux AG, Nuernberg, Germany. All rights reserved. # # Author: Florian La Roche, 1996 # Please send feedback to # # This is the main configuration file of /sbin/init, which # is executed by the kernel on startup. It describes what # scripts are used for the different run-levels. # # All scripts for runlevel changes are in /etc/init.d/. # # This file may be modified by SuSEconfig unless CHECK_INITTAB # in /etc/sysconfig/suseconfig is set to "no" # # The default runlevel is defined here id:5:initdefault: # First script to be executed, if not booting in emergency (-b) mode si::bootwait:/etc/init.d/boot

CIS Lesson 4 /etc/inittab openSUSE 11 – Page 2 of 4 # /etc/init.d/rc takes care of runlevel handling # # runlevel 0 is System halt (Do not use this for initdefault!) # runlevel 1 is Single user mode # runlevel 2 is Local multiuser without remote network (e.g. NFS) # runlevel 3 is Full multiuser with network # runlevel 4 is Not used # runlevel 5 is Full multiuser with network and xdm # runlevel 6 is System reboot (Do not use this for initdefault!) # 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 in single-user mode ls:S:wait:/etc/init.d/rc S ~~:S:respawn:/sbin/sulogin # what to do when CTRL-ALT-DEL is pressed ca::ctrlaltdel:/sbin/shutdown -r -t 4 now

CIS Lesson 4 /etc/inittab openSUSE 11 – Page 3 of 4 # special keyboard request (Alt-UpArrow) # look into the kbd-0.90 docs for this kb::kbrequest:/bin/echo "Keyboard Request -- edit /etc/inittab to let this work." # what to do when power fails/returns pf::powerwait:/etc/init.d/powerfail start pn::powerfailnow:/etc/init.d/powerfail now #pn::powerfail:/etc/init.d/powerfail now po::powerokwait:/etc/init.d/powerfail stop # for ARGO UPS sh:12345:powerfail:/sbin/shutdown -h now THE POWER IS FAILING # getty-programs for the normal runlevels # : : : # The "id" field MUST be the same as the last # characters of the device (after "tty"). 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 # #S0:12345:respawn:/sbin/agetty -L 9600 ttyS0 vt102 #cons:12345:respawn:/sbin/smart_agetty -L console

CIS Lesson 4 /etc/inittab openSUSE 11 – Page 4 of 4 # # Note: Do not use tty7 in runlevel 3, this virtual line # is occupied by the programm xdm. # # This is for the package xdmsc, after installing and # and configuration you should remove the comment character # from the following line: #7:3:respawn:+/etc/init.d/rx tty7 # modem getty. # mo:235:respawn:/usr/sbin/mgetty -s modem # fax getty (hylafax) # mo:35:respawn:/usr/lib/fax/faxgetty /dev/modem # vbox (voice box) getty # I6:35:respawn:/usr/sbin/vboxgetty -d /dev/ttyI6 # I7:35:respawn:/usr/sbin/vboxgetty -d /dev/ttyI7 # end of /etc/inittab opensuse11:~ #

CIS Lesson 4 Shutting the System Down Sequence: Users log out Services halt Data is saved File systems are unmounted System powers off Example of shutdowns: init 0 – shuts down with no user notification init 6 – reboots with no user notification shutdown +5 Everyone off fast! – notifies users with custom message and shuts down to single user mode halt – stops everything so power switch can be turned off manually reboot – reboots the computers Ctrl-Alt-Del – shutdown behavior can be customized in /etc/inittab

CIS Lesson 4 Shutting the System Down

CIS Lesson 4 Canceling shutdown

CIS Lesson 4 Example shutdown

CIS Lesson 4 Example shutdown

CIS Lesson 4 Example shutdown

CIS Lesson 4 Example shutdown Now enter halt command

CIS Lesson 4 Example halt after shutdown Power switch can be turned off now manually

CIS Lesson 4 Science Experiment From runlevel 5, logged in as root haltshutdown +1 bye bye shutdown –h +1 bye bye poweroffinit 0 rh9broadcast services stopped no command line still powered broadcast services stopped single user mode manual poweroff to end broadcast services stopped powered off broadcast services stopped powered off no broadcast services stopped powered off openSUSE 11 broadcast splash-esc services stopped powered off broadcast TERM > PS'es Single user mode manual poweroff to end broadcast splash-esc services stopped powered off broadcast splash-esc services stopped powered off no broadcast splash-esc services stopped powered off FC9broadcast powered off broadcast single user mode manual poweroff to end broadcast powered off broadcast powered off no broadcast powered off Ubuntu 8.04 broadcast splash screen powered off broadcast stopping services recovery menu single user mode manual poweroff to end broadcast splash screen powered off broadcast splash screen powered off no broadcast splash screen powered off

CIS Lesson 4 New Commands and files

CIS Lesson 4 New commands: chkconfig- show and manage services (daemons) cntl-alt-del- can be configured for shutdown dmesg- shows kernel messages halt- shortcut to shutdown init- change runlevels reboot- shortcut to shutdown runlevel- show previous and current runlevel service- for starting and stopping services (daemons) shutdown- graceful system shutdown New Files and Directories: /etc/inittab- instructions for init program /etc/rc.d/- red hat runlevel directories /sbin/init- primordial init program /var/log/dmesg- kernel bootup messages (rh9, ubuntu) /var/log/boot.log- service startup and shutdown messages (rh9) /var/log/boot.msg- all bootup messages (openSUSE 11) VMware: tbd- tbd

CIS 191 – Lesson 4 Next Class Assignment: Check Calendar Page on web site to see what is due next week. Quiz questions for next class: On Red Hat systems, what command is used to manage services by runlevel (show and configure services to stop or start)? How can you view kernel startup messages? What does the line id:5:initdefault: do in /etc/inittab?

CIS 191 – Lesson 4 Backup

CIS Lesson 4 See this bug at Ubuntu 8.04 ubuntu bootlogd is broken – no /var/log/boot messages This work-around did not work

CIS Lesson 4 Red Hat 9 boot & root si::sysinit:/etc/rc.d/rc.sysinit