cis 191 - lesson 4 booting the system. cis 191 - lesson 4 booting the system 1.power on self test...

62
CIS 191 - Lesson 4 Booting the System

Upload: anissa-shelton

Post on 11-Jan-2016

233 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Booting theSystem

Page 2: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - 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.

Page 3: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Rooting theSystem

Page 4: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Rooting the System

1. Kernel mounts the root file system2. Kernel creates and starts the init process3. init reads /etc/inittab for its instructions4. 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 load7. getty processes are spawned on terminal devices

Page 5: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Init andrunlevels

Page 6: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - 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

Page 7: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

/etc/inittabRed Hat 9 – Page 1

[root@rh9 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, <[email protected]># 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 0l1:1:wait:/etc/rc.d/rc 1l2:2:wait:/etc/rc.d/rc 2l3:3:wait:/etc/rc.d/rc 3l4:4:wait:/etc/rc.d/rc 4l5:5:wait:/etc/rc.d/rc 5l6:6:wait:/etc/rc.d/rc 6

Page 8: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

/etc/inittabRed Hat 9 – Page 1

[root@rh9 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, <[email protected]># 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 0l1:1:wait:/etc/rc.d/rc 1l2:2:wait:/etc/rc.d/rc 2l3:3:wait:/etc/rc.d/rc 3l4:4:wait:/etc/rc.d/rc 4l5:5:wait:/etc/rc.d/rc 5l6: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

Page 9: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

/etc/inittabRed Hat 9 – Page 1

[root@rh9 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, <[email protected]># 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 0l1:1:wait:/etc/rc.d/rc 1l2:2:wait:/etc/rc.d/rc 2l3:3:wait:/etc/rc.d/rc 3l4:4:wait:/etc/rc.d/rc 4l5:5:wait:/etc/rc.d/rc 5l6: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)

Page 10: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

/etc/inittabRed Hat 9 – Page 1

[root@rh9 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, <[email protected]># 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 0l1:1:wait:/etc/rc.d/rc 1l2:2:wait:/etc/rc.d/rc 2l3:3:wait:/etc/rc.d/rc 3l4:4:wait:/etc/rc.d/rc 4l5:5:wait:/etc/rc.d/rc 5l6: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

Page 11: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

/etc/inittabRed Hat 9 – Page 1

[root@rh9 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, <[email protected]># 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 0l1:1:wait:/etc/rc.d/rc 1l2:2:wait:/etc/rc.d/rc 2l3:3:wait:/etc/rc.d/rc 3l4:4:wait:/etc/rc.d/rc 4l5:5:wait:/etc/rc.d/rc 5l6: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

Page 12: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

/etc/inittabRed Hat 9 – Page 1

[root@rh9 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, <[email protected]># 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 0l1:1:wait:/etc/rc.d/rc 1l2:2:wait:/etc/rc.d/rc 2l3:3:wait:/etc/rc.d/rc 3l4:4:wait:/etc/rc.d/rc 4l5:5:wait:/etc/rc.d/rc 5l6: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)

Page 13: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

/etc/inittabRed Hat 9 – page 2

# Trap CTRL-ALT-DELETEca::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 runlevels1:2345:respawn:/sbin/mingetty tty12:2345:respawn:/sbin/mingetty tty23:2345:respawn:/sbin/mingetty tty34:2345:respawn:/sbin/mingetty tty45:2345:respawn:/sbin/mingetty tty56:2345:respawn:/sbin/mingetty tty6

# Run xdm in runlevel 5x:5:respawn:/etc/X11/prefdm -nodaemon[root@rh9 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

Page 14: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

/etc/inittabpassword protection in single user mode

During GRUB boot, edit the kernel line and add "single" to boot into single user mode

Withouts0:S:wait:/sbin/sulogin

in/etc/inittab

Logged in as root without entering a password

Withs0:S:wait:/sbin/sulogin

in/etc/inittab

Must enter password to be logged in as root

Page 15: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

runlevel commandshow previous and current runlevels

[root@rh9 root]# runlevelN 5[root@rh9 root]#

Previous runlevel (N=None)

Current runlevel

Page 16: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Important log filesdmesg command or /var/log/dmesg

• var/log/dmesg – kernel boot messages[root@rh9 root]# dmesg | moreLinux version 2.4.20-6 ([email protected]) (gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)) #1 Thu Feb 27 10:06:59 EST 2003BIOS-provided physical RAM map: BIOS-e820: 0000000000000000 - 000000000009f800 (usable) BIOS-e820: 000000000009f800 - 00000000000a0000 (reserved) BIOS-e820: 00000000000ca000 - 00000000000cc000 (reserved) BIOS-e820: 00000000000dc000 - 00000000000e0000 (reserved) BIOS-e820: 00000000000e4000 - 0000000000100000 (reserved) BIOS-e820: 0000000000100000 - 000000000fef0000 (usable) BIOS-e820: 000000000fef0000 - 000000000feff000 (ACPI data) BIOS-e820: 000000000feff000 - 000000000ff00000 (ACPI NVS) BIOS-e820: 000000000ff00000 - 0000000010000000 (usable) BIOS-e820: 00000000fec00000 - 00000000fec10000 (reserved) BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved) BIOS-e820: 00000000fffe0000 - 0000000100000000 (reserved)0MB HIGHMEM available.256MB LOWMEM available.On node 0 totalpages: 65536zone(0): 4096 pages.zone(1): 61440 pages.zone(2): 0 pages.Kernel command line: ro root=LABEL=/< snipped >

Page 17: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Important log files/var/log/boot.log

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

Page 18: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Red Hat Runlevels - /etc/rc.d/[root@rh9 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 ypbindapmd crond functions iptables kdcrotate kudzu nfs ntpd random saslauthd sshd xfsatd cups gpm irda keytable netfs nfslock pcmcia rawdevices sendmail syslog xinetd

./rc0.d:K03rhnsd K05keytable K10cups K20nfs K30sendmail K60crond K74ntpd K86nfslock K90network K95firstboot S00killallK05anacron K05saslauthd K10xfs K24irda K44rawdevices K72autofs K75netfs K87portmap K91isdn K95kudzu S01haltK05atd K08vmware-tools K15gpm K25sshd K50xinetd K74apmd K80random K88syslog K92iptables K96pcmcia

./rc1.d:K03rhnsd K05saslauthd K10xfs K24irda K44rawdevices K72autofs K75netfs K87portmap K91isdn K95kudzu S17keytableK05anacron K08vmware-tools K15gpm K25sshd K50xinetd K74apmd K80random K88syslog K92iptables K96pcmciaK05atd K10cups K20nfs K30sendmail K60crond K74ntpd K86nfslock K90network K95firstboot S00single

./rc2.d:K03rhnsd K20nfs K50xinetd K75netfs K95firstboot S09isdn S17keytable S24pcmcia S80sendmail S90cups S99localK05atd K24irda K72autofs K86nfslock K95kudzu S10network S19vmware-tools S26apmd S85gpm S90xfsK05saslauthd K44rawdevices K74ntpd K87portmap S08iptables S12syslog S20random S55sshd S90crond S95anacron

./rc3.d:K05saslauthd K74ntpd S08iptables S12syslog S17keytable S24pcmcia S28autofs S56xinetd S90crond S95anacron S99localK20nfs K95firstboot S09isdn S13portmap S19vmware-tools S25netfs S55sshd S80sendmail S90cups S95atdK24irda S05kudzu S10network S14nfslock S20random S26apmd S56rawdevices S85gpm S90xfs S97rhnsd

./rc4.d:K05saslauthd K24irda S05kudzu S10network S14nfslock S24pcmcia S28autofs S56xinetd S90crond S95anacron S99localK08vmware-tools K74ntpd S08iptables S12syslog S17keytable S25netfs S55sshd S80sendmail S90cups S95atdK20nfs K95firstboot S09isdn S13portmap S20random S26apmd S56rawdevices S85gpm S90xfs S97rhnsd

./rc5.d:K05saslauthd K74ntpd S08iptables S12syslog S17keytable S24pcmcia S28autofs S56xinetd S90crond S95anacron S99localK20nfs K95firstboot S09isdn S13portmap S19vmware-tools S25netfs S55sshd S80sendmail S90cups S95atdK24irda S05kudzu S10network S14nfslock S20random S26apmd S56rawdevices S85gpm S90xfs S97rhnsd

./rc6.d:K03rhnsd K05keytable K10cups K20nfs K30sendmail K60crond K74ntpd K86nfslock K90network K95firstboot S00killallK05anacron K05saslauthd K10xfs K24irda K44rawdevices K72autofs K75netfs K87portmap K91isdn K95kudzu S01rebootK05atd K08vmware-tools K15gpm K25sshd K50xinetd K74apmd K80random K88syslog K92iptables K96pcmcia[root@rh9 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 0l1:1:wait:/etc/rc.d/rc 1l2:2:wait:/etc/rc.d/rc 2l3:3:wait:/etc/rc.d/rc 3l4:4:wait:/etc/rc.d/rc 4l5:5:wait:/etc/rc.d/rc 5l6:6:wait:/etc/rc.d/rc 6

Page 19: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - 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/

Page 20: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - 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

Page 21: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

init commandChange runlevels now

Page 22: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

show and customize runlevelsservice and chkconfig commands

[root@rh9 root]# service cups stopStopping cups: [ OK ][root@rh9 root]# service cups startStarting cups: [ OK ][root@rh9 root]# service cups restartStopping cups: [ OK ]Starting cups: [ OK ][root@rh9 root]# service cups statuscupsd (pid 1774) is running...[root@rh9 root]#

[root@rh9 rc.d]# chkconfig --list cupscups 0:off 1:off 2:on 3:on 4:on 5:on 6:off[root@rh9 rc.d]# chkconfig --level 3 cups off[root@rh9 rc.d]# chkconfig --list cupscups 0:off 1:off 2:on 3:off 4:on 5:on 6:off[root@rh9 rc.d]# chkconfig --level 3 cups on[root@rh9 rc.d]# chkconfig --list cupscups 0:off 1:off 2:on 3:on 4:on 5:on 6:off[root@rh9 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)

Page 23: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

chkconfig commandcustomize runlevels

[root@rh9 rc.d]# ls rc3.dK05saslauthd S08iptables S17keytable S28autofs S90crond S99localK20nfs S09isdn S19vmware-tools S55sshd S90cupsK24irda S10network S20random S56rawdevices S90xfsK74ntpd S12syslog S24pcmcia S56xinetd S95anacronK95firstboot S13portmap S25netfs S80sendmail S95atdS05kudzu S14nfslock S26apmd S85gpm S97rhnsd[root@rh9 rc.d]# chkconfig --level 3 cups off[root@rh9 rc.d]# ls rc3.dK05saslauthd S05kudzu S14nfslock S26apmd S85gpm S99localK10cups S08iptables S17keytable S28autofs S90crondK20nfs S09isdn S19vmware-tools S55sshd S90xfsK24irda S10network S20random S56rawdevices S95anacronK74ntpd S12syslog S24pcmcia S56xinetd S95atdK95firstboot S13portmap S25netfs S80sendmail S97rhnsd[root@rh9 rc.d]# chkconfig --level 3 cups on[root@rh9 rc.d]# ls rc3.dK05saslauthd S08iptables S17keytable S28autofs S90crond S99localK20nfs S09isdn S19vmware-tools S55sshd S90cupsK24irda S10network S20random S56rawdevices S90xfsK74ntpd S12syslog S24pcmcia S56xinetd S95anacronK95firstboot S13portmap S25netfs S80sendmail S95atdS05kudzu S14nfslock S26apmd S85gpm S97rhnsd[root@rh9 rc.d]#

Page 24: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

chkconfig commandshow all services and runlevels

[root@rh9 rc.d]# chkconfig --listvmware-tools 0:off 1:off 2:on 3:on 4:off 5:on 6:offkudzu 0:off 1:off 2:off 3:on 4:on 5:on 6:offsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:offnetfs 0:off 1:off 2:off 3:on 4:on 5:on 6:offnetwork 0:off 1:off 2:on 3:on 4:on 5:on 6:offrandom 0:off 1:off 2:on 3:on 4:on 5:on 6:offrawdevices 0:off 1:off 2:off 3:on 4:on 5:on 6:offpcmcia 0:off 1:off 2:on 3:on 4:on 5:on 6:offsaslauthd 0:off 1:off 2:off 3:off 4:off 5:off 6:offkeytable 0:off 1:on 2:on 3:on 4:on 5:on 6:offapmd 0:off 1:off 2:on 3:on 4:on 5:on 6:offatd 0:off 1:off 2:off 3:on 4:on 5:on 6:offgpm 0:off 1:off 2:on 3:on 4:on 5:on 6:offautofs 0:off 1:off 2:off 3:on 4:on 5:on 6:offiptables 0:off 1:off 2:on 3:on 4:on 5:on 6:offirda 0:off 1:off 2:off 3:off 4:off 5:off 6:offisdn 0:off 1:off 2:on 3:on 4:on 5:on 6:offsshd 0:off 1:off 2:on 3:on 4:on 5:on 6:offportmap 0:off 1:off 2:off 3:on 4:on 5:on 6:offnfs 0:off 1:off 2:off 3:off 4:off 5:off 6:offnfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:offsendmail 0:off 1:off 2:on 3:on 4:on 5:on 6:offrhnsd 0:off 1:off 2:off 3:on 4:on 5:on 6:offcrond 0:off 1:off 2:on 3:on 4:on 5:on 6:offanacron 0:off 1:off 2:on 3:on 4:on 5:on 6:offxfs 0:off 1:off 2:on 3:on 4:on 5:on 6:offxinetd 0:off 1:off 2:off 3:on 4:on 5:on 6:offcups 0:off 1:off 2:on 3:on 4:on 5:on 6:offntpd 0:off 1:off 2:off 3:off 4:off 5:off 6:offfirstboot 0:off 1:off 2:off 3:off 4:off 5:off 6:off< snipped >

Page 25: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - 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 34. Change from run level 5 to runlevel 25. Check cups service (hint: service cups status)6. Change from 2 to 37. Check cups service8. 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

Page 26: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Shutting downthe system

Page 27: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - 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

Page 28: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

shutdown commandSchedule for a time in the future

Page 29: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

shutdown commandCancelling a pending shutdown

Page 30: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

halt commandshortcut to shutdown

Page 31: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Startup and Shutdownwalk-through

Page 32: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

/etc/inittabRed Hat 9 – Page 1

[root@rh9 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, <[email protected]># 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 0l1:1:wait:/etc/rc.d/rc 1l2:2:wait:/etc/rc.d/rc 2l3:3:wait:/etc/rc.d/rc 3l4:4:wait:/etc/rc.d/rc 4l5:5:wait:/etc/rc.d/rc 5l6:6:wait:/etc/rc.d/rc 6

Page 33: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

/etc/inittabRed Hat 9 – page 2

# Trap CTRL-ALT-DELETEca::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 runlevels1:2345:respawn:/sbin/mingetty tty12:2345:respawn:/sbin/mingetty tty23:2345:respawn:/sbin/mingetty tty34:2345:respawn:/sbin/mingetty tty45:2345:respawn:/sbin/mingetty tty56:2345:respawn:/sbin/mingetty tty6

# Run xdm in runlevel 5x:5:respawn:/etc/X11/prefdm -nodaemon[root@rh9 root]#

Page 34: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Red Hat 9 Starting UpGRUB boot code runs

[root@rh9 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/sdadefault=0timeout=10splashimage=(hd0,0)/grub/splash.xpm.gztitle Red Hat Linux (2.4.20-6) root (hd0,0) kernel /vmlinuz-2.4.20-6 ro root=LABEL=/ initrd /initrd-2.4.20-6.img[root@rh9 root]#

Page 35: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Red Hat 9 Starting UpGRUB boot code uncompresses kernel

Page 36: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Red Hat 9 Starting Upkernel starts up – screen capture and dmesg

dmesg output (snipped)

[root@rh9 root]# dmesgLinux version 2.4.20-6 ([email protected]) (gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)) #1 Thu Feb 27 10:06:59 EST 2003BIOS-provided physical RAM map: BIOS-e820: 0000000000000000 - 000000000009f800 (usable) BIOS-e820: 000000000009f800 - 00000000000a0000 (reserved) BIOS-e820: 00000000000ca000 - 00000000000cc000 (reserved) BIOS-e820: 00000000000dc000 - 00000000000e0000 (reserved) BIOS-e820: 00000000000e4000 - 0000000000100000 (reserved) BIOS-e820: 0000000000100000 - 000000000fef0000 (usable) BIOS-e820: 000000000fef0000 - 000000000feff000 (ACPI data) BIOS-e820: 000000000feff000 - 000000000ff00000 (ACPI NVS) BIOS-e820: 000000000ff00000 - 0000000010000000 (usable) BIOS-e820: 00000000fec00000 - 00000000fec10000 (reserved) BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved) BIOS-e820: 00000000fffe0000 - 0000000100000000 (reserved)

Page 37: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Red Hat 9 Starting Upkernel starts up – screen capture and dmesg

BIOS-e820: 00000000fffe0000 - 0000000100000000 (reserved)0MB HIGHMEM available.256MB LOWMEM available.On node 0 totalpages: 65536zone(0): 4096 pages.zone(1): 61440 pages.zone(2): 0 pages.Kernel command line: ro root=LABEL=/Initializing CPU#0Detected 2501.843 MHz processor.Console: colour VGA+ 80x25Calibrating delay loop... 5006.95 BogoMIPSMemory: 252832k/262144k available (1347k kernel code, 6812k reserved, 999k data, 132k init, 0k highmem)Dentry cache hash table entries: 32768 (order: 6, 262144 bytes)Inode cache hash table entries: 16384 (order: 5, 131072 bytes)Mount cache hash table entries: 512 (order: 0, 4096 bytes)Buffer-cache hash table entries: 16384 (order: 4, 65536 bytes)Page-cache hash table entries: 65536 (order: 6, 262144 bytes)Intel machine check architecture supported.Intel machine check reporting enabled on CPU#0.CPU: After generic, caps: 0febfbff 00100000 00000000 00000000CPU: Common caps: 0febfbff 00100000 00000000 00000000CPU: Intel(R) Core(TM)2 Duo CPU T9300 @ 2.50GHz stepping 06Enabling fast FPU save and restore... done.Enabling unmasked SIMD FPU exception support... done.Checking 'hlt' instruction... OK.

Page 38: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Checking 'hlt' instruction... OK.POSIX conformance testing by UNIFIXmtrr: v1.40 (20010327) Richard Gooch ([email protected])mtrr: detected mtrr type: IntelPCI: PCI BIOS revision 2.10 entry at 0xfd8a0, last bus=1PCI: Using configuration type 1PCI: Probing PCI hardwarePCI: Using IRQ router PIIX [8086/7110] at 00:07.0Limiting direct PCI/PCI transfers.isapnp: Scanning for PnP cards...

Red Hat 9 Starting Upkernel starts up – dmesg

Page 39: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

dmesg output (snipped)

isapnp: Scanning for PnP cards...isapnp: No Plug & Play device foundLinux NET4.0 for Linux 2.4Based upon Swansea University Computer Society NET3.039Initializing RT netlink socketapm: BIOS version 1.2 Flags 0x03 (Driver version 1.16)Starting kswapdVFS: Disk quotas vdquot_6.5.1pty: 2048 Unix98 ptys configuredSerial driver version 5.05c (2001-07-08) with MANY_PORTS MULTIPORT SHARE_IRQ SERIAL_PCI ISAPNP enabledttyS0 at 0x03f8 (irq = 4) is a 16550AttyS1 at 0x02f8 (irq = 3) is a 16550A

Red Hat 9 Starting Upkernel starts up – screen capture and dmesg

Page 40: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Red Hat 9 Starting Upkernel starts up – screen capture and dmesg

ttyS1 at 0x02f8 (irq = 3) is a 16550AReal Time Clock Driver v1.10eFloppy drive(s): fd0 is 1.44MFDC 0 is a post-1991 82077NET4: Frame Diverter 0.46RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksizeUniform Multi-Platform E-IDE driver Revision: 7.00beta-2.4ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xxPIIX4: IDE controller at PCI slot 00:07.1PIIX4: chipset revision 1PIIX4: not 100% native mode: will probe irqs later ide1: BM-DMA at 0x1408-0x140f, BIOS settings: hdc:DMA, hdd:piohdc: VMware Virtual IDE CDROM Drive, ATAPI CD/DVD-ROM driveide1 at 0x170-0x177,0x376 on irq 15ide-floppy driver 0.99.newideide-floppy driver 0.99.newidemd: md driver 0.90.0 MAX_MD_DEVS=256, MD_SB_DISKS=27md: Autodetecting RAID arrays.md: autorun ...md: ... autorun DONE.NET4: Linux TCP/IP 1.0 for NET4.0IP Protocols: ICMP, UDP, TCP, IGMPIP: routing cache hash table of 2048 buckets, 16KbytesTCP: Hash tables configured (established 16384 bind 32768)Linux IP multicast router 0.06 plus PIM-SMNET4: Unix domain sockets 1.0/SMP for Linux NET4.0.RAMDISK: Compressed image found at block 0Freeing initrd memory: 248k freed

Page 41: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Red Hat 9 Starting Upkernel starts up – screen capture and dmesg

dmesg output (snipped)

Freeing initrd memory: 248k freedVFS: Mounted root (ext2 filesystem).SCSI subsystem driver Revision: 1.00PCI: Found IRQ 11 for device 00:10.0scsi: ***** BusLogic SCSI Driver Version 2.1.15 of 17 August 1998 *****scsi: Copyright 1995-1998 by Leonard N. Zubkoff <[email protected]>scsi0: Configuring BusLogic Model BT-958 PCI Wide Ultra SCSI Host Adapterscsi0: Firmware Version: 5.07B, I/O Address: 0x1060, IRQ Channel: 11/Levelscsi0: PCI Bus: 0, Device: 16, Address: 0xE8800000, Host Adapter SCSI ID: 7scsi0: Parity Checking: Enabled, Extended Translation: Enabledscsi0: Synchronous Negotiation: Ultra, Wide Negotiation: Enabledscsi0: Disconnect/Reconnect: Enabled, Tagged Queuing: Enabledscsi0: Scatter/Gather Limit: 128 of 8192 segments, Mailboxes: 211scsi0: Driver Queue Depth: 211, Host Adapter Queue Depth: 192scsi0: Tagged Queue Depth: Automatic, Untagged Queue Depth: 3scsi0: Error Recovery Strategy: Default, SCSI Bus Reset: Enabledscsi0: *** 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: 02scsi0: Target 0: Queue Depth 28, Asynchronousscsi0: Target 1: Queue Depth 28, Asynchronous

****

* - Not all screen messages are in dmesg output

Page 42: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

dmesg output (snipped)

Attached scsi disk sda at scsi0, channel 0, id 0, lun 0Attached scsi disk sdb at scsi0, channel 0, id 1, lun 0SCSI device sda: 10485760 512-byte hdwr sectors (5369 MB)Partition check: sda: sda1 sda2 sda3 sda4 < sda5 >SCSI device sdb: 4194304 512-byte hdwr sectors (2147 MB) sdb: unknown partition tableJournalled Block Device driver loadedkjournald starting. Commit interval 5 secondsEXT3-fs: mounted filesystem with ordered data mode.Freeing unused kernel memory: 132k freedscsi0: Tagged Queuing now active for Target 0

Red Hat 9 Starting Upkernel finds and starts init program

****

*

*

* - Not all screen messages are in dmesg output

Init program starts

File system mounted

Page 43: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Red Hat 9 Starting Upinit 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

Page 44: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Red Hat 9 Starting Upinit 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

Page 45: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Red Hat 9 Starting Upinit - starting /etc/rc.d/rc 5

Snippet from /etc/rc.d/rc:

# See if we want to be in user confirmation modeif [ "$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" fifi

Snippet from /etc/inittab

l5:5:wait:/etc/rc.d/rc 5

check disk quotas and enable swap space

Page 46: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

[root@rh9 root]# ls /etc/rc.d/rc5.dK05saslauthd S09isdn S20random S56xinetd S95atdK20nfs S10network S24pcmcia S80sendmail S97rhnsdK24irda S12syslog S25netfs S85gpm S99localK74ntpd S13portmap S26apmd S90crondK95firstboot S14nfslock S28autofs S90cupsS05kudzu S17keytable S55sshd S90xfsS08iptables S19vmware-tools S56rawdevices S95anacron[root@rh9 root]#

S05

S08S08S08

S10S10S12

S13S14

Red Hat 9 Starting Upinit – starting services in /etc/rc.d/rc 5

Snippet from /var/log/boot.logNote, no entries before system logging daemon started!

Aug 13 12:20:58 rh9 syslog: syslogd startup succeededAug 13 12:20:58 rh9 syslog: klogd startup succeededAug 13 12:20:58 rh9 portmap: portmap startup succeededAug 13 12:20:58 rh9 nfslock: rpc.statd startup succeeded

Snippet from /etc/inittab

l5:5:wait:/etc/rc.d/rc 5

Page 47: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

[root@rh9 root]# ls /etc/rc.d/rc5.dK05saslauthd S09isdn S20random S56xinetd S95atdK20nfs S10network S24pcmcia S80sendmail S97rhnsdK24irda S12syslog S25netfs S85gpm S99localK74ntpd S13portmap S26apmd S90crondK95firstboot S14nfslock S28autofs S90cupsS05kudzu S17keytable S55sshd S90xfsS08iptables S19vmware-tools S56rawdevices S95anacron[root@rh9 root]#

S05

S08S08S08

S10S10S12

S13S14

Red Hat 9 Starting Upinit – 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 interfaceaction $"Bringing up loopback interface: " ./ifup ifcfg-lo

Page 48: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Red Hat 9 Starting Upinit – starting services in /etc/rc.d/rc 5

[root@rh9 root]# ls /etc/rc.d/rc5.dK05saslauthd S09isdn S20random S56xinetd S95atdK20nfs S10network S24pcmcia S80sendmail S97rhnsdK24irda S12syslog S25netfs S85gpm S99localK74ntpd S13portmap S26apmd S90crondK95firstboot S14nfslock S28autofs S90cupsS05kudzu S17keytable S55sshd S90xfsS08iptables S19vmware-tools S56rawdevices S95anacron[root@rh9 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 succeededAug 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: succeededAug 13 12:20:58 rh9 ifup: iptables: No chain/target/match by that nameAug 13 12:20:58 rh9 network: Bringing up interface eth0: succeededAug 13 12:21:00 rh9 random: Initializing random number generator: succeededAug 13 12:21:00 rh9 rc: Starting pcmcia: succeededAug 13 12:21:01 rh9 netfs: Mounting other filesystems: succeededAug 13 12:21:01 rh9 apmd: apmd startup succeededAug 13 12:21:01 rh9 autofs: automount startup succeededAug 13 12:21:02 rh9 sshd: succeededAug 13 12:21:05 rh9 xinetd: xinetd startup succeededAug 13 12:21:06 rh9 sendmail: sendmail startup succeededAug 13 12:21:06 rh9 sendmail: sm-client startup succeededAug 13 12:21:06 rh9 gpm: gpm startup succeededAug 13 12:21:07 rh9 crond: crond startup succeededAug 13 12:21:09 rh9 cups: cupsd startup succeededAug 13 12:21:10 rh9 xfs: xfs startup succeededAug 13 12:21:10 rh9 anacron: anacron startup succeeded

S14S17

S95

S80

S26

S19

S90

S85

S20S24S25

S55

Page 49: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Red Hat 9 Starting Upinit – starting services in /etc/rc.d/rc 5

Snippet from /etc/inittab

l5:5:wait:/etc/rc.d/rc 5

# Run xdm in runlevel 5x:5:respawn:/etc/X11/prefdm -nodaemon

Page 50: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

[root@rh9 root]# ls /etc/rc.d/rc6.dK03rhnsd K10cups K30sendmail K74ntpd K90network S00killallK05anacron K10xfs K44rawdevices K75netfs K91isdn S01rebootK05atd K15gpm K50xinetd K80random K92iptablesK05keytable K20nfs K60crond K86nfslock K95firstbootK05saslauthd K24irda K72autofs K87portmap K95kudzuK08vmware-tools K25sshd K74apmd K88syslog K96pcmcia[root@rh9 root]#

Red Hat 9 Rebootinginit – stopping services in /etc/rc.d/rc 6

K05K05K10K10K15

K92

K87K88K88K90K90

K80

K60K50

K30K25

K74

S00

Snippet from /etc/inittab

l6:6:wait:/etc/rc.d/rc 6

S01

Page 51: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Shutting the System DownSequence:

• 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

Page 52: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Shutting the System Down

Page 53: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Canceling shutdown

Page 54: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Example shutdown

Page 55: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Example shutdown

Page 56: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Example shutdown

Page 57: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Example shutdown

Now enter halt command

Page 58: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Example halt after shutdown

Power switch can be turned off now manually

Page 59: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Science ExperimentFrom runlevel 5, logged in as roothalt shutdown +1 bye

byeshutdown –h +1 bye bye

poweroff init 0

rh9 broadcastservices stoppedno command linestill powered

broadcastservices stoppedsingle user modemanual poweroff to end

broadcastservices stoppedpowered off

broadcastservices stoppedpowered off

no broadcastservices stoppedpowered off

openSUSE 11

broadcastsplash-escservices stoppedpowered off

broadcastTERM > PS'esSingle user modemanual poweroff to end

broadcastsplash-escservices stoppedpowered off

broadcastsplash-escservices stoppedpowered off

no broadcastsplash-escservices stoppedpowered off

FC9 broadcastpowered off

broadcastsingle user modemanual poweroff to end

broadcastpowered off

broadcastpowered off

no broadcastpowered off

Ubuntu 8.04

broadcastsplash screenpowered off

broadcaststopping servicesrecovery menusingle user modemanual poweroff to end

broadcastsplash screenpowered off

broadcastsplash screenpowered off

no broadcastsplash screenpowered off

Page 60: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

New Commands

and files

Page 61: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

New commands:chkconfig - show and manage services (daemons)cntl-alt-del - can be configured for shutdowndmesg - shows kernel messageshalt - shortcut to shutdowninit - change runlevelsreboot - shortcut to shutdownrunlevel - show previous and current runlevelservice - 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

Page 62: CIS 191 - Lesson 4 Booting the System. CIS 191 - Lesson 4 Booting the System 1.Power On Self Test (POST) – loads the BIOS. 2.BIOS loads the Master Boot

CIS 191 - Lesson 4

Red Hat 9 boot & rootsi::sysinit:/etc/rc.d/rc.sysinit