User:Klae0010: Difference between revisions

From ITCwiki
Jump to navigation Jump to search
(Created page with "'''Chpt 5 Study Guide''' == Boot Process == ''System power > CPU looks for BIOS > CPU Runs Bios'' ::BIOS checks for new hardware, configure hardware, and looks for boot secto...")
 
No edit summary
Line 22: Line 22:
: Look for hardware type names
: Look for hardware type names
: Look for hardware chipset names
: Look for hardware chipset names
Study output from a working system  
: Study output from a working system  




Line 30: Line 30:


=== Two main boot loaders for Linux ===
=== Two main boot loaders for Linux ===
: '''LILO'''  ''(Linux Loader)''
==== '''LILO'''  ''(Linux Loader)'' ====
:: Once the default boot loader.
:: ''Once the default boot loader.''
:: Slowly being overtaken by GRUB.  
:: ''Slowly being overtaken by GRUB.''
:: Small, and useful.  
:: ''Small, and useful.''


 
:: ''Can be configured using the '''/etc/lilo.conf''' file.''
 
:: Which is broken into two main sections :
: '''GRUB'''  ''(Grand Unified Boot Loader)''
:: Has taken over as default boot loader for many LINUX distributions
:: Offers more configurations than LILO
 
 
==  LILO ==
Can be configured using the /etc/lilo.conf file.
This file is broken into two main sections :
===  Global options : ===
:: '''Global options'''  
   
::: Boot loader location
: Boot loader location
::: Default stanza
: Default stanza
::: Boot prompt  
: Boot prompt  
::: Boot timeout
: Boot timeout
:: '''Per-Image'''
::: Kept in sections known  as ''stanzas''.
::: ''Can also be further separated depending on if they’re for a kernel or OS.''
::: Linux Boot Image
::: Non-Linux Boot Partition
::: OS Label
::: RAM Disk


=== Per-Image : ===
: Kept in sections known  as stanzas.
:: Can also be further seperated depending on if they’re for a kernel or OS.
:
Some Per-Image Options include  :
: Linux Boot Image
: Non-Linux Boot Partition
: OS Label
: RAM Disk


== GRUB ==
==== '''GRUB'''  ''(Grand Unified Boot Loader)'' ====
: GRUB has some ‘quirks’
:: ''Has taken over as default boot loader for many LINUX distributions''
:: Unlike Linux, GRUB numbers drives.  
:: ''Offers more configurations than LILO''
:: Instead of /dev/hda .. It would be /dev/hd0  
::: GRUB has some ‘quirks’
:::: Unlike Linux, GRUB numbers drives.  
::: Instead of '''/dev/hda''' .. It would be '''/dev/hd0'''
::: Doesn’t distinguish between PATA, SATA, or SCSI drives.
::: Doesn’t distinguish between PATA, SATA, or SCSI drives.
:: GRUB also numbers partitions on a drive starting with 0, instead of 1
::: GRUB also numbers partitions on a drive starting with '''0''', instead of '''1'''
::: So partition 1 on drive 1 would look like this (hd0,0)
:::: So partition 1 on drive 1 would look like this '''(hd0,0)'''
::: Floppy devices are referred to as (fd0)
:::: Floppy devices are referred to as '''(fd0)'''


: GLOBAL OPTIONS
:: '''Global Options'''
: Default OS
::: Default OS
: Timeout
::: Timeout
: Background Graphic
::: Background Graphic
: Per-Image Options
:: '''Per Image Options'''
: Title
::: Title
: GRUB root
::: GRUB root
: Kernel Specification  
::: Kernel Specification  


== Runlevels And Initialization Process ==
== Runlevels And Initialization Process ==
Linux relies on runlevels to determine which features are available.  
: Linux relies on runlevels to determine which features are available.  
Run levels are labels 0 thru 6. Each one being assigned to a set of services that should be active.  
: Run levels are labels 0 thru 6. Each one being assigned to a set of services that should be active.  
Understanding the purpose of runlevels makes for identifying services that are active easier.  
: Understanding the purpose of runlevels makes for identifying services that are active easier.  




== Checking runlevel ==
=== Checking runlevel ===
Generally done prior to changing or to check status if something isn’t working
: Generally done prior to changing or to check status if something isn’t working
This is done by inspecting the /etc/initab file with the less command or opening it in an editor.
: This is done by inspecting the '''/etc/initab''' file with the ''less'' command or opening it in an editor.


== Managing Runlevels ==
=== Managing Runlevels ===
Chkconfig  
: '''Chkconfig'''
Lists the services and their runlevels.
:: Lists the services and their runlevels.
Ex. Chkconfig –list  
::: Ex. Chkconfig –list  
ntsysv  
: '''ntsysv'''
Used mainly on Red Hat
:: Used mainly on Red Hat
Interactive text tool
:: Interactive text tool
Use your arrow  keys to select a service.
:: Use your arrow  keys to select a service.




== Runlevels ==
=== Runlevels ===
: 0 Transitional, Shuts down the system.  
: '''0''' ... ''Transitional, Shuts down the system.''
:: Should completely power down the system.
::''Should completely power down the system.''
: 1, s, or S Single user mode.
: '''1''', '''s''', or '''S''' ...  ''Single user mode.''
:: Used for low-level system maintenance impaired by normal system operation.
::''Used for low-level system maintenance impaired by normal system operation.''
: 2 Full muti-user mode with a graphical login.
: '''2''' ... ''Full muti-user mode with a graphical login.''
:: Used on Debian   
::''Used on Debian''  
: 3 Full multi-user mode with a console login.
: '''3''' ... ''Full multi-user mode with a console login.''
:: Used on Fedora, Mandriva,  Red Hat, and most other distributions.  
::''Used on Fedora, Mandriva,  Red Hat, and most other distributions.''
: 4 Undefined by default
: '''4''' ... ''Undefined by default''
:: Used for customization
::''Used for customization''
: 5 Same as runlevel 3 with the addition of having X run with XDM (graphical) login.
: '''5''' ...'' Same as runlevel 3 with the addition of having X run with XDM (graphical) login.''
: 6 Used to reboot the system.
: '''6''' ...''Used to reboot the system.''
:: Also a transitional runlevel.
::''Also a transitional runlevel.''


=== Determining Current Runlevel ===
: Once system is up and running runlevel info can be checked by entering :
::   ''' # runlevel'''
::: '''N 2'''


== Determining Current Runlevel ==
::  ''The first character is the previous runlevel.''
Once system is up and running runlevel info can be checked by entering :  
:: '''''N''' = system hasn’t changed runlevel since starting''
  # runlevel
:: '''''2''' =  is the current runlevel''
N 2
=== Changing runlevels on a running system ===
 
The first character is the previous runlevel.  
N = system hasn’t changed runlevel since starting
2 =  is the current runlevel  
 
== Changing runlevels on a running system ==
This can be done with the init (or telinit), shutdown, halt, reboot, or poweroff commands.  
This can be done with the init (or telinit), shutdown, halt, reboot, or poweroff commands.  


Line 132: Line 121:
== Runlevel Services ==
== Runlevel Services ==


Two main ways to affect what programs run as you enter a new runlevel.
=== Two main ways to affect what programs run as you enter a new runlevel.===


/etc/inittab  
:: '''/etc/inittab'''
SysV
:: '''SysV'''


== /etc/inittab ==
=== /etc/inittab ===
Id:runlevels:action:process  
: ''Id:runlevels:action:process''
Identification code  
:: Identification code  
Consists of a sequence of 1-4 characters to identify its function
:: Consists of a sequence of 1-4 characters to identify its function
Applicable runlevels  
:: Applicable runlevels  
List of runlevels for which this entry applies.
:: List of runlevels for which this entry applies.
Action to be taken
:: Action to be taken
Tells init how to treat the function.
:: Tells init how to treat the function.
Process to run
:: Process to run
Process to run for this entry.
:: Process to run for this entry.
Includes options and arguments
:: Includes options and arguments


== System V (SysV) ==
== System V (SysV) ==
Controls what startup scrips start or stop services depending on the parameters that are passed.
Controls what startup scrips start or stop services depending on the parameters that are passed.
S  
:'''S''' ...''rc passes the start parameter to all scrips that begin with the letter '''S'''.''
rc passes the start parameter to all scrips that begin with the letter S.
:'''K''' ...''rc passes the stop services to all scrips that begin with the letter '''K'''.''
K
== Vi ==
rc passes the stop services to all scrips that begin with the letter K.
 
== Vi ==
First  full-screen text editor built for linux.
First  full-screen text editor built for linux.

Revision as of 03:36, 1 March 2011

Chpt 5 Study Guide

Boot Process

System power > CPU looks for BIOS > CPU Runs Bios

BIOS checks for new hardware, configure hardware, and looks for boot sector.This is when the BIOS finds the boot loader in
the boot sector.Boot loader takes over from BIOS. If a multistage loader is available, a secondary loader is searched for.
Finally, the boot loader finds the kernel, loads it into memory and then executes it. Once the LINUX kernel takes over, it then
begins to initial devices, mounting root partition and other such tasks.The initial program is also started at this stage.It
gets a process ID of 1 because it’s the first program run on the system.


Retrieving Information about the boot process

Certain information about the Linux kernel and module log info can be found in the kernel ring buffer.
This info is displayed during the boot process, but is shown too fast to be read.
To access this info type the following command..
#dmesg | less
#dmesg > boot.messages

Locating and Interpreting Boot Messages

Use less and it’s search functions
Look for hardware type names
Look for hardware chipset names
Study output from a working system


Installing Boot Loaders

The master boot record (MBR) contains a partition table and a boot loader (aka boot manager). The boot loader is software which the BIOS reads and executes when the system begins to boot


Two main boot loaders for Linux

LILO (Linux Loader)

Once the default boot loader.
Slowly being overtaken by GRUB.
Small, and useful.
Can be configured using the /etc/lilo.conf file.
Which is broken into two main sections :
Global options
Boot loader location
Default stanza
Boot prompt
Boot timeout
Per-Image
Kept in sections known as stanzas.
Can also be further separated depending on if they’re for a kernel or OS.
Linux Boot Image
Non-Linux Boot Partition
OS Label
RAM Disk


GRUB (Grand Unified Boot Loader)

Has taken over as default boot loader for many LINUX distributions
Offers more configurations than LILO
GRUB has some ‘quirks’
Unlike Linux, GRUB numbers drives.
Instead of /dev/hda .. It would be /dev/hd0
Doesn’t distinguish between PATA, SATA, or SCSI drives.
GRUB also numbers partitions on a drive starting with 0, instead of 1
So partition 1 on drive 1 would look like this (hd0,0)
Floppy devices are referred to as (fd0)
Global Options
Default OS
Timeout
Background Graphic
Per Image Options
Title
GRUB root
Kernel Specification

Runlevels And Initialization Process

Linux relies on runlevels to determine which features are available.
Run levels are labels 0 thru 6. Each one being assigned to a set of services that should be active.
Understanding the purpose of runlevels makes for identifying services that are active easier.


Checking runlevel

Generally done prior to changing or to check status if something isn’t working
This is done by inspecting the /etc/initab file with the less command or opening it in an editor.

Managing Runlevels

Chkconfig
Lists the services and their runlevels.
Ex. Chkconfig –list
ntsysv
Used mainly on Red Hat
Interactive text tool
Use your arrow keys to select a service.


Runlevels

0 ... Transitional, Shuts down the system.
Should completely power down the system.
1, s, or S ... Single user mode.
Used for low-level system maintenance impaired by normal system operation.
2 ... Full muti-user mode with a graphical login.
Used on Debian
3 ... Full multi-user mode with a console login.
Used on Fedora, Mandriva, Red Hat, and most other distributions.
4 ... Undefined by default
Used for customization
5 ... Same as runlevel 3 with the addition of having X run with XDM (graphical) login.
6 ...Used to reboot the system.
Also a transitional runlevel.

Determining Current Runlevel

Once system is up and running runlevel info can be checked by entering :
# runlevel
N 2
The first character is the previous runlevel.
N = system hasn’t changed runlevel since starting
2 = is the current runlevel

Changing runlevels on a running system

This can be done with the init (or telinit), shutdown, halt, reboot, or poweroff commands.


Runlevel Services

Two main ways to affect what programs run as you enter a new runlevel.

/etc/inittab
SysV

/etc/inittab

Id:runlevels:action:process
Identification code
Consists of a sequence of 1-4 characters to identify its function
Applicable runlevels
List of runlevels for which this entry applies.
Action to be taken
Tells init how to treat the function.
Process to run
Process to run for this entry.
Includes options and arguments

System V (SysV)

Controls what startup scrips start or stop services depending on the parameters that are passed.

S ...rc passes the start parameter to all scrips that begin with the letter S.
K ...rc passes the stop services to all scrips that begin with the letter K.

Vi

First full-screen text editor built for linux. Used for a emergency recovery situations. Small and simple Can fit on a floppy disk. 3 modes of operation


Vi Modes

Command mode
Accepts single letter commands.
i and a = enter insert mode
o =opens a line below the current one.
Ex mode
Used to manipulate and save current flies and run outside programs.
Type :x from command mode to enter Ex mode.
x = the command you want to use.
Automatically returns to command mode when finished.
Also referred to as colon commands
Insert mode
Used to enter text.
Most input results in text appearing on the screen.
Use Esc key to return to command mode.

Using Vi

Use vi [file name] to launch Vi

Ex. vi lilo.conf
Have to be in the directory that is holding the file.

Command mode

The up, down, left, and right keys are used to move the curser.
yy and dd to yank (copy) text to a buffer.
dd also deletes the lines that are yanked.
Extentions of the y and d commands.
p is used to paste the contents of the buffer.

Ex mode

:w saves the file.
:q quits vi
Only works if the changes have been saved or used with !. (Ex. :q!)
:e edits a new file
Ex. :e /etc/inittab loads /etc/inittab for editing.
Only works if existing file has been saved or used with an !. (Ex. :e! /etc/inittab)
:![command] executes the external command.
Ex. :!ls executes the list command.

Insert mode

In command mode you can use R, i, and a to enter insert mode.
R - Enters text replacement.
Replace appears in the status line.
i - Enters text insertion
a - Enters text insertion but advances the curser one space.
Can be useful at the end of a line
~ - Used to change the case of a single word.
u - Undo’s any changes
o - Opens any text.
It inserts a new line below the current line while entering insert mode on that line.
G - Goes to a specific line.
:%s/[oringinal string]/[replacement]
Replaces all occurrences of one string with another.