28
Core Linux for Red Hat and Fedora learning under GNU Free Documentation License - Copyleft (c) Acácio Oliveira 2012 Everyone is permitted to copy and distribute verbatim copies of this license document, changing is allowed Linux Essenciais and System Administration

101 2.2 install boot manager

Embed Size (px)

Citation preview

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Linux Essenciais and System Administration

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Key Knowledge Areas

Providing alternative boot locations and backup boot options. Install and configure a boot loader such as GRUB. Interact with the boot loader.

Linux Installation and Package Management

Install a boot manager

Terms and Utilities

/boot/grub/menu.lst grub-install MBR superblock /etc/lilo.conf lilo

2

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

LILO is (almost) the original LInux LOader. does not depend on you using specific filesystem, can boot Linux kernel images from floppy disks, can act as a bootmanager for other operating systems.

LILO or LInux LOader

3

LILO works something like this:

1.You create the configuration file /etc/lilo.conf

2.You run /sbin/lilo

3. /sbin/lilo maps out sectors on disk with data needed for booting (kernel, config options)

4. /sbin/lilo maps out locations of disk with data needed for booting (kernel, config options).This map is stored in /boot/map.

5. /sbin/lilo installs the boot loader on disk, configures it with location of /boot/map.

location of data on disk may not change after /boot/map has been created. - if you modify configuration in /etc/lilo.conf; - install kernel upgrade; - rename files and directories;

you need to run /sbin/lilo again.

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

/etc/lilo.conf

yourname@yourcomp~> cat /etc/lilo.conf

prompttimeout=50default=linuxboot=/dev/hdamap=/boot/mapinstall=/boot/boot.bmessage=/boot/messagelinear

image=/boot/vmlinuz-2.4.18-14label=linuxinitrd=/boot/initrd-2.4.18-14.imgread-onlyappend="root=LABEL=/"

other=/dev/hda1optionallabel=Windows

Ex: lilo.conf determines the configuration of boot loader installed by /sbin/lilo.

4

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

1st part of file contains items which apply to the entire LILO configuration:

File lilo.conf

5

• Prompt: LILO presents the boot up menu, even if nobody presses the Shift key during booting up.

• timeout=50: 50 tenths of second10, or 5 seconds. 5 seconds to choose menu item, or to change the kernel command line.

• default=linux: if there’s no response for 5 seconds, kernel image defined with the parameter “label=linux” is loaded into memory.

• boot=/dev/hda: first stage boot loader is installed here (as MBR on the first IDE disk).

If this is replaced with /dev/fd0 then /sbin/lilo installs first stage loader on boot sector of floppy disk. This option can be overridden running /sbin/lilo as lilo -b /dev/fd0.

• Linear: causes LILO to use linear sector addresses instead of sector/head/cylinder addresses to pinpoint the location of the data files.

Reliable with older hardware, system may not boot if you install the disk in different computer with different BIOS.

For large disks in combination with older BIOS, /sbin/lilo may generate references to parts of disk that are inaccessible.

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

2st part of file contains global parameters, unchanged from default settings:

File lilo.conf

6

• message=/boot/message: contents of this file are displayed when the system boots. In more recent versions of LILO, this file contains instructions for graphical boot menus used by distros.

• map=/boot/map: file in which the locations of kernel, and LILO are stored. Generally no change.

• install=/boot/boot.b: This file contains the data which /sbin/lilo installs in the boot sector.

Part of the file:

• image=/boot/vmlinuz2.4.1814: file contains a kernel image to be loaded into memory by LILO.

• Label=linux: this is what you can choose on booting to load kernel image from /boot/vmlinuz2.4.1814

• initrd=/boot/initrd2.4.1814.img: the initial root disk. initially runs using a memory disk (file system) loaded from file specified. After necessary kernel modules are loaded, booting continues as normal.

• Read-only: option added to kernel cmdline. Instructs start with root file system mounted read-only.

• append="root=LABEL=/“: text “root=LABEL=/” is added to kernel. tells kernel to use partition labelled as “LABEL=/” as the root partitioncan see the parameters with which your kernel was booted with cat /proc/cmdline.

image=/boot/vmlinuz-2.4.18-14label=linuxinitrd=/boot/initrd-2.4.18-14.imgread-onlyappend="root=LABEL=/"

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

To install, edit /etc/lilo.conf and run /sbin/lilo

LILO command options

7

To uninstall, LILO keeps a copy of the original sector of each device installed on.If asked to uninstall itself, it copies the original sector back to the device, and the system returns to it's original state.

yourname@yourcomp~> lilo -uEx:

You could uninstall LILO by reinstalling the boot loader of other operating system. reinstall default boot loader DOS / W9x: C:\> FDISK /MBR

To install, from a boot floppy use lilo – b, wich overrides value specified for boot= in /etc/lilo.conf

yourname@yourcomp~> lilo –b /dev/fd0Ex:

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

In lilo.conf the following lines configure LILO to boot other operating system:

LILO dual boot

8

yourname@yourcomp~> cat /etc/lilo.conf

prompttimeout=50default=linuxboot=/dev/hdamap=/boot/mapinstall=/boot/boot.bmessage=/boot/messagelinear

image=/boot/vmlinuz-2.4.18-14label=linuxinitrd=/boot/initrd-2.4.18-14.imgread-onlyappend="root=LABEL=/"

other=/dev/hda1optionallabel=Windows

Ex:

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

Complete /etc/lilo.conf generated exemple

Originally generated by liloconfig - modified# This allows booting from any partition on disks with more than 1024# cylinders.Lba32

# Specifies the boot device (floppy)boot=/dev/fd0

# Specifies the device that should be mounted as root.# If the special name CURRENT is used, the root device is set to the# device on which the root file system is currently mounted. If the root# has been changed with -r , the respective device is used. If the# variable ROOT is omitted, the root device setting contained in the# kernel image is used. It can be changed with the rdev program.root=/dev/sda7

# Bitmap configuration for /boot/coffee.bmpbitmap=/boot/coffee.bmpbmp-colors=12,,11,15,,8bmp-table=385p,100p,1,10bmp-timer=38,2,13,1

.. // ..

Ex. Part 1:

9

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

Complete /etc/lilo.conf generated exemple

.. // ..# Enables map compaction:# Tries to merge read requests for adjacent sectors into a single# read request. This drastically reduces load time and keeps the map# smaller. Using COMPACT is especially recommended when booting from a# floppy disk.Compact

# Install the specified file as the new boot sector.# LILO supports built in boot sectors, you only need# to specify the type, choose one from 'text', 'menu' or 'bitmap'.# new: install=bmp old: install=/boot/boot-bmp.b# new: install=text old: install=/boot/boot-text.b# new: install=menu old: install=/boot/boot-menu.b or boot.b# default: 'menu' is default, unless you have a bitmap= line# Note: install=bmp must be used to see the bitmap menu.# install=menuinstall=bmp

# Specifies the number of _tenths_ of a second LILO should# wait before booting the first image. LILO# doesn't wait if DELAY is omitted or if DELAY is set to zero.# delay=20

.. // ..

Ex. Part 2:

10

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

Complete /etc/lilo.conf generated exemple

.. // ..# Prompt to use certain image. If prompt is specified without timeout,# boot will not take place unless you hit RETURN. Timeout is in tenths of# a second.prompttimeout=200

# Enable large memory mode.large-memory

# Specifies the location of the map file. If MAP is# omitted, a file /boot/map is used.map=/boot/map

# Specifies the VGA text mode that should be selected when# booting. The following values are recognized (case is ignored):# NORMAL select normal 80x25 text mode.# EXTENDED select 80x50 text mode. The word EXTENDED can be# abbreviated to EXT.# ASK stop and ask for user input (at boot time).# <number> use the corresponding text mode. A list of available modes# can be obtained by booting with vga=ask and pressing [Enter].vga=normal

.. // ..

Ex. Part 3:

11

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

Complete /etc/lilo.conf generated exemple

.. // ..# Defines non-standard parameters for the specified disk.#disk=/dev/sda# bios=0x80# If you are using removable USB drivers (with mass-storage)# you will need to tell LILO to not use these devices even# if defined in /etc/fstab and referenced in /proc/partitions.# Adjust these lines to your devices:##disk=/dev/sda inaccessible# disk=/dev/sdb inaccessible

# These images were automagically added. You may need to edit something.

image=/boot/vmlinuz-2.6.31-14-genericlabel="Lin 2.6.31-14"initrd=/boot/initrd.img-2.6.31-14-genericread-only

image=/boot/vmlinuz-2.6.31-20-genericlabel="Lin 2.6.31-20"initrd=/boot/initrd.img-2.6.31-20-genericread-only

.. // ..

Ex. Part 4:

12

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

Complete /etc/lilo.conf generated exemple

.. // ..

image=/boot/memtest86+.binlabel="Memory Test+"read-only

# If you have another OS on this machine (say DOS),# you can boot if by uncommenting the following lines# (Of course, change /dev/sda1 to wherever your DOS partition is.)

other=/dev/sda6label="Fedora 8"

other=/dev/sda1label="Windows XP“

.. // ..

Ex. Part 5:

13

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

if graphical startup is not working, you may want to boot into mode3 or single user mode.

- Select an entry and then press TAB keyyou should be presented with terminal window with selected entry label name

- Any text you type after the label name will be passed to the kernel.

Adding kernel parameters with LILO

14

Ex: adding "single" to boot parameters to boot in single user mode.

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

info in lilo man page using command man lilo, or man lilo.conf. extensive info in PostScript user guide installed with lilo or lilo-doc package.

LILO help

15

yourname@yourcomp~> dpkg -L lilo-doc | grep "ps"

/usr/share/doc/lilo-doc/user.ps.gz/usr/share/doc/lilo-doc/tech.ps.gz

Ex: In dpkg system (Ubuntu):

In RPM system (Fedora):

yourname@yourcomp~> rpm -ql lilo-doc | grep "ps”

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

GRUB understands enough about partitions and filesystems to find its config file without using a map file.

GRUB config file defaults to /boot/grub/grub.conf or /boot/grub/menu.lstIf both are present, one will usually be a symbolic link to the other.

GRUB cmd is in /sbin/grub or on some systems in /usr/sbin/grub

GRUB or GRand Unifood Boot loader

16

GRUB runs in:•menu mode: allows to choose an operating system from a menu;•command mode: allows specifying individual commands to load a system.

grub-install permits automated tasks for installing GRUB on disk or floppy

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

/boot/grub/menu.lst GRUB configuration

17

# grub.conf generated by anaconda##Note that you do not have to rerun grub after making changes to this file# NOTICE: You do not have a /boot partition. This means that# all kernel and initrd paths are relative to /, eg.

default=1timeout=10splashimage=(hd0,2)/boot/grub/fig1x.xpm.gzforeground=23334cbackground=82a6bcpassword --md5 $1$H8LlM1$cI0Lfs5.C06xFJYPQ8Ixz/

title Red Hat Linux (2.4.20-31.9)root (hd0,6)kernel /boot/vmlinuz-2.4.20-31.9 ro root=LABEL=RH9 hdd=ide-scsiinitrd /boot/initrd-2.4.20-31.9.imgsavedefaultboot

title Red Hat Enterprise Linux WS A (2.4.21-40.EL)root (hd0,10)kernel /boot/vmlinuz-2.4.21-40.EL ro root=LABEL=RHEL3 hdd=ide-scsiinitrd /boot/initrd-2.4.21-40.EL.img

title Win/XProotnoverify (hd0,0)chainloader +1

Ex:

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

•GRUB provides menu interface instead of LILO's prompt. •Can use password encrypted MD5 algorithm LILO use’s plain text password. •changes made to GRUB config file do not require GRUB to be reinstalled in MBR.

GRUB or GRand Unifood Boot loader

18

GRUB does not require a partition to be mounted just needs a boot entry for it. entries such as root (hd0,6) and splashimage=(hd0,2)/boot/grub/fig1x.xpm.gz.

Because GRUB refers to hard disks as hdn, n is an integer starting from 0. Partitions on disk are similarly numbered starting from 0.

On prior exemple:(hd0,2) is the primary partition /dev/hda3; (hd0,6) represents logical partition /dev/hda7. Floppy drive is usually (fd0).

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

1st set of options in grub file control how GRUB operates. called menu commands, and they must appear before other commands.

Remaining sections give per-image options for the operating systems to boot.

The "title" is considered menu command. Each instance of title is followed by one or more general or menu entry commands.

GRUB file options

19

default=1timeout=10splashimage=(hd0,2)/boot/grub/fig1x.xpm.gzforeground=23334cbackground=82a6bcpassword --md5 $1$H8LlM1$cI0Lfs5.C06xFJYPQ8Ixz/

title Red Hat Enterprise Linux WS A (2.4.21-40.EL)root (hd0,10)kernel /boot/vmlinuz-2.4.21-40.EL ro root=LABEL=RHEL3 hdd=ide-scsiinitrd /boot/initrd-2.4.21-40.EL.img

title Win/XProotnoverify (hd0,0)chainloader +1

Ex:

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

•default: which system to load if the user does not make a choice within a timeout. In example, default=2 load the third entry.

•timeout: seconds before booting entry. LILO uses tenths of a second for timeouts, GRUB uses seconds.

•Splashimage: background, or splash, image displayed with the boot menu.splashimage=(hd0,6)/boot/grub/splash.xpm.gz uses file /boot/grub/splash.xpm.gz on partition 7 of 1st hard drive.

•password: in clear text or stored as MD5 digest.

•title: descriptive title shown as menu item when Grub boots for selection.

•root: partition that will be booted. GRUB refers to 1st hard drive as (hd0) and 1st partition on the drive as (hd0,0).

•kernel: Specifies the kernel image to load and any kernel parameters.

•Initrd: name of the initial RAM disk, which contains modules needed by kernel before file systems are mounted.

•savedefault: specified for an op system that could be default until another op system with default= overrides it.

•boot: optional parameter that instructs GRUB to boot selected system.

•lock: is will not boot the entry until a password is entered.

•rootnoverify: similar to root, except that GRUB does not attempt to mount the file system or verify its parameters. used for file systems as NTFS that are not supported by GRUB.

Chainloader: Specifies another file loaded as stage1 file. value "+1" is equivalent to 0+1 = load sector starting at sector 0 or load 1st sector from device in root or rootnoverify.

GRUB options (/boot/grub/menu.lst or /boot/grub/grub.conf)

20

View GRUB manual, with command info grub.

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

May use GRUB device name (fd0) instead of /dev/fd0, For that enclose it in quotes to avoid shell interpretation of parentheses. grub-install '(fd0)'

Installing GRUB to floppy disk

21

Ex: yourname@yourcomp~> grub-install /dev/fd0

Installation finished. No error reported.This is the contents of the device map /boot/grub/device.map.Check if this is correct or not. If any of the lines is incorrect,fix it and re-run the script `grub-install'.(fd0) /dev/fd0(hd0) /dev/sda

Once tested the boot floppy, to install GRUB in the MBR of the hard drive use:

yourname@yourcomp~> grub-install /dev/sda or grub-install '(hd0)'

yourname@yourcomp~> grub-install /dev/sda11 or grub-install '(hd0,10)'

To install it into partition boot record for partition 11:

Ex:

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

copy the kernel image to the floppy, that will be a bootable kernel image.and set root device encoded in the kernel to /dev/hda3.

May not be successful as many Linux distributions require a initial root disk (/boot/initrd).Consult HOW-TO’s

Installing Kernel to floppy disk

22

Ex: yourname@yourcomp~> dd if=/boot/vmlinuz of=/dev/fd0yourname@yourcomp~> rdev /dev/fd0 /dev/hda3

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

GRUB boot

23

Ex:

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

Like LILO, boot parameters can be given, edit any commands in GRUB config, or load another config file

GRUB Kernel boot parameters

24

Ex:

• select entry and enter e command to edit.• Select line and enter e command to edit.• Return to menu by pressing enter . • Boot system by enter b command.

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

GRUB 2 - default boot loader and manager for Ubuntu since 9.10 (Karmic Koala). As computer starts, GRUB 2 presents a menu and awaits user input or automatically transfers controls

GRUB 2

25

GRUB 2 is version 1.98 or later. GRUB legacy (version 0.97)To determine version, use grub-install -v. Grub version 1.99 is Ubuntu 11.04 (Natty Narwhal) and introduces changes

https://help.ubuntu.com/community/Grub2

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

GRUB 2 - default boot loader and manager for Ubuntu since 9.10 (Karmic Koala). As computer starts, GRUB 2 presents a menu and awaits user input or automatically transfers controls

GRUB 2

26

GRUB 2 is version 1.98 or later. GRUB legacy (version 0.97)To determine version, use grub-install -v. Grub version 1.99 is Ubuntu 11.04 (Natty Narwhal) and introduces changes

•No /boot/grub/menu.lst. It has been replaced by /boot/grub/grub.cfg

•config file, normally located in /boot/grub folder, is grub.cfg. should not be edited directly.

•grub.cfg is overwritten by certain Grub 2 package updates, whenever a kernel is added or removed, or when the user runs update-grub

•The menu list of available Linux kernels is automatically generated by running update-grub

•primary config file for changing menu display settings is called grub located in /etc/default folder.

•multiple files for config the menu - /etc/default/grub, and files in /etc/grub.d/ directory.

https://help.ubuntu.com/community/Grub2

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Install a Boot Manager

Update tools are usually aware of the boot loader and will update config file automatically. To use config file with a non-standard name or location, it must be edited.

System updates

27

For LILO: Run lilo command when there’s updates for the config file or changes in hard drives.

For GRUB: Edit /boot/grub/grub.conf and reboot.

There’s no need to reinstall if you add a new kernel. But if you move partitions, and drives, you have to reinstall it. Because:stage1 loader is small and it has a list of block addresses for the stage2 loader (grub).Moving the partition changes the addresses, and stage1 doesn't locate stage2.

Core

Lin

ux fo

r Re

d H

at a

nd F

edor

a le

arni

ng u

nder

GN

U F

ree

Doc

umen

tatio

n Li

cens

e -

Copy

left

(c) A

cáci

o O

livei

ra 2

012

Ev

eryo

ne

is p

erm

itte

d to

co

py

and

dis

trib

ute

verb

atim

co

pie

s o

f th

is li

cen

se d

ocu

me

nt,

cha

ngin

g is

allo

wed

Fim de sessão

28