1N/AThis is grub.info, produced by makeinfo version 4.0 from grub.texi.
1N/A
1N/AINFO-DIR-SECTION Kernel
1N/ASTART-INFO-DIR-ENTRY
1N/A* GRUB: (grub). The GRand Unified Bootloader
1N/A* grub-install: (grub)Invoking grub-install. Install GRUB on your drive
1N/A* grub-md5-crypt: (grub)Invoking grub-md5-crypt. Encrypt a password
1N/A in MD5 format
1N/A* grub-terminfo: (grub)Invoking grub-terminfo. Generate a terminfo
1N/A command from a
1N/A terminfo name
1N/A* grub-set-default: (grub)Invoking grub-set-default. Set a default boot
1N/A entry
1N/A* mbchk: (grub)Invoking mbchk. Check for the format of a Multiboot kernel
1N/AEND-INFO-DIR-ENTRY
1N/A
1N/A Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, Inc.
1N/A
1N/A Permission is granted to make and distribute verbatim copies of this
1N/Amanual provided the copyright notice and this permission notice are
1N/Apreserved on all copies.
1N/A
1N/A Permission is granted to copy and distribute modified versions of
1N/Athis manual under the conditions for verbatim copying, provided also
1N/Athat the entire resulting derived work is distributed under the terms
1N/Aof a permission notice identical to this one.
1N/A
1N/A Permission is granted to copy and distribute translations of this
1N/Amanual into another language, under the above conditions for modified
1N/Aversions.
1N/A
1N/A
1N/AFile: grub.info, Node: Top, Next: Introduction, Up: (dir)
1N/A
1N/AGRUB manual
1N/A***********
1N/A
1N/A This is the documentation of GNU GRUB, the GRand Unified Bootloader,
1N/Aa flexible and powerful boot loader program for PCs.
1N/A
1N/A This edition documents version 0.95.
1N/A
1N/A* Menu:
1N/A
1N/A* Introduction:: Capturing the spirit of GRUB
1N/A* Naming convention:: Names of your drives in GRUB
1N/A* Installation:: Installing GRUB on your drive
1N/A* Booting:: How to boot different operating systems
1N/A* Configuration:: Writing your own configuration file
1N/A* Network:: Downloading OS images from a network
1N/A* Serial terminal:: Using GRUB via a serial line
1N/A* Preset Menu:: Embedding a configuration file into GRUB
1N/A* Security:: Improving the security
1N/A* Images:: GRUB image files
1N/A* Filesystem:: Filesystem syntax and semantics
1N/A* Interface:: The menu and the command-line
1N/A* Commands:: The list of available builtin commands
1N/A* Troubleshooting:: Error messages produced by GRUB
1N/A* Invoking the grub shell:: How to use the grub shell
1N/A* Invoking grub-install:: How to use the GRUB installer
1N/A* Invoking grub-md5-crypt:: How to generate a cryptic password
1N/A* Invoking grub-terminfo:: How to generate a terminfo command
1N/A* Invoking grub-set-default:: How to set a default boot entry
1N/A* Invoking mbchk:: How to use the Multiboot checker
1N/A* Obtaining and Building GRUB:: How to obtain and build GRUB
1N/A* Reporting bugs:: Where you should send a bug report
1N/A* Future:: Some future plans on GRUB
1N/A* Internals:: Hacking GRUB
1N/A* Index::
1N/A
1N/A
1N/AFile: grub.info, Node: Introduction, Next: Naming convention, Prev: Top, Up: Top
1N/A
1N/AIntroduction to GRUB
1N/A********************
1N/A
1N/A* Menu:
1N/A
1N/A* Overview:: What exactly GRUB is and how to use it
1N/A* History:: From maggot to house fly
1N/A* Features:: GRUB features
1N/A* Role of a boot loader:: The role of a boot loader
1N/A
1N/A
1N/AFile: grub.info, Node: Overview, Next: History, Up: Introduction
1N/A
1N/AOverview
1N/A========
1N/A
1N/A Briefly, a "boot loader" is the first software program that runs when
1N/Aa computer starts. It is responsible for loading and transferring
1N/Acontrol to an operating system "kernel" software (such as Linux or GNU
1N/AMach). The kernel, in turn, initializes the rest of the operating
1N/Asystem (e.g. a GNU system).
1N/A
1N/A GNU GRUB is a very powerful boot loader, which can load a wide
1N/Avariety of free operating systems, as well as proprietary operating
1N/Asystems with chain-loading(1) (*note Overview-Footnote-1::). GRUB is
1N/Adesigned to address the complexity of booting a personal computer; both
1N/Athe program and this manual are tightly bound to that computer platform,
1N/Aalthough porting to other platforms may be addressed in the future.
1N/A
1N/A One of the important features in GRUB is flexibility; GRUB
1N/Aunderstands filesystems and kernel executable formats, so you can load
1N/Aan arbitrary operating system the way you like, without recording the
1N/Aphysical position of your kernel on the disk. Thus you can load the
1N/Akernel just by specifying its file name and the drive and partition
1N/Awhere the kernel resides.
1N/A
1N/A When booting with GRUB, you can use either a command-line interface
1N/A(*note Command-line interface::), or a menu interface (*note Menu
1N/Ainterface::). Using the command-line interface, you type the drive
1N/Aspecification and file name of the kernel manually. In the menu
1N/Ainterface, you just select an OS using the arrow keys. The menu is
1N/Abased on a configuration file which you prepare beforehand (*note
1N/AConfiguration::). While in the menu, you can switch to the command-line
1N/Amode, and vice-versa. You can even edit menu entries before using them.
1N/A
1N/A In the following chapters, you will learn how to specify a drive, a
1N/Apartition, and a file name (*note Naming convention::) to GRUB, how to
1N/Ainstall GRUB on your drive (*note Installation::), and how to boot your
1N/AOSes (*note Booting::), step by step.
1N/A
1N/A Besides the GRUB boot loader itself, there is a "grub shell" `grub'
1N/A(*note Invoking the grub shell::) which can be run when you are in your
1N/Aoperating system. It emulates the boot loader and can be used for
1N/Ainstalling the boot loader.
1N/A
1N/A
1N/AFile: grub.info, Node: Overview-Footnotes, Up: Overview
1N/A
1N/A (1) "chain-load" is the mechanism for loading unsupported operating
1N/Asystems by loading another boot loader. It is typically used for
1N/Aloading DOS or Windows.
1N/A
1N/A
1N/AFile: grub.info, Node: History, Next: Features, Prev: Overview, Up: Introduction
1N/A
1N/AHistory of GRUB
1N/A===============
1N/A
1N/A GRUB originated in 1995 when Erich Boleyn was trying to boot the GNU
1N/AHurd with the University of Utah's Mach 4 microkernel (now known as GNU
1N/AMach). Erich and Brian Ford designed the Multiboot Specification
1N/A(*note Multiboot Specification: (multiboot)Top.), because they were
1N/Adetermined not to add to the large number of mutually-incompatible PC
1N/Aboot methods.
1N/A
1N/A Erich then began modifying the FreeBSD boot loader so that it would
1N/Aunderstand Multiboot. He soon realized that it would be a lot easier to
1N/Awrite his own boot loader from scratch than to keep working on the
1N/AFreeBSD boot loader, and so GRUB was born.
1N/A
1N/A Erich added many features to GRUB, but other priorities prevented him
1N/Afrom keeping up with the demands of its quickly-expanding user base. In
1N/A1999, Gordon Matzigkeit and Yoshinori K. Okuji adopted GRUB as an
1N/Aofficial GNU package, and opened its development by making the latest
1N/Asources available via anonymous CVS. *Note Obtaining and Building
1N/AGRUB::, for more information.
1N/A
1N/A
1N/AFile: grub.info, Node: Features, Next: Role of a boot loader, Prev: History, Up: Introduction
1N/A
1N/AGRUB features
1N/A=============
1N/A
1N/A The primary requirement for GRUB is that it be compliant with the
1N/A"Multiboot Specification", which is described in *Note Multiboot
1N/ASpecification: (multiboot)Top.
1N/A
1N/A The other goals, listed in approximate order of importance, are:
1N/A
1N/A * Basic functions must be straightforward for end-users.
1N/A
1N/A * Rich functionality to support kernel experts and designers.
1N/A
1N/A * Backward compatibility for booting FreeBSD, NetBSD, OpenBSD, and
1N/A Linux. Proprietary kernels (such as DOS, Windows NT, and OS/2) are
1N/A supported via a chain-loading function.
1N/A
1N/A Except for specific compatibility modes (chain-loading and the Linux
1N/A"piggyback" format), all kernels will be started in much the same state
1N/Aas in the Multiboot Specification. Only kernels loaded at 1 megabyte or
1N/Aabove are presently supported. Any attempt to load below that boundary
1N/Awill simply result in immediate failure and an error message reporting
1N/Athe problem.
1N/A
1N/A In addition to the requirements above, GRUB has the following
1N/Afeatures (note that the Multiboot Specification doesn't require all the
1N/Afeatures that GRUB supports):
1N/A
1N/ARecognize multiple executable formats
1N/A Support many of the "a.out" variants plus "ELF". Symbol tables are
1N/A also loaded.
1N/A
1N/ASupport non-Multiboot kernels
1N/A Support many of the various free 32-bit kernels that lack Multiboot
1N/A compliance (primarily FreeBSD, NetBSD, OpenBSD, and Linux).
1N/A Chain-loading of other boot loaders is also supported.
1N/A
1N/ALoad multiples modules
1N/A Fully support the Multiboot feature of loading multiple modules.
1N/A
1N/ALoad a configuration file
1N/A Support a human-readable text configuration file with preset boot
1N/A commands. You can also load another configuration file dynamically
1N/A and embed a preset configuration file in a GRUB image file. The
1N/A list of commands (*note Commands::) are a superset of those
1N/A supported on the command-line. An example configuration file is
1N/A provided in *Note Configuration::.
1N/A
1N/AProvide a menu interface
1N/A A menu interface listing preset boot commands, with a programmable
1N/A timeout, is available. There is no fixed limit on the number of
1N/A boot entries, and the current implementation has space for several
1N/A hundred.
1N/A
1N/AHave a flexible command-line interface
1N/A A fairly flexible command-line interface, accessible from the menu,
1N/A is available to edit any preset commands, or write a new boot
1N/A command set from scratch. If no configuration file is present,
1N/A GRUB drops to the command-line.
1N/A
1N/A The list of commands (*note Commands::) are a subset of those
1N/A supported for configuration files. Editing commands closely
1N/A resembles the Bash command-line (*note Bash: (features)Command
1N/A Line Editing.), with <TAB>-completion of commands, devices,
1N/A partitions, and files in a directory depending on context.
1N/A
1N/ASupport multiple filesystem types
1N/A Support multiple filesystem types transparently, plus a useful
1N/A explicit blocklist notation. The currently supported filesystem
1N/A types are "BSD FFS", "DOS FAT16 and FAT32", "Minix fs", "Linux
1N/A ext2fs", "ReiserFS", "JFS", "XFS", and "VSTa fs". *Note
1N/A Filesystem::, for more information.
1N/A
1N/ASupport automatic decompression
1N/A Can decompress files which were compressed by `gzip'. This
1N/A function is both automatic and transparent to the user (i.e. all
1N/A functions operate upon the uncompressed contents of the specified
1N/A files). This greatly reduces a file size and loading time, a
1N/A particularly great benefit for floppies.(1) (*note
1N/A Features-Footnote-1::)
1N/A
1N/A It is conceivable that some kernel modules should be loaded in a
1N/A compressed state, so a different module-loading command can be
1N/A specified to avoid uncompressing the modules.
1N/A
1N/AAccess data on any installed device
1N/A Support reading data from any or all floppies or hard disk(s)
1N/A recognized by the BIOS, independent of the setting of the root
1N/A device.
1N/A
1N/ABe independent of drive geometry translations
1N/A Unlike many other boot loaders, GRUB makes the particular drive
1N/A translation irrelevant. A drive installed and running with one
1N/A translation may be converted to another translation without any
1N/A adverse effects or changes in GRUB's configuration.
1N/A
1N/ADetect all installed RAM
1N/A GRUB can generally find all the installed RAM on a PC-compatible
1N/A machine. It uses an advanced BIOS query technique for finding all
1N/A memory regions. As described on the Multiboot Specification (*note
1N/A Multiboot Specification: (multiboot)Top.), not all kernels make
1N/A use of this information, but GRUB provides it for those who do.
1N/A
1N/ASupport Logical Block Address mode
1N/A In traditional disk calls (called "CHS mode"), there is a geometry
1N/A translation problem, that is, the BIOS cannot access over 1024
1N/A cylinders, so the accessible space is limited to at least 508 MB
1N/A and to at most 8GB. GRUB can't universally solve this problem, as
1N/A there is no standard interface used in all machines. However,
1N/A several newer machines have the new interface, Logical Block
1N/A Address ("LBA") mode. GRUB automatically detects if LBA mode is
1N/A available and uses it if available. In LBA mode, GRUB can access
1N/A the entire disk.
1N/A
1N/ASupport network booting
1N/A GRUB is basically a disk-based boot loader but also has network
1N/A support. You can load OS images from a network by using the "TFTP"
1N/A protocol.
1N/A
1N/ASupport remote terminals
1N/A To support computers with no console, GRUB provides remote terminal
1N/A support, so that you can control GRUB from a remote host. Only
1N/A serial terminal support is implemented at the moment.
1N/A
1N/A
1N/AFile: grub.info, Node: Features-Footnotes, Up: Features
1N/A
1N/A (1) There are a few pathological cases where loading a very badly
1N/Aorganized ELF kernel might take longer, but in practice this never
1N/Ahappen.
1N/A
1N/A
1N/AFile: grub.info, Node: Role of a boot loader, Prev: Features, Up: Introduction
1N/A
1N/AThe role of a boot loader
1N/A=========================
1N/A
1N/A The following is a quotation from Gordon Matzigkeit, a GRUB fanatic:
1N/A
1N/A Some people like to acknowledge both the operating system and
1N/A kernel when they talk about their computers, so they might say
1N/A they use "GNU/Linux" or "GNU/Hurd". Other people seem to think
1N/A that the kernel is the most important part of the system, so they
1N/A like to call their GNU operating systems "Linux systems."
1N/A
1N/A I, personally, believe that this is a grave injustice, because the
1N/A _boot loader_ is the most important software of all. I used to
1N/A refer to the above systems as either "LILO"(1) (*note Role of a
1N/A boot loader-Footnote-1::) or "GRUB" systems.
1N/A
1N/A Unfortunately, nobody ever understood what I was talking about;
1N/A now I just use the word "GNU" as a pseudonym for GRUB.
1N/A
1N/A So, if you ever hear people talking about their alleged "GNU"
1N/A systems, remember that they are actually paying homage to the best
1N/A boot loader around... GRUB!
1N/A
1N/A We, the GRUB maintainers, do not (usually) encourage Gordon's level
1N/Aof fanaticism, but it helps to remember that boot loaders deserve
1N/Arecognition. We hope that you enjoy using GNU GRUB as much as we did
1N/Awriting it.
1N/A
1N/A
1N/AFile: grub.info, Node: Role of a boot loader-Footnotes, Up: Role of a boot loader
1N/A
1N/A (1) The LInux LOader, a boot loader that everybody uses, but nobody
1N/Alikes.
1N/A
1N/A
1N/AFile: grub.info, Node: Naming convention, Next: Installation, Prev: Introduction, Up: Top
1N/A
1N/ANaming convention
1N/A*****************
1N/A
1N/A The device syntax used in GRUB is a wee bit different from what you
1N/Amay have seen before in your operating system(s), and you need to know
1N/Ait so that you can specify a drive/partition.
1N/A
1N/A Look at the following examples and explanations:
1N/A
1N/A (fd0)
1N/A
1N/A First of all, GRUB requires that the device name be enclosed with
1N/A`(' and `)'. The `fd' part means that it is a floppy disk. The number
1N/A`0' is the drive number, which is counted from _zero_. This expression
1N/Ameans that GRUB will use the whole floppy disk.
1N/A
1N/A (hd0,1)
1N/A
1N/A Here, `hd' means it is a hard disk drive. The first integer `0'
1N/Aindicates the drive number, that is, the first hard disk, while the
1N/Asecond integer, `1', indicates the partition number (or the PC slice
1N/Anumber in the BSD terminology). Once again, please note that the
1N/Apartition numbers are counted from _zero_, not from one. This
1N/Aexpression means the second partition of the first hard disk drive. In
1N/Athis case, GRUB uses one partition of the disk, instead of the whole
1N/Adisk.
1N/A
1N/A (hd0,4)
1N/A
1N/A This specifies the first "extended partition" of the first hard disk
1N/Adrive. Note that the partition numbers for extended partitions are
1N/Acounted from `4', regardless of the actual number of primary partitions
1N/Aon your hard disk.
1N/A
1N/A (hd1,a)
1N/A
1N/A This means the BSD `a' partition of the second hard disk. If you
1N/Aneed to specify which PC slice number should be used, use something
1N/Alike this: `(hd1,0,a)'. If the PC slice number is omitted, GRUB
1N/Asearches for the first PC slice which has a BSD `a' partition.
1N/A
1N/A Of course, to actually access the disks or partitions with GRUB, you
1N/Aneed to use the device specification in a command, like `root (fd0)' or
1N/A`unhide (hd0,2)'. To help you find out which number specifies a
1N/Apartition you want, the GRUB command-line (*note Command-line
1N/Ainterface::) options have argument completion. This means that, for
1N/Aexample, you only need to type
1N/A
1N/A root (
1N/A
1N/A followed by a <TAB>, and GRUB will display the list of drives,
1N/Apartitions, or file names. So it should be quite easy to determine the
1N/Aname of your target partition, even with minimal knowledge of the
1N/Asyntax.
1N/A
1N/A Note that GRUB does _not_ distinguish IDE from SCSI - it simply
1N/Acounts the drive numbers from zero, regardless of their type. Normally,
1N/Aany IDE drive number is less than any SCSI drive number, although that
1N/Ais not true if you change the boot sequence by swapping IDE and SCSI
1N/Adrives in your BIOS.
1N/A
1N/A Now the question is, how to specify a file? Again, consider an
1N/Aexample:
1N/A
1N/A (hd0,0)/vmlinuz
1N/A
1N/A This specifies the file named `vmlinuz', found on the first
1N/Apartition of the first hard disk drive. Note that the argument
1N/Acompletion works with file names, too.
1N/A
1N/A That was easy, admit it. Now read the next chapter, to find out how
1N/Ato actually install GRUB on your drive.
1N/A
1N/A
1N/AFile: grub.info, Node: Installation, Next: Booting, Prev: Naming convention, Up: Top
1N/A
1N/AInstallation
1N/A************
1N/A
1N/A In order to install GRUB as your boot loader, you need to first
1N/Ainstall the GRUB system and utilities under your UNIX-like operating
1N/Asystem (*note Obtaining and Building GRUB::). You can do this either
1N/Afrom the source tarball, or as a package for your OS.
1N/A
1N/A After you have done that, you need to install the boot loader on a
1N/Adrive (floppy or hard disk). There are two ways of doing that - either
1N/Ausing the utility `grub-install' (*note Invoking grub-install::) on a
1N/AUNIX-like OS, or by running GRUB itself from a floppy. These are quite
1N/Asimilar, however the utility might probe a wrong BIOS drive, so you
1N/Ashould be careful.
1N/A
1N/A Also, if you install GRUB on a UNIX-like OS, please make sure that
1N/Ayou have an emergency boot disk ready, so that you can rescue your
1N/Acomputer if, by any chance, your hard drive becomes unusable
1N/A(unbootable).
1N/A
1N/A GRUB comes with boot images, which are normally put in the directory
1N/A`/usr/lib/grub/i386-pc'. If you do not use grub-install, then you need
1N/Ato copy the files `stage1', `stage2', and `*stage1_5' to the directory
1N/A`/boot/grub', and run the `grub-set-default' (*note Invoking
1N/Agrub-set-default::) if you intend to use `default saved' (*note
1N/Adefault::) in your configuration file. Hereafter, the directory where
1N/AGRUB images are initially placed (normally `/usr/lib/grub/i386-pc')
1N/Awill be called the "image directory", and the directory where the boot
1N/Aloader needs to find them (usually `/boot/grub') will be called the
1N/A"boot directory".
1N/A
1N/A* Menu:
1N/A
1N/A* Creating a GRUB boot floppy::
1N/A* Installing GRUB natively::
1N/A* Installing GRUB using grub-install::
1N/A* Making a GRUB bootable CD-ROM::
1N/A
1N/A
1N/AFile: grub.info, Node: Creating a GRUB boot floppy, Next: Installing GRUB natively, Up: Installation
1N/A
1N/ACreating a GRUB boot floppy
1N/A===========================
1N/A
1N/A To create a GRUB boot floppy, you need to take the files `stage1'
1N/Aand `stage2' from the image directory, and write them to the first and
1N/Athe second block of the floppy disk, respectively.
1N/A
1N/A *Caution:* This procedure will destroy any data currently stored on
1N/Athe floppy.
1N/A
1N/A On a UNIX-like operating system, that is done with the following
1N/Acommands:
1N/A
1N/A # cd /usr/lib/grub/i386-pc
1N/A # dd if=stage1 of=/dev/fd0 bs=512 count=1
1N/A 1+0 records in
1N/A 1+0 records out
1N/A # dd if=stage2 of=/dev/fd0 bs=512 seek=1
1N/A 153+1 records in
1N/A 153+1 records out
1N/A #
1N/A
1N/A The device file name may be different. Consult the manual for your
1N/AOS.
1N/A
1N/A
1N/AFile: grub.info, Node: Installing GRUB natively, Next: Installing GRUB using grub-install, Prev: Creating a GRUB boot floppy, Up: Installation
1N/A
1N/AInstalling GRUB natively
1N/A========================
1N/A
1N/A *Caution:* Installing GRUB's stage1 in this manner will erase the
1N/Anormal boot-sector used by an OS.
1N/A
1N/A GRUB can currently boot GNU Mach, Linux, FreeBSD, NetBSD, and OpenBSD
1N/Adirectly, so using it on a boot sector (the first sector of a
1N/Apartition) should be okay. But generally, it would be a good idea to
1N/Aback up the first sector of the partition on which you are installing
1N/AGRUB's stage1. This isn't as important if you are installing GRUB on
1N/Athe first sector of a hard disk, since it's easy to reinitialize it
1N/A(e.g. by running `FDISK /MBR' from DOS).
1N/A
1N/A If you decide to install GRUB in the native environment, which is
1N/Adefinitely desirable, you'll need to create a GRUB boot disk, and
1N/Areboot your computer with it. Otherwise, see *Note Installing GRUB
1N/Ausing grub-install::.
1N/A
1N/A Once started, GRUB will show the command-line interface (*note
1N/ACommand-line interface::). First, set the GRUB's "root device"(1)
1N/A(*note Installing GRUB natively-Footnote-1::) to the partition
1N/Acontaining the boot directory, like this:
1N/A
1N/A grub> root (hd0,0)
1N/A
1N/A If you are not sure which partition actually holds this directory,
1N/Ause the command `find' (*note find::), like this:
1N/A
1N/A grub> find /boot/grub/stage1
1N/A
1N/A This will search for the file name `/boot/grub/stage1' and show the
1N/Adevices which contain the file.
1N/A
1N/A Once you've set the root device correctly, run the command `setup'
1N/A(*note setup::):
1N/A
1N/A grub> setup (hd0)
1N/A
1N/A This command will install the GRUB boot loader on the Master Boot
1N/ARecord (MBR) of the first drive. If you want to put GRUB into the boot
1N/Asector of a partition instead of putting it in the MBR, specify the
1N/Apartition into which you want to install GRUB:
1N/A
1N/A grub> setup (hd0,0)
1N/A
1N/A If you install GRUB into a partition or a drive other than the first
1N/Aone, you must chain-load GRUB from another boot loader. Refer to the
1N/Amanual for the boot loader to know how to chain-load GRUB.
1N/A
1N/A After using the setup command, you will boot into GRUB without the
1N/AGRUB floppy. See the chapter *Note Booting:: to find out how to boot
1N/Ayour operating systems from GRUB.
1N/A
1N/A
1N/AFile: grub.info, Node: Installing GRUB natively-Footnotes, Up: Installing GRUB natively
1N/A
1N/A (1) Note that GRUB's root device doesn't necessarily mean your OS's
1N/Aroot partition; if you need to specify a root partition for your OS,
1N/Aadd the argument into the command `kernel'.
1N/A
1N/A
1N/AFile: grub.info, Node: Installing GRUB using grub-install, Next: Making a GRUB bootable CD-ROM, Prev: Installing GRUB natively, Up: Installation
1N/A
1N/AInstalling GRUB using grub-install
1N/A==================================
1N/A
1N/A *Caution:* This procedure is definitely less safe, because there are
1N/Aseveral ways in which your computer can become unbootable. For example,
1N/Amost operating systems don't tell GRUB how to map BIOS drives to OS
1N/Adevices correctly--GRUB merely "guesses" the mapping. This will succeed
1N/Ain most cases, but not always. Therefore, GRUB provides you with a map
1N/Afile called the "device map", which you must fix if it is wrong. *Note
1N/ADevice map::, for more details.
1N/A
1N/A If you still do want to install GRUB under a UNIX-like OS (such as
1N/AGNU), invoke the program `grub-install' (*note Invoking grub-install::)
1N/Aas the superuser ("root").
1N/A
1N/A The usage is basically very simple. You only need to specify one
1N/Aargument to the program, namely, where to install the boot loader. The
1N/Aargument can be either a device file (like `/dev/hda') or a partition
1N/Aspecified in GRUB's notation. For example, under Linux the following
1N/Awill install GRUB into the MBR of the first IDE disk:
1N/A
1N/A # grub-install /dev/hda
1N/A
1N/A Likewise, under GNU/Hurd, this has the same effect:
1N/A
1N/A # grub-install /dev/hd0
1N/A
1N/A If it is the first BIOS drive, this is the same as well:
1N/A
1N/A # grub-install '(hd0)'
1N/A
1N/A Or you can omit the parentheses:
1N/A
1N/A # grub-install hd0
1N/A
1N/A But all the above examples assume that GRUB should use images under
1N/Athe root directory. If you want GRUB to use images under a directory
1N/Aother than the root directory, you need to specify the option
1N/A`--root-directory'. The typical usage is that you create a GRUB boot
1N/Afloppy with a filesystem. Here is an example:
1N/A
1N/A # mke2fs /dev/fd0
1N/A # mount -t ext2 /dev/fd0 /mnt
1N/A # grub-install --root-directory=/mnt fd0
1N/A # umount /mnt
1N/A
1N/A Another example is when you have a separate boot partition which is
1N/Amounted at `/boot'. Since GRUB is a boot loader, it doesn't know
1N/Aanything about mountpoints at all. Thus, you need to run `grub-install'
1N/Alike this:
1N/A
1N/A # grub-install --root-directory=/boot /dev/hda
1N/A
1N/A By the way, as noted above, it is quite difficult to guess BIOS
1N/Adrives correctly under a UNIX-like OS. Thus, `grub-install' will prompt
1N/Ayou to check if it could really guess the correct mappings, after the
1N/Ainstallation. The format is defined in *Note Device map::. Please be
1N/Aquite careful. If the output is wrong, it is unlikely that your
1N/Acomputer will be able to boot with no problem.
1N/A
1N/A Note that `grub-install' is actually just a shell script and the
1N/Areal task is done by the grub shell `grub' (*note Invoking the grub
1N/Ashell::). Therefore, you may run `grub' directly to install GRUB,
1N/Awithout using `grub-install'. Don't do that, however, unless you are
1N/Avery familiar with the internals of GRUB. Installing a boot loader on a
1N/Arunning OS may be extremely dangerous.
1N/A
1N/A
1N/AFile: grub.info, Node: Making a GRUB bootable CD-ROM, Prev: Installing GRUB using grub-install, Up: Installation
1N/A
1N/AMaking a GRUB bootable CD-ROM
1N/A=============================
1N/A
1N/A GRUB supports the "no emulation mode" in the El Torito
1N/Aspecification(1) (*note Making a GRUB bootable CD-ROM-Footnote-1::).
1N/AThis means that you can use the whole CD-ROM from GRUB and you don't
1N/Ahave to make a floppy or hard disk image file, which can cause
1N/Acompatibility problems.
1N/A
1N/A For booting from a CD-ROM, GRUB uses a special Stage 2 called
1N/A`stage2_eltorito'. The only GRUB files you need to have in your
1N/Abootable CD-ROM are this `stage2_eltorito' and optionally a config file
1N/A`menu.lst'. You don't need to use `stage1' or `stage2', because El
1N/ATorito is quite different from the standard boot process.
1N/A
1N/A Here is an example of procedures to make a bootable CD-ROM image.
1N/AFirst, make a top directory for the bootable image, say, `iso':
1N/A
1N/A $ mkdir iso
1N/A
1N/A Make a directory for GRUB:
1N/A
1N/A $ mkdir -p iso/boot/grub
1N/A
1N/A Copy the file `stage2_eltorito':
1N/A
1N/A $ cp /usr/lib/grub/i386-pc/stage2_eltorito iso/boot/grub
1N/A
1N/A If desired, make the config file `menu.lst' under `iso/boot/grub'
1N/A(*note Configuration::), and copy any files and directories for the
1N/Adisc to the directory `iso/'.
1N/A
1N/A Finally, make a ISO9660 image file like this:
1N/A
1N/A $ mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot \
1N/A -boot-load-size 4 -boot-info-table -o grub.iso iso
1N/A
1N/A This produces a file named `grub.iso', which then can be burned into
1N/Aa CD (or a DVD). `mkisofs' has already set up the disc to boot from
1N/Athe `boot/grub/stage2_eltorito' file, so there is no need to setup GRUB
1N/Aon the disc. (Note that the `-boot-load-size 4' bit is required for
1N/Acompatibility with the BIOS on many older machines.)
1N/A
1N/A You can use the device `(cd)' to access a CD-ROM in your config
1N/Afile. This is not required; GRUB automatically sets the root device to
1N/A`(cd)' when booted from a CD-ROM. It is only necessary to refer to
1N/A`(cd)' if you want to access other drives as well.
1N/A
1N/A
1N/AFile: grub.info, Node: Making a GRUB bootable CD-ROM-Footnotes, Up: Making a GRUB bootable CD-ROM
1N/A
1N/A (1) El Torito is a specification for bootable CD using BIOS
1N/Afunctions.
1N/A
1N/A
1N/AFile: grub.info, Node: Booting, Next: Configuration, Prev: Installation, Up: Top
1N/A
1N/ABooting
1N/A*******
1N/A
1N/A GRUB can load Multiboot-compliant kernels in a consistent way, but
1N/Afor some free operating systems you need to use some OS-specific magic.
1N/A
1N/A* Menu:
1N/A
1N/A* General boot methods:: How to boot OSes with GRUB generally
1N/A* OS-specific notes:: Notes on some operating systems
1N/A* Making your system robust:: How to make your system robust
1N/A
1N/A
1N/AFile: grub.info, Node: General boot methods, Next: OS-specific notes, Up: Booting
1N/A
1N/AHow to boot operating systems
1N/A=============================
1N/A
1N/A GRUB has two distinct boot methods. One of the two is to load an
1N/Aoperating system directly, and the other is to chain-load another boot
1N/Aloader which then will load an operating system actually. Generally
1N/Aspeaking, the former is more desirable, because you don't need to
1N/Ainstall or maintain other boot loaders and GRUB is flexible enough to
1N/Aload an operating system from an arbitrary disk/partition. However, the
1N/Alatter is sometimes required, since GRUB doesn't support all the
1N/Aexisting operating systems natively.
1N/A
1N/A* Menu:
1N/A
1N/A* Loading an operating system directly::
1N/A* Chain-loading::
1N/A
1N/A
1N/AFile: grub.info, Node: Loading an operating system directly, Next: Chain-loading, Up: General boot methods
1N/A
1N/AHow to boot an OS directly with GRUB
1N/A------------------------------------
1N/A
1N/A Multiboot (*note Multiboot Specification: (multiboot)Top.) is the
1N/Anative format supported by GRUB. For the sake of convenience, there is
1N/Aalso support for Linux, FreeBSD, NetBSD and OpenBSD. If you want to
1N/Aboot other operating systems, you will have to chain-load them (*note
1N/AChain-loading::).
1N/A
1N/A Generally, GRUB can boot any Multiboot-compliant OS in the following
1N/Asteps:
1N/A
1N/A 1. Set GRUB's root device to the drive where the OS images are stored
1N/A with the command `root' (*note root::).
1N/A
1N/A 2. Load the kernel image with the command `kernel' (*note kernel::).
1N/A
1N/A 3. If you need modules, load them with the command `module' (*note
1N/A module::) or `modulenounzip' (*note modulenounzip::).
1N/A
1N/A 4. Run the command `boot' (*note boot::).
1N/A
1N/A Linux, FreeBSD, NetBSD and OpenBSD can be booted in a similar
1N/Amanner. You load a kernel image with the command `kernel' and then run
1N/Athe command `boot'. If the kernel requires some parameters, just append
1N/Athe parameters to `kernel', after the file name of the kernel. Also,
1N/Aplease refer to *Note OS-specific notes::, for information on your
1N/AOS-specific issues.
1N/A
1N/A
1N/AFile: grub.info, Node: Chain-loading, Prev: Loading an operating system directly, Up: General boot methods
1N/A
1N/ALoad another boot loader to boot unsupported operating systems
1N/A--------------------------------------------------------------
1N/A
1N/A If you want to boot an unsupported operating system (e.g. Windows
1N/A95), chain-load a boot loader for the operating system. Normally, the
1N/Aboot loader is embedded in the "boot sector" of the partition on which
1N/Athe operating system is installed.
1N/A
1N/A 1. Set GRUB's root device to the partition by the command
1N/A `rootnoverify' (*note rootnoverify::):
1N/A
1N/A grub> rootnoverify (hd0,0)
1N/A
1N/A 2. Set the "active" flag in the partition using the command
1N/A `makeactive'(1) (*note Chain-loading-Footnote-1::) (*note
1N/A makeactive::):
1N/A
1N/A grub> makeactive
1N/A
1N/A 3. Load the boot loader with the command `chainloader' (*note
1N/A chainloader::):
1N/A
1N/A grub> chainloader +1
1N/A
1N/A `+1' indicates that GRUB should read one sector from the start of
1N/A the partition. The complete description about this syntax can be
1N/A found in *Note Block list syntax::.
1N/A
1N/A 4. Run the command `boot' (*note boot::).
1N/A
1N/A However, DOS and Windows have some deficiencies, so you might have to
1N/Ause more complicated instructions. *Note DOS/Windows::, for more
1N/Ainformation.
1N/A
1N/A
1N/AFile: grub.info, Node: Chain-loading-Footnotes, Up: Chain-loading
1N/A
1N/A (1) This is not necessary for most of the modern operating systems.
1N/A
1N/A
1N/AFile: grub.info, Node: OS-specific notes, Next: Making your system robust, Prev: General boot methods, Up: Booting
1N/A
1N/ASome caveats on OS-specific issues
1N/A==================================
1N/A
1N/A Here, we describe some caveats on several operating systems.
1N/A
1N/A* Menu:
1N/A
1N/A* GNU/Hurd::
1N/A* GNU/Linux::
1N/A* FreeBSD::
1N/A* NetBSD::
1N/A* OpenBSD::
1N/A* DOS/Windows::
1N/A* SCO UnixWare::
1N/A* QNX::
1N/A
1N/A
1N/AFile: grub.info, Node: GNU/Hurd, Next: GNU/Linux, Up: OS-specific notes
1N/A
1N/AGNU/Hurd
1N/A--------
1N/A
1N/A Since GNU/Hurd is Multiboot-compliant, it is easy to boot it; there
1N/Ais nothing special about it. But do not forget that you have to specify
1N/Aa root partition to the kernel.
1N/A
1N/A 1. Set GRUB's root device to the same drive as GNU/Hurd's. Probably
1N/A the command `find /boot/gnumach' or similar can help you (*note
1N/A find::).
1N/A
1N/A 2. Load the kernel and the module, like this:
1N/A
1N/A grub> kernel /boot/gnumach root=hd0s1
1N/A grub> module /boot/serverboot
1N/A
1N/A 3. Run the command `boot' (*note boot::).
1N/A
1N/A
1N/AFile: grub.info, Node: GNU/Linux, Next: FreeBSD, Prev: GNU/Hurd, Up: OS-specific notes
1N/A
1N/AGNU/Linux
1N/A---------
1N/A
1N/A It is relatively easy to boot GNU/Linux from GRUB, because it
1N/Asomewhat resembles to boot a Multiboot-compliant OS.
1N/A
1N/A 1. Set GRUB's root device to the same drive as GNU/Linux's. Probably
1N/A the command `find /vmlinuz' or similar can help you (*note find::).
1N/A
1N/A 2. Load the kernel:
1N/A
1N/A grub> kernel /vmlinuz root=/dev/hda1
1N/A
1N/A If you need to specify some kernel parameters, just append them to
1N/A the command. For example, to set `vga' to `ext', do this:
1N/A
1N/A grub> kernel /vmlinuz root=/dev/hda1 vga=ext
1N/A
1N/A See the documentation in the Linux source tree for complete
1N/A information on the available options.
1N/A
1N/A 3. If you use an initrd, execute the command `initrd' (*note
1N/A initrd::) after `kernel':
1N/A
1N/A grub> initrd /initrd
1N/A
1N/A 4. Finally, run the command `boot' (*note boot::).
1N/A
1N/A *Caution:* If you use an initrd and specify the `mem=' option to the
1N/Akernel to let it use less than actual memory size, you will also have
1N/Ato specify the same memory size to GRUB. To let GRUB know the size, run
1N/Athe command `uppermem' _before_ loading the kernel. *Note uppermem::,
1N/Afor more information.
1N/A
1N/A
1N/AFile: grub.info, Node: FreeBSD, Next: NetBSD, Prev: GNU/Linux, Up: OS-specific notes
1N/A
1N/AFreeBSD
1N/A-------
1N/A
1N/A GRUB can load the kernel directly, either in ELF or a.out format. But
1N/Athis is not recommended, since FreeBSD's bootstrap interface sometimes
1N/Achanges heavily, so GRUB can't guarantee to pass kernel parameters
1N/Acorrectly.
1N/A
1N/A Thus, we'd recommend loading the very flexible loader `/boot/loader'
1N/Ainstead. See this example:
1N/A
1N/A grub> root (hd0,a)
1N/A grub> kernel /boot/loader
1N/A grub> boot
1N/A
1N/A
1N/AFile: grub.info, Node: NetBSD, Next: OpenBSD, Prev: FreeBSD, Up: OS-specific notes
1N/A
1N/ANetBSD
1N/A------
1N/A
1N/A GRUB can load NetBSD a.out and ELF directly, follow these steps:
1N/A
1N/A 1. Set GRUB's root device with `root' (*note root::).
1N/A
1N/A 2. Load the kernel with `kernel' (*note kernel::). You should append
1N/A the ugly option `--type=netbsd', if you want to load an ELF
1N/A kernel, like this:
1N/A
1N/A grub> kernel --type=netbsd /netbsd-elf
1N/A
1N/A 3. Run `boot' (*note boot::).
1N/A
1N/A For now, however, GRUB doesn't allow you to pass kernel parameters,
1N/Aso it may be better to chain-load it instead. For more information,
1N/Aplease see *Note Chain-loading::.
1N/A
1N/A
1N/AFile: grub.info, Node: OpenBSD, Next: DOS/Windows, Prev: NetBSD, Up: OS-specific notes
1N/A
1N/AOpenBSD
1N/A-------
1N/A
1N/A The booting instruction is exactly the same as for NetBSD (*note
1N/ANetBSD::).
1N/A
1N/A
1N/AFile: grub.info, Node: DOS/Windows, Next: SCO UnixWare, Prev: OpenBSD, Up: OS-specific notes
1N/A
1N/ADOS/Windows
1N/A-----------
1N/A
1N/A GRUB cannot boot DOS or Windows directly, so you must chain-load them
1N/A(*note Chain-loading::). However, their boot loaders have some critical
1N/Adeficiencies, so it may not work to just chain-load them. To overcome
1N/Athe problems, GRUB provides you with two helper functions.
1N/A
1N/A If you have installed DOS (or Windows) on a non-first hard disk, you
1N/Ahave to use the disk swapping technique, because that OS cannot boot
1N/Afrom any disks but the first one. The workaround used in GRUB is the
1N/Acommand `map' (*note map::), like this:
1N/A
1N/A grub> map (hd0) (hd1)
1N/A grub> map (hd1) (hd0)
1N/A
1N/A This performs a "virtual" swap between your first and second hard
1N/Adrive.
1N/A
1N/A *Caution:* This is effective only if DOS (or Windows) uses BIOS to
1N/Aaccess the swapped disks. If that OS uses a special driver for the
1N/Adisks, this probably won't work.
1N/A
1N/A Another problem arises if you installed more than one set of
1N/ADOS/Windows onto one disk, because they could be confused if there are
1N/Amore than one primary partitions for DOS/Windows. Certainly you should
1N/Aavoid doing this, but there is a solution if you do want to do so. Use
1N/Athe partition hiding/unhiding technique.
1N/A
1N/A If GRUB "hide"s a DOS (or Windows) partition (*note hide::), DOS (or
1N/AWindows) will ignore the partition. If GRUB "unhide"s a DOS (or
1N/AWindows) partition (*note unhide::), DOS (or Windows) will detect the
1N/Apartition. Thus, if you have installed DOS (or Windows) on the first
1N/Aand the second partition of the first hard disk, and you want to boot
1N/Athe copy on the first partition, do the following:
1N/A
1N/A grub> unhide (hd0,0)
1N/A grub> hide (hd0,1)
1N/A grub> rootnoverify (hd0,0)
1N/A grub> chainloader +1
1N/A grub> makeactive
1N/A grub> boot
1N/A
1N/A
1N/AFile: grub.info, Node: SCO UnixWare, Next: QNX, Prev: DOS/Windows, Up: OS-specific notes
1N/A
1N/ASCO UnixWare
1N/A------------
1N/A
1N/A It is known that the signature in the boot loader for SCO UnixWare is
1N/Awrong, so you will have to specify the option `--force' to
1N/A`chainloader' (*note chainloader::), like this:
1N/A
1N/A grub> rootnoverify (hd1,0)
1N/A grub> chainloader --force +1
1N/A grub> makeactive
1N/A grub> boot
1N/A
1N/A
1N/AFile: grub.info, Node: QNX, Prev: SCO UnixWare, Up: OS-specific notes
1N/A
1N/AQNX
1N/A---
1N/A
1N/A QNX seems to use a bigger boot loader, so you need to boot it up,
1N/Alike this:
1N/A
1N/A grub> rootnoverify (hd1,1)
1N/A grub> chainloader +4
1N/A grub> boot
1N/A
1N/A
1N/AFile: grub.info, Node: Making your system robust, Prev: OS-specific notes, Up: Booting
1N/A
1N/AHow to make your system robust
1N/A==============================
1N/A
1N/A When you test a new kernel or a new OS, it is important to make sure
1N/Athat your computer can boot even if the new system is unbootable. This
1N/Ais crucial especially if you maintain servers or remote systems. To
1N/Aaccomplish this goal, you need to set up two things:
1N/A
1N/A 1. You must maintain a system which is always bootable. For instance,
1N/A if you test a new kernel, you need to keep a working kernel in a
1N/A different place. And, it would sometimes be very nice to even have
1N/A a complete copy of a working system in a different partition or
1N/A disk.
1N/A
1N/A 2. You must direct GRUB to boot a working system when the new system
1N/A fails. This is possible with the "fallback" system in GRUB.
1N/A
1N/A The former requirement is very specific to each OS, so this
1N/Adocumentation does not cover that topic. It is better to consult some
1N/Abackup tools.
1N/A
1N/A So let's see the GRUB part. There are two possibilities: one of them
1N/Ais quite simple but not very robust, and the other is a bit complex to
1N/Aset up but probably the best solution to make sure that your system can
1N/Astart as long as GRUB itself is bootable.
1N/A
1N/A* Menu:
1N/A
1N/A* Booting once-only::
1N/A* Booting fallback systems::
1N/A
1N/A
1N/AFile: grub.info, Node: Booting once-only, Next: Booting fallback systems, Up: Making your system robust
1N/A
1N/ABooting once-only
1N/A-----------------
1N/A
1N/A You can teach GRUB to boot an entry only at next boot time. Suppose
1N/Athat your have an old kernel `old_kernel' and a new kernel
1N/A`new_kernel'. You know that `old_kernel' can boot your system
1N/Acorrectly, and you want to test `new_kernel'.
1N/A
1N/A To ensure that your system will go back to the old kernel even if the
1N/Anew kernel fails (e.g. it panics), you can specify that GRUB should try
1N/Athe new kernel only once and boot the old kernel after that.
1N/A
1N/A First, modify your configuration file. Here is an example:
1N/A
1N/A default saved # This is important!!!
1N/A timeout 10
1N/A
1N/A title the old kernel
1N/A root (hd0,0)
1N/A kernel /old_kernel
1N/A savedefault
1N/A
1N/A title the new kernel
1N/A root (hd0,0)
1N/A kernel /new_kernel
1N/A savedefault 0 # This is important!!!
1N/A
1N/A Note that this configuration file uses `default saved' (*note
1N/Adefault::) at the head and `savedefault 0' (*note savedefault::) in the
1N/Aentry for the new kernel. This means that GRUB boots a saved entry by
1N/Adefault, and booting the entry for the new kernel saves `0' as the
1N/Asaved entry.
1N/A
1N/A With this configuration file, after all, GRUB always tries to boot
1N/Athe old kernel after it booted the new one, because `0' is the entry of
1N/A`the old kernel'.
1N/A
1N/A The next step is to tell GRUB to boot the new kernel at next boot
1N/Atime. For this, execute `grub-set-default' (*note Invoking
1N/Agrub-set-default::):
1N/A
1N/A # grub-set-default 1
1N/A
1N/A This command sets the saved entry to `1', that is, to the new kernel.
1N/A
1N/A This method is useful, but still not very robust, because GRUB stops
1N/Abooting, if there is any error in the boot entry, such that the new
1N/Akernel has an invalid executable format. Thus, it it even better to use
1N/Athe "fallback" mechanism of GRUB. Look at next subsection for this
1N/Afeature.
1N/A
1N/A
1N/AFile: grub.info, Node: Booting fallback systems, Prev: Booting once-only, Up: Making your system robust
1N/A
1N/ABooting fallback systems
1N/A------------------------
1N/A
1N/A GRUB supports a fallback mechanism of booting one or more other
1N/Aentries if a default boot entry fails. You can specify multiple
1N/Afallback entries if you wish.
1N/A
1N/A Suppose that you have three systems, `A', `B' and `C'. `A' is a
1N/Asystem which you want to boot by default. `B' is a backup system which
1N/Ais supposed to boot safely. `C' is another backup system which is used
1N/Ain case where `B' is broken.
1N/A
1N/A Then you may want GRUB to boot the first system which is bootable
1N/Aamong `A', `B' and `C'. A configuration file can be written in this way:
1N/A
1N/A default saved # This is important!!!
1N/A timeout 10
1N/A fallback 1 2 # This is important!!!
1N/A
1N/A title A
1N/A root (hd0,0)
1N/A kernel /kernel
1N/A savedefault fallback # This is important!!!
1N/A
1N/A title B
1N/A root (hd1,0)
1N/A kernel /kernel
1N/A savedefault fallback # This is important!!!
1N/A
1N/A title C
1N/A root (hd2,0)
1N/A kernel /kernel
1N/A savedefault
1N/A
1N/A Note that `default saved' (*note default::), `fallback 1 2' and
1N/A`savedefault fallback' are used. GRUB will boot a saved entry by
1N/Adefault and save a fallback entry as next boot entry with this
1N/Aconfiguration.
1N/A
1N/A When GRUB tries to boot `A', GRUB saves `1' as next boot entry,
1N/Abecause the command `fallback' specifies that `1' is the first fallback
1N/Aentry. The entry `1' is `B', so GRUB will try to boot `B' at next boot
1N/Atime.
1N/A
1N/A Likewise, when GRUB tries to boot `B', GRUB saves `2' as next boot
1N/Aentry, because `fallback' specifies `2' as next fallback entry. This
1N/Amakes sure that GRUB will boot `C' after booting `B'.
1N/A
1N/A It is noteworthy that GRUB uses fallback entries both when GRUB
1N/Aitself fails in booting an entry and when `A' or `B' fails in starting
1N/Aup your system. So this solution ensures that your system is started
1N/Aeven if GRUB cannot find your kernel or if your kernel panics.
1N/A
1N/A However, you need to run `grub-set-default' (*note Invoking
1N/Agrub-set-default::) when `A' starts correctly or you fix `A' after it
1N/Acrashes, since GRUB always sets next boot entry to a fallback entry.
1N/AYou should run this command in a startup script such as `rc.local' to
1N/Aboot `A' by default:
1N/A
1N/A # grub-set-default 0
1N/A
1N/A where `0' is the number of the boot entry for the system `A'.
1N/A
1N/A If you want to see what is current default entry, you can look at the
1N/Afile `/boot/grub/default' (or `/grub/default' in some systems). Because
1N/Athis file is plain-text, you can just `cat' this file. But it is
1N/Astrongly recommended *not to modify this file directly*, because GRUB
1N/Amay fail in saving a default entry in this file, if you change this
1N/Afile in an unintended manner. Therefore, you should use
1N/A`grub-set-default' when you need to change the default entry.
1N/A
1N/A
1N/AFile: grub.info, Node: Configuration, Next: Network, Prev: Booting, Up: Top
1N/A
1N/AConfiguration
1N/A*************
1N/A
1N/A You've probably noticed that you need to type several commands to
1N/Aboot your OS. There's a solution to that - GRUB provides a menu
1N/Ainterface (*note Menu interface::) from which you can select an item
1N/A(using arrow keys) that will do everything to boot an OS.
1N/A
1N/A To enable the menu, you need a configuration file, `menu.lst' under
1N/Athe boot directory. We'll analyze an example file.
1N/A
1N/A The file first contains some general settings, the menu interface
1N/Arelated options. You can put these commands (*note Menu-specific
1N/Acommands::) before any of the items (starting with `title' (*note
1N/Atitle::)).
1N/A
1N/A #
1N/A # Sample boot menu configuration file
1N/A #
1N/A
1N/A As you may have guessed, these lines are comments. Lines starting
1N/Awith a hash character (`#'), and blank lines, are ignored by GRUB.
1N/A
1N/A # By default, boot the first entry.
1N/A default 0
1N/A
1N/A The first entry (here, counting starts with number zero, not one!)
1N/Awill be the default choice.
1N/A
1N/A # Boot automatically after 30 secs.
1N/A timeout 30
1N/A
1N/A As the comment says, GRUB will boot automatically in 30 seconds,
1N/Aunless interrupted with a keypress.
1N/A
1N/A # Fallback to the second entry.
1N/A fallback 1
1N/A
1N/A If, for any reason, the default entry doesn't work, fall back to the
1N/Asecond one (this is rarely used, for obvious reasons).
1N/A
1N/A Note that the complete descriptions of these commands, which are menu
1N/Ainterface specific, can be found in *Note Menu-specific commands::.
1N/AOther descriptions can be found in *Note Commands::.
1N/A
1N/A Now, on to the actual OS definitions. You will see that each entry
1N/Abegins with a special command, `title' (*note title::), and the action
1N/Ais described after it. Note that there is no command `boot' (*note
1N/Aboot::) at the end of each item. That is because GRUB automatically
1N/Aexecutes `boot' if it loads other commands successfully.
1N/A
1N/A The argument for the command `title' is used to display a short
1N/Atitle/description of the entry in the menu. Since `title' displays the
1N/Aargument as is, you can write basically anything there.
1N/A
1N/A # For booting GNU/Hurd
1N/A title GNU/Hurd
1N/A root (hd0,0)
1N/A kernel /boot/gnumach.gz root=hd0s1
1N/A module /boot/serverboot.gz
1N/A
1N/A This boots GNU/Hurd from the first hard disk.
1N/A
1N/A # For booting GNU/Linux
1N/A title GNU/Linux
1N/A kernel (hd1,0)/vmlinuz root=/dev/hdb1
1N/A
1N/A This boots GNU/Linux, but from the second hard disk.
1N/A
1N/A # For booting Mach (getting kernel from floppy)
1N/A title Utah Mach4 multiboot
1N/A root (hd0,2)
1N/A pause Insert the diskette now^G!!
1N/A kernel (fd0)/boot/kernel root=hd0s3
1N/A module (fd0)/boot/bootstrap
1N/A
1N/A This boots Mach with a kernel on a floppy, but the root filesystem at
1N/Ahd0s3. It also contains a `pause' line (*note pause::), which will
1N/Acause GRUB to display a prompt and delay, before actually executing the
1N/Arest of the commands and booting.
1N/A
1N/A # For booting FreeBSD
1N/A title FreeBSD
1N/A root (hd0,2,a)
1N/A kernel /boot/loader
1N/A
1N/A This item will boot FreeBSD kernel loaded from the `a' partition of
1N/Athe third PC slice of the first hard disk.
1N/A
1N/A # For booting OS/2
1N/A title OS/2
1N/A root (hd0,1)
1N/A makeactive
1N/A # chainload OS/2 bootloader from the first sector
1N/A chainloader +1
1N/A # This is similar to "chainload", but loads a specific file
1N/A #chainloader /boot/chain.os2
1N/A
1N/A This will boot OS/2, using a chain-loader (*note Chain-loading::).
1N/A
1N/A # For booting Windows NT or Windows95
1N/A title Windows NT / Windows 95 boot menu
1N/A root (hd0,0)
1N/A makeactive
1N/A chainloader +1
1N/A # For loading DOS if Windows NT is installed
1N/A # chainload /bootsect.dos
1N/A
1N/A The same as the above, but for Windows.
1N/A
1N/A # For installing GRUB into the hard disk
1N/A title Install GRUB into the hard disk
1N/A root (hd0,0)
1N/A setup (hd0)
1N/A
1N/A This will just (re)install GRUB onto the hard disk.
1N/A
1N/A # Change the colors.
1N/A title Change the colors
1N/A color light-green/brown blink-red/blue
1N/A
1N/A In the last entry, the command `color' is used (*note color::), to
1N/Achange the menu colors (try it!). This command is somewhat special,
1N/Abecause it can be used both in the command-line and in the menu. GRUB
1N/Ahas several such commands, see *Note General commands::.
1N/A
1N/A We hope that you now understand how to use the basic features of
1N/AGRUB. To learn more about GRUB, see the following chapters.
1N/A
1N/A
1N/AFile: grub.info, Node: Network, Next: Serial terminal, Prev: Configuration, Up: Top
1N/A
1N/ADownloading OS images from a network
1N/A************************************
1N/A
1N/A Although GRUB is a disk-based boot loader, it does provide network
1N/Asupport. To use the network support, you need to enable at least one
1N/Anetwork driver in the GRUB build process. For more information please
1N/Asee `netboot/README.netboot' in the source distribution.
1N/A
1N/A* Menu:
1N/A
1N/A* General usage of network support::
1N/A* Diskless::
1N/A
1N/A
1N/AFile: grub.info, Node: General usage of network support, Next: Diskless, Up: Network
1N/A
1N/AHow to set up your network
1N/A==========================
1N/A
1N/A GRUB requires a file server and optionally a server that will assign
1N/Aan IP address to the machine on which GRUB is running. For the former,
1N/Aonly TFTP is supported at the moment. The latter is either BOOTP, DHCP
1N/Aor a RARP server(1) (*note General usage of network
1N/Asupport-Footnote-1::). It is not necessary to run both the servers on
1N/Aone computer. How to configure these servers is beyond the scope of this
1N/Adocument, so please refer to the manuals specific to those
1N/Aprotocols/servers.
1N/A
1N/A If you decided to use a server to assign an IP address, set up the
1N/Aserver and run `bootp' (*note bootp::), `dhcp' (*note dhcp::) or `rarp'
1N/A(*note rarp::) for BOOTP, DHCP or RARP, respectively. Each command will
1N/Ashow an assigned IP address, a netmask, an IP address for your TFTP
1N/Aserver and a gateway. If any of the addresses is wrong or it causes an
1N/Aerror, probably the configuration of your servers isn't set up properly.
1N/A
1N/A Otherwise, run `ifconfig', like this:
1N/A
1N/A grub> ifconfig --address=192.168.110.23 --server=192.168.110.14
1N/A
1N/A You can also use `ifconfig' in conjuction with `bootp', `dhcp' or
1N/A`rarp' (e.g. to reassign the server address manually). *Note
1N/Aifconfig::, for more details.
1N/A
1N/A Finally, download your OS images from your network. The network can
1N/Abe accessed using the network drive `(nd)'. Everything else is very
1N/Asimilar to the normal instructions (*note Booting::).
1N/A
1N/A Here is an example:
1N/A
1N/A grub> bootp
1N/A Probing... [NE*000]
1N/A NE2000 base ...
1N/A Address: 192.168.110.23 Netmask: 255.255.255.0
1N/A Server: 192.168.110.14 Gateway: 192.168.110.1
1N/A
1N/A grub> root (nd)
1N/A grub> kernel /tftproot/gnumach.gz root=sd0s1
1N/A grub> module /tftproot/serverboot.gz
1N/A grub> boot
1N/A
1N/A
1N/AFile: grub.info, Node: General usage of network support-Footnotes, Up: General usage of network support
1N/A
1N/A (1) RARP is not advised, since it cannot serve much information
1N/A