User:Klae0010

From ITCwiki
Jump to navigation Jump to search

Chpt 5 Study Guide


Boot Process *(pg. 240)

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 *(pg. 239)

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 (pg. 239)

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 (pg. 226)

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) (pg. 228)

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) (pg. 233)

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 (pg. 241)

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 (pg. 245)

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. space bar to toggle the service on or off.
Use the --level option to select other or multiple runlevels.


Runlevels (pg. 242)

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.
shutdown [option] [time] “[Message]”
ex. shutdown –r +15 “System going down for maintenance.”
Options
-h ...Halt or power off the computer. (runlevel 0)
-r ...Reboots the system. (runlevel 6)
-c ...Cancels a scheduled shutdown. Time hh:mm
Tells the computer when to run the shutdown command in a 24 hour format.
+ t ...t = time to shutdown in minutes.
Message ...Adds a message at the end of the command

Runlevel Services (pg.243)

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

/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
SysV (pg.244)
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 (pg. 250)

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

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.


NOTE : all page numbers reference the CompTIA Linux+ Complete Study Guide  by Roderick W. Smith ISBN 978-0-470-88845-2