Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
79 Cards in this Set
- Front
- Back
boot loader
|
boot loader is the software that the BIOS reads and executes when the system begins to boot.
master boot record (MBR) contains the partition table and a boot loader (also sometimes called a boot manager) |
|
two boot loaders are important in Linux
|
Linux Loader (LILO)
Grand Unified Boot Loader (GRUB) |
|
GRUB
LILO |
Linux Loader (LILO)
Grand Unified Boot Loader (GRUB) |
|
third-party boot loaders
|
System Commander
BootMagic. |
|
superblock
|
describes basic filesystem features, such as the filesystem’s size and status
debugfs and dumpe2fs commands, provide some basic superblock information |
|
Configuring LILO
|
You configure LILO using the /etc/lilo.conf file
broken into two main sections: global and per-image options |
|
/etc/lilo.conf options
boot= default= |
boot=
specifies the name of the device that contains the boot sector default= specifies the default kernel or OS that boots. If this option is omitted, the first image listed in lilo.conf is used as the default |
|
/etc/lilo.conf options
prompt timeout= |
prompt
instructs LILO to issue the boot: prompt and wait for user input. This option is usually desirable, but it can be omitted if you want the system to directly boot a single configuration timeout= setting specifies the amount of time, in tenths of a second, that LILO will wait for keyboard input before booting the default kernel image. You must use the prompt option to enable the timeout |
|
/etc/lilo.conf options
lba32 vga= |
lba32 option
enables LILO to boot from disks where the kernel image resides on a partition that is past the 1,024th cylinder. This option is almost always desirable, but you may omit it if you’re using a very old computer. vga= selects the VGA text mode that is used when booting. Choices include normal, extended, ask, and a number |
|
/etc/lilo.conf options
root= read-only |
root= option
passed to the Linux kernel to tell it what partition to use as its root (/) partition. You can set a default value for this option and override it in individual stanzas, read-only option indicates that the root filesystem should be mounted read-only. Usually, the operating system will remount the filesystem to read-write |
|
Want to password-protect your booting process
|
password,
restricted, mandatory, and bypass options, which are documented in the man page for lilo.conf. |
|
stanzas support by LILO
|
LILO supports two main types of stanzas: those for Linux kernels and those for other OSs.
|
|
LILO per-image options
image= other= |
image=
indicates the Linux kernel file to use when booting. You must pass the complete path to the Linux kernel image file. other= indicates the partition that contains its own boot loader. When this option is selected, LILO passes control to the boot loader in that partition. DOS, Windows, OS/2, BeOS, FreeBSD, and other OSs can all place their own boot loaders in their partitions, so this tool enables you to pass control to these OSs. |
|
LILO per-image options
label= initrd= append= |
label=
rovides a name for LILO to use. When you boot, you type the name of the label or press the Tab key to get a list of available labels initrd= points to an initial RAM disk. This is a small filesystem in a file that the boot loader loads into memory and delivers to the kernel as a RAM-based substitute for a disk drive. Linux distributions frequently use RAM disks like this to store kernel drivers as a way of keeping the kernel size down while still supporting a wide range of drivers append= You can pass arbitrary options to the kernel with the append= option |
|
lilo cmd
|
This command installs LILO in the MBR or boot partition’s boot sector. You should see a list of stanza names echo to the screen. Ensure that your new configuration is present
|
|
lilo cmd options
-t -c -v -b |
-C config-file option specifies an alternate
configuration file to use rather than /etc/lilo.conf -t option tests the configuration; it doesn’t write anything to the boot sector -v option produces verbose output when lilo is run. This is useful with the -t option to see how your changes will work out -b bootdev option specifies a boot device, overriding the boot= option in lilo.conf |
|
it’s possible to specify an alternate init program. A common technique is to use a regular shell program like bash in place of init. You do so at the boot: prompt like this:
|
boot: linux init=/bin/sh
|
|
usual location for GRUB’s configuration file
|
/boot/grub/menu.lst
Some distributions use grub.conf |
|
GRUB Configuration File
|
# grub.conf/menu.lst
# # Global Options: # default=0 timeout=15 splashimage=/grub/bootimage.xpm.gz # # Kernel Image Options: # title Fedora (2.6.25) root (hd0,0) kernel /vmlinuz-2.6.25 ro root=/dev/hda5 mem=2048M initrd /initrd-2.6.25 title Debian (2.6.26-experimental) root (hd0,0) kernel (hd0,0)/bzImage-2.6.26-experimental ro root=/dev/hda6 # # Other operating systems # title DOS rootnoverify (hd0,1) chainloader +1 |
|
LILO Configuration File
|
# lilo.conf
# # Global Options: # boot=/dev/hda prompt timeout=150 default=fedora lba32 vga=normal root=/dev/hda5 read-only # # Kernel Options (may have multiple): # image=/boot/vmlinuz-2.6.25 label=fedora initrd=/boot/initrd-2.6.25 append=”mem=2048M” image=/boot/bzImage-2.6.26-experimental label=debian root=/dev/hda6 # # Other Operating Systems Options (may have multiple): # other=/dev/hda2 label=dos |
|
GRUB numbers drives so that instead of /dev/hda,
|
GRUB uses (hd0)
/dev/hdb is hd1 GRUB doesn’t distinguish between PATA, SATA, and SCSI drives, so on a SCSIonly system, the first SCSI drive is (hd0) On a mixed system, ATA drives normally receive the lower numbers, although this isn’t always the case |
|
GRUB’s drive mappings can be found in the
GRUB separates partition numbers from drive numbers with |
GRUB’s drive mappings can be found in the /boot/grub/device.map file
GRUB separates partition numbers from drive numbers with comma, as in (hd0,0) for the first partition on the first disk |
|
GRUB defines its own root partition
|
GRUB’s root partition is the partition in which GRUB’s configuration file (menu.lst or grub.conf) resides
|
|
GRUB Options
default= timeout= splashimage= |
default=
tells GRUB which OS to boot If you want to boot the second listed operating system, use default=1, and so on through all your OSs. timeout= defines how long, in seconds, to wait for user input before booting the default operating system. splashimage= oints to a graphics file that’s displayed as the background for the boot process. |
|
GRUB Per-Image Options
title root |
title line begins a per-image stanza and specifies the label to display when the boot loader runs.
root option specifies the location of GRUB’s root partition |
|
GRUB Per-Image Options
kernel initrd |
kernel setting
describes the location of the Linux kernel as well as any kernel options that are to be passed to it. you can specify devices using GRUB’s syntax, such as kernel (hd0,5) /vmlinuz ro root=/dev/hda5 initrd option specify an initial RAM disk |
|
GRUB Per-Image Options
rootnoverify chainloader |
rootnoverify
is similar to the root option except that GRUB won’t try to access files on this partition. It’s used to specify a boot partition for OSs for which GRUB can’t directly load a kernel, such as DOS and Windows. chainloader tells GRUB to pass control to a nother boot loader. Typically, it’s passed a +1 option to load the first sector of the root partition |
|
command for installing GRUB
|
grub-install
# grub-install /dev/hda # grub-install ‘(hd0)‘ |
|
kernel ring buffer (def)
|
certain Linux kernel and module log info in what is called kernel ring buffer
|
|
inspect the content of the kernel ring buffer
|
dmesg
This command generates a lot of output # dmesg | less # dmesg > boot.messages |
|
/var/log/dmesg
|
Many Linux distributions store the kernel ring buffer to /var/log/dmesg soon after the system boots.
|
|
system logger
|
Another source of logging information is the system logger (syslogd). The most useful
syslogd file to look at is usually /var/log/messages, but /var/log/syslog and other log files in /var/log can also hold helpful information. |
|
Debian uses a daemon called ________ that, by default, logs any messages
that go to _____________________ |
Debian
/dev/console to the /var/log/boot |
|
Fedora and Red Hat use _________ service to log information to __________
|
Fedora and Red Hat use syslogdservice to log information to /var/log/boot.log
|
|
The Boot Process
|
1. System is powered, a special hardware circuit causes the CPU to look at a predetermined address and execute the code (BIOS reside in this location)
2. BIOS checks hardware, configs hardware, looks for boot sector ( boot sector contains the boot loader). 3. Boot loader takes over from the BIOS 4. Boot loader tries to find a kernel, load it in memory and execute 5. Once linux kernel takes over, initializes devices, mounts root partition, loads and executes initial program by default, this is the program /sbin/init. 6. The initial program gets the process ID (PID) of 1 because it’s the first program to run on the system. Assuming that /sbin/init is the initial program, it reads a file called /etc/inittab to determine what other programs to run. |
|
What is the default program that the Linux kernel executes
|
/sbin/init
|
|
runlevels
|
Linux relies on runlevels to determine what features are available. Runlevels are numbered from 0 to 6, and each one is assigned a set of services that should be active
|
|
What options should b e passed to the kernel by the boot loader in ourder to boot in a single-user mode
|
1
S s single etters S and s are synonymous with runlevel 1 |
|
If you run into peculiar runlevel numbers, consult ___________
|
/etc/inittab—it defines them and often contains comments explaining the various runlevels.
|
|
runlevel 0
|
Transitional runlevel
used to shift the system from one state to another. Specifically it shutdowns the system. |
|
runlevel 1,s,S
|
Single-used mode
What services if any are started at this runlevel varies by distribution. Typically used for low-level system maintenance that may be affected by normal operation (such as partition re-sizing) |
|
runlevel 2
|
On Debian its a full multi-user mode with X running and a graphical login
|
|
runlevel 3
|
Fedore, Mandriva, Red Hat full multi0user mode with a console login screen
|
|
runlevel 4
|
usually undefined and available for customization
|
|
runlevel 5
|
Fedora, Mandriva, Red Hat usually treat is as runlevel3 with the addition of having X run with an XDM (graphical) login
|
|
runlevel 6
|
used to reboot the system
This runlevel is also a transitional runlevel |
|
Way to affect what programs run when you enter a new runlevel
|
add or delete entries in your /etc/inittab file
|
|
/etc/event.d
|
Linux distributions are moving away from /etc/inittab as a startup control file. The new system uses entries in /etc/event.d to control init’s startup sequence. Most distributions still use /etc/inittab to specify the default runlevel, though
|
|
Basics of the /etc/inittab File
|
/etc/inittab follow a simple format
id:runlevels:action:process id sequence of 1-4 chars that ids the func runlevles list of runlelvel for which this entry applies (345 means applicable to 3, 4, 5 runlevel( action tells init how to treat the preocess - wait, respawn process the process to run for this entry |
|
The part of /etc/inittab that tells init how to handle each runlevel looks like this
|
# grep “rc [0-6]“ /etc/inittab
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 |
|
/etc/init.d/rc or /etc/rc.d/rc script
|
performs the crucial task of running all the
scripts associated with the runlevel. |
|
where are the runleve l-specific scripts stored
|
/etc/rc.d/rc?.d, /etc/init.d/rc?.d, /etc/rc?.d
? is the runlevel number rc passes the start parameter to all the scripts with names that begin with a capital S and the stop parameter to all the scripts with names that begin with a capital K. |
|
start the smb (Samba) server
|
Run them with the start option,
as in /etc/init.d/smb start to start the smb (Samba) server Other useful options are stop, restart, and status |
|
chkconfig cmd
|
To list the services and their applicable runlevels with chkconfig, use the --list option
# chkconfig --list pcmcia 0:off 1:off 2:on 3:on 4:on 5:on 6:off nfs-common 0:off 1:off 2:off 3:on 4:on 5:on 6:off xprint 0:off 1:off 2:off 3:on 4:on 5:on 6:off setserial 0:off 1:off 2:off 3:off 4:off 5:off 6:off |
|
chkconfig option to list a specific service, you can specify its name:
|
# chkconfig --list nfs-common
nfs-common 0:off 1:off 2:off 3:on 4:on 5:on 6:off |
|
chkconfig option to modify the runlevels in which a service runs, use a command like this
|
chkconfig --level 23 nfs-common on
|
|
command adds the nfs-common script to those managed by chkconfig
|
# chkconfig --add nfs-common
|
|
ntsysv utility
|
interactive text-mode tool. It was created by Red Hat and used mainly for it
|
|
If you want to change the default runlevel for the next time you boot your system, edit the
|
initdefault line in /etc/inittab and change the runlevel field to the value that you want.
|
|
If your system is up and running, you can determine your runlevel information with the __________cmd
|
runlevel
# runlevel N 2 N, this means the system hasn’t switched runlevels since booting |
|
changing runlevels on a running system list cmd
|
init (or telinit),
shutdown, halt, reboot, poweroff |
|
init process
|
the first process run by the Linux kernel, but you can also use it to have the system reread the /etc/inittab
|
|
reboot the system using init
|
set runlevel to 6
#init 6 |
|
shutdown command
|
better to use in multi-user environment when you wnat to reboot, shut down or swithc to single-user mode
|
|
shutdown now
shutdown +m shutdown -r shutdown -H shutdown -P shutdown -c |
now - shutdown is issued right away
+m - m minutes in the future -r - reboots the system -H - terminates operation but doesnt power off -P - powers off -c - cancels shutdwn |
|
shutdown system with a warning message
|
# shutdown -h +15 “system going down for maintenance”
|
|
Vi Modes
|
Command mode
Ex mode Insert mode |
|
Vi command mode
|
aaccepts commands which are usually a single letter
|
|
Vi command ex mode
|
use to manipulate files
to enter ex mode type : followed directly by the name of the ex mode command |
|
Vi insert mode
|
allows you to enter text
|
|
cmd to load vi and launc a particular file in it
|
vi lili.conf
|
|
Vi yank (term)
cmd to enter yank mode |
yank is used for referrencing copy in Vi
cmd to enter yank mode yy preceded by the number of lines you want to copy 4yy - copies 4 lines fo the current cursor position down |
|
Vi paste cmd
Cmd to enter insert mode but overrigth text Cmd to enter insert mode but without overrigthing text |
Vi paste cmd - p
Cmd to enter insert mode but overrigth text - R Cmd to enter insert mode but without overrigthing text - i |
|
Vi cmd to save file
What ~ does in commande mode |
:wq or ZZ
What ~ does in commande mode, changes case Position the cursor on the first character you want to change, and press ~ repeatedly until the task is done |
|
Vi cmd
to undo any chage open text search |
to undo any chage - u in command mode
open text - o search - / im command mode followed by search term |
|
Vi cmd to
change text go to a line replace globally |
change text - c
changes text from within command mode go to a line - G brings you to a line that you specify replace globally type :%s/original/ replacement, where original is the original string and replacement is its replacement. Change % to a starting line number |
|
Vi cmd
brings the curso to teh top of the screen brings the curso to the bottom line of the screen |
brings the curso to the top of the screen - H
brings the curso to the bottom line of the screen - L |
|
Vi cmd to
save changes to a file edit a new file |
save changes to a file
type :w in command mode edit a new file - e: This :e /etc/inittab will load /etc/inittab (Vi wont load the new file until the existent one is saved) |
|
Vi cmd to
execute an external cmd quit |
execute an external cmd - :!
:!ls runs ls quit - :q |