Add externs to avoid multiple definitions, and then add missing definitions.
[rrq/maintain_lilo.git] / doc / user.tex
1 %
2 % Copyright 1992-1998 by Werner Almesberger.
3 % Copyright 1999-2000 by John R. Coffman (version 21-3)
4 % All rights reserved.
5 %
6 % See file COPYING for details.
7 %
8
9 %%def%:=
10 %:\begin{verbatim}
11 %:LILO - Generic Boot Loader for Linux ("LInux LOader") by Werner Almesberger
12 %:===========================================================================
13 %:
14 %:   NOTE:  This document is no longer maintained.  However, it is
15 %:   still current.  Changes to LILO for versions 21.2 and later are
16 %:   documented in detail in the 'man' pages for 'lilo' and 'lilo.conf'.
17 %:   Refer to them first, then to this document.
18 %:
19 %:  
20 %:Version 21-4 (release) -- John Coffman <johninsd@san.rr.com>
21 %:
22 %:Minor changes suggested by Werner to show that this release is derived
23 %:from the source code to his version 21.  Added VERSION_MAJOR and 
24 %:VERSION_MINOR to replace VERSION.  The file VERSION is replaced by 
25 %:'version.h'.
26 %:
27 %:The first and second stage loaders have been modified so that ONLY
28 %:'lba32' will use EDD packet calls.  'linear' will now always ask the
29 %:BIOS for the disk geometry, and then use C:H:S addressing.
30 %:
31 %:
32 %:Version 21-2  -- John Coffman <johninsd@san.rr.com>
33 %:
34 %:This version was created to allow booting on disks larger than 8.4Gb using
35 %:the Enhanced BIOS call (int 0x13, AH=0x42) and the packet-call interface.
36 %:These calls are supported on post-1998 systems, and through software BIOS
37 %:extensions such as EZ-DRIVE(tm).  
38 %:
39 %:My primary objective in making these changes to LILO, is not to break any-
40 %:thing.  Hence, the 32-bit direct addressing of sectors is supported by a
41 %:new keyword in the 'lilo.conf' file:  "lba32".  This keyword is mutually
42 %:exclusive with the keyword "linear".  On the command line, these options
43 %:are invoked with the new "-L" switch, or the old "-l" switch, respectively.
44 %:
45 %:Apologies to Werner Almesberger for not communicating these changes/addi-
46 %:tions to him directly; but I have not been able to contact him by e-mail
47 %:at the address he provided in the latest 'lilo.lsm' file.  I do not want
48 %:versions of LILO to get out-of-step.
49 %:
50 %:Disk sector addresses are conveyed from the Map Installer (lilo executable)
51 %:to the boot loaders, first- and second-stages through a 5 byte structure:
52 %:
53 %:     sector    [1..63] plus 2 high bits of Cylinder
54 %:     cylinder  [0..1023] low eight bits in this byte
55 %:     device    [0..3] for floppies, [0x80..0x8F] for hard disks
56 %:     head      [0..254] no, the max is 254, not 255
57 %:     count     [1...] number of sectors to transfer
58 %:     
59 %:The first two bytes are normally loaded into the CX register, the second two
60 %:bytes into the DX register, and the last byte into the AL register.  This is
61 %:the call used for the C:H:S addressing scheme of the original IBM-PC BIOS.
62 %:LILO checks that the 64Kb DMA boundary is never crossed by a call, and that
63 %:the count never exceeds the sector count of one track on the disk.
64 %:
65 %:When 'linear' is specified, a 24-bit, 0 based addressing scheme is employed.
66 %:The low 8 bits are in 'sector'; the middle 8 bits in 'cylinder'; and the high
67 %:8 bits are in 'head'.  To flag this as a 'linear' address, the 'device' byte
68 %:has bit 6 set (mask 0x40 or'ed in).  The count field is a maximum of 128,
69 %:since anything greater would cross a 64Kb DMA boundary.  It is up to the 
70 %:loader code (second stage only), to check that no track boundary is crossed.
71 %:
72 %:The situation is more complicated with 'lba32' addressing.  It is flagged with
73 %:bit 5 of the 'device' byte being set (mask 0x20 or'ed in).  The 32-bit address
74 %:is spread over the 'sector', 'cylinder', 'head', and 'count' fields, from low
75 %:byte to high byte, respectively.  Whenever this full 32-bit address is
76 %:specified explicitly, the actual sector count to transfer is implied to be
77 %:one (1), and this fact is flagged in the 'device' byte by setting bit 5
78 %:(mask 0x10 or'ed in).  When a multi-sector transfer is called for, the high
79 %:8-bits of the address are NOT specified explicitly, but are assumed to be
80 %:the same as the previous transfer, the 'count' of sectors to transfer will
81 %:be in the range [2..127], and bit 5 (mask 0x10) of the 'device' byte will be
82 %:clear.
83 %:
84 %:The first-stage loader uses single sector transfers only, so it uses a
85 %:simplified disk read routine, always assumes a sector transfer count of 1,
86 %:and always assumes that the full 32-bit address of the sector is specified
87 %:when 'lba32' mode is detected in the 'device' byte.  However, the second-
88 %:stage loader is capable of multi-sector transfers when map-compaction has
89 %:been used (-c switch, or 'compact' global option), so it uses the fully
90 %:capable read routine to load the -initrd- image, and the -kernel- image.
91 %:
92 %:Both 'linear' and 'lba32' will use the Enhanced BIOS packet calls, if they
93 %:are available.  Otherwise, the disk address is converted to C:H:S, using the
94 %:disk geometry returned by (int 0x13, AH=8).  If cylinder overflow occurs --
95 %:i.e., cylinder > 1023, then error code '9f' is issued.
96 %:
97 %:The BIOS calls used to implement large disk booting conform to the Enhanced
98 %:Disk Drive Specification, version 3.0, rev 0.8, dated March 12, 1998.  This
99 %:document is available on-line from Phoenix Technologies Ltd., at:
100 %:   
101 %:   http://www.phoenix.com/products/specs.html
102 %:
103 %:Known bugs:
104 %:   The chain loader, 'os2_d.b', still will not boot OS2 4.0 from a secondary
105 %:   partition on my "D:" drive.  Boot Manager can, and I am still working on
106 %:   the problem.
107 %:----------------------------------------------------------------------------
108 %:
109 %:
110 %:Version 21
111 %:
112 %:Important: The file INCOMPAT contains vital (in)compatibility information
113 %:           for this release of LILO. Read it before proceeding.
114 %:
115 %:Installing boot loaders is inherently dangerous. Be sure to have some means
116 %:to boot your system from a different media if you install LILO on your hard
117 %:disk.
118 %:
119 %:
120 %:There is also a LaTeX version of this document in the "doc" directory.
121 %:It is much nicer to read than pure ASCII.
122 %:
123 %:
124 %:Installation
125 %:------------
126 %:
127 %:Please read the file INCOMPAT for compatibility notes.
128 %:
129 %:The installation procedure is described in the section "Normal first-time
130 %:installation". Please read "Booting basics" for the whole story.
131 %:
132 %:*** QUICK INSTALLATION ***
133 %:
134 %:    If you want to install LILO on your hard disk and if you don't want
135 %:    to use all its features, you can use the quick installation script.
136 %:    Read QuickInst for details.
137 %:
138 %:
139 %:\end{verbatim}
140
141 %%beginskip
142
143 \documentclass[fullpage]{article}
144 \usepackage{ae}
145 \usepackage[bookmarks,%
146         pdftitle={Linux Loader (LILO) user manual},%
147         pdfsubject={Booting on iA32 architecture},%
148         pdfkeywords={lilo, boot},%
149         pdfauthor={Werner Almesberger, John Coffman}]%
150         {hyperref}
151 \usepackage{ifpdf}
152
153 \parindent=0pt
154 \parskip=4pt
155 \tolerance=9000
156
157 \hyphenation{hexa-decimal}
158
159 % Okay, what follows is more TeX than LaTeX ...
160
161 \def\hditem#1{\hbox to 1.2in{#1\hfil}}
162 \def\boottwo#1{$$
163   \bf
164   \begin{tabular}{|ll|}
165     \hline
166     \hditem{\rm Master Boot Record} & \hditem{\rm Operating system} \\
167     \hline
168     #1 \\
169     \hline
170   \end{tabular}
171   $$}
172
173 \def\bootthree#1{$$
174   \bf
175   \begin{tabular}{|lll|}
176     \hline
177     \hditem{\rm Master Boot Record} & \hditem{\rm Boot sector} &
178       \hditem{\rm Operating system} \\
179     \hline
180     #1 \\
181     \hline
182   \end{tabular}
183   $$}
184
185 \def\bootfour#1{$$
186   \bf
187   \begin{tabular}{|llll|}
188     \hline
189     \hditem{\rm Master Boot Record} & \hbox to 1.1in{\rm Boot sector\hfil} &
190       \hditem{\rm Operating systems} & \hbox to 0.4in{\hfil} \\
191     \hline
192     #1 \\
193     \hline
194   \end{tabular}
195   $$}
196 \def\sep{\rightarrowfill &}
197 \def\emptys{&}
198 \def\branch{\hfill$\longrightarrow$ &}
199 \def\cont{---\,$\cdots$}
200 \def\key#1{$[$#1$]$}
201 \def\LILO{LILO}
202 \def\meta#1{{\it #1\/}} % ... <blah> ...
203 \def\path#1{{\tt #1}}   % ... /foo/bar ...
204 \def\raw#1{{\tt #1}}    % ...  raw output  ...
205 \def\craw#1{{\tt #1}}   % ...  raw output  ...
206 \def\name#1{{\sf #1}}   % ... FooBar ...
207 \def\emphasize#1{{\bf #1}} % ... _don't_ ...
208 \def\unit#1{\hbox{\tt #1}} % ... \unit{-x foo} ...
209 %%def\\key{([^{}]*)}=[$1]
210 %%def\\LILO=LILO
211 %%def\\meta{([^{}]*)}=<$1>
212 %%def\\path{([^{}]*)}=$1
213 %%def\\raw{([^{}]*)}=~$1~
214 %%cmd\\craw{([^{}]*)}=((($x = $1) =~ tr/a-z/A-Z/), $x)
215 %%def\\name{={
216 %%def\\emphasize{([^{}]*)}=\\_$1\\_
217 %%def\\underline{([^{}]*)}=$1
218 %%def\\begin{command}=\\raw{$SI$SI$SI$SI
219 %%def\\end{command}=$SO$SO$SO$SO}
220 %%def\\addtocounter{([^{}]*)}{([^{}]*)}=~
221 %%def\\hbox{([^{}]*)}=$1
222 %%def(\\unit{[^{} ]*) ([^{}]*})=$1~$2
223 %%def\\unit{([^{} ]*)}=$1
224 %%def{\$([^{}])\$}=$1
225 %%def%4=    
226 %       ^^^^
227 %       four invisible spaces here
228 %%def%;=        
229 %       ^^^^^^^^
230 %       eight invisible spaces here
231
232 \newenvironment{command}{\def\[{$\bigl[$}\def\]{$\bigr]$}\def\|{$\big\vert$}%
233   \parindent=-2em\advance\leftskip by -\parindent\vskip -\parskip~\par
234   \begingroup\tt\textfont0=\font}{%
235   ~\endgroup\par\advance\hoffset by \parindent}
236
237 \begin{document}
238
239 \title{\LILO \\
240   \Large
241   Generic boot loader for Linux \\
242   Version 21 \\ ~\\
243   \bf User's guide}
244 \author{Werner Almesberger \\
245   {\tt Werner.Almesberger@epfl.ch}}
246 \date{December 4, 1998}
247
248 \maketitle
249 {
250   \parskip=-1pt
251   \setcounter{tocdepth}{2}
252   \tableofcontents
253 }
254 %%endskip
255
256 ~\\
257 \LILO\ is a versatile boot loader for Linux. It does not depend on a specific
258 file system, can boot Linux kernel images from
259 floppy disks and from hard disks and can even act as a ``boot manager'' for
260 other operating
261 systems.\footnote{PC/MS-DOS, DR DOS, OS/2, Windows 95, Windows NT, 386BSD,
262 SCO UNIX, Unixware, $\ldots$}
263
264 One of up to sixteen different images can be selected at boot time.
265 Various parameters, such as the root
266 device, can be set independently for each kernel. \LILO\ can even be
267 used as the master boot record.
268
269 This document introduces the basics of disk organization and booting,
270 continues with an overview of common boot techniques and finally describes
271 installation and use of \LILO\ in greater detail. The troubleshooting
272 section at the end describes diagnostic messages and contains suggestions
273 for most problems that have been observed in the past.
274
275 Please read at least the sections about installation and configuration if
276 you're already using an older version of \LILO. This distribution is
277 accompanied by a file named \path{INCOMPAT} that describes further
278 incompatibilities to older versions.
279
280 For the impatient: there is a quick-installation script to create
281 a simple but quite usable installation. See section \ref{quickinst} for
282 details.
283
284 But wait $\ldots$ here are a few easy rules that will help you to avoid
285 most problems people experience with \LILO:
286
287 \begin{itemize}
288   \item \emphasize{Don't panic.} If something doesn't work, try to find
289     out what is wrong, try to verify your assumption and only then attempt
290     to fix it.
291   \item Read the documentation. Especially if what the system does doesn't
292     correspond to what you think it should do.
293   \item Make sure you have an emergency boot disk, that you know how to
294     use it, and that it is always kept up to date.
295   \item Run \path{/sbin/lilo} \emphasize{whenever} the kernel or any part
296     of \LILO, including its configuration file, has changed. When in doubt,
297     run it. You can't run \path{/sbin/lilo} too many times.
298   \item If performing a destructive upgrade and/or erasing your Linux
299     partitions, de-install \LILO\ \emphasize{before} that if using it as the
300     MBR.
301   \item Don't trust setup scripts. Always verify the \path{/etc/lilo.conf}
302     they create before booting.
303   \item If using a big disk, be prepared for inconveniences: you may have
304     to use the \craw{linear} option.
305 \end{itemize}
306
307
308 \newpage
309 \subsection*{System overview}
310
311 \LILO\ is a collection of several programs and other files:
312
313 \begin{description}
314   \item[The map installer] is the program you run under Linux to put all
315     files belonging to \LILO\ at the appropriate places and to record
316     information about the location of data needed at boot time. This program
317     normally resides in \path{/sbin/lilo}. It has to be run to refresh that
318     information whenever any part of the system that \LILO\ knows about
319     changes, e.g. after installing a new kernel.
320   \item[Various files] contain data \LILO\ needs at boot time, e.g. the
321     boot loader. Those files normally reside in \path{/boot}. The most
322     important files are the boot loader (see below) and the map file
323     (\path{/boot/map}), where the map installer records the location of
324     the kernel(s).\footnote{\LILO\ does not know how to read a file system.
325     Instead, the map installer asks the kernel for the physical location of
326     files (e.g. the kernel image(s)) and records that information. This
327     allows \LILO\ to work with most file systems that are supported by
328     Linux.} Another important file is the configuration file, which is
329     normally called \path{/etc/lilo.conf}
330   \item[The boot loader] is the part of \LILO\ that is loaded by the BIOS
331     and that loads kernels or the boot sectors of other operating systems.
332     It also provides a simple command-line interface to interactively
333     select the item to boot and to add boot options.
334 \end{description}
335
336 \LILO\ primarily accesses the following parts of the system:
337
338 \begin{description}
339   \item[The root file system partition] is important for two reasons: first,
340     \LILO\ sometimes has to tell the kernel where to look for it. Second, it
341     is frequently a convenient place for many other items \LILO\ uses, such
342     as the boot sector, the \path{/boot} directory, and the kernels.
343   \item[The boot sector] contains the first part of \LILO's boot loader. It
344     loads the much larger second-stage loader. Both loaders are typically
345     stored in the file \path{/boot/boot.b}
346   \item[The kernel] is loaded and started by the boot loader. Kernels
347     typically reside in the root directory or in \path{/boot}.
348 \end{description}
349
350 Note that many of the files \LILO\ needs at boot time have to be accessible
351 with the BIOS. This creates certain restrictions, see section \ref{broken}.
352
353
354 \newpage
355 \section{Introduction}
356
357 The following sections describe how PCs
358 boot in general and what has to be known when booting Linux and using
359 \LILO\ in particular.
360
361
362 \subsection{Disk organization}
363 \label{diskorg}
364
365 When designing a boot concept, it is important to understand some of the
366 subtleties of how PCs typically organize disks. The most simple case are
367 floppy disks. They consist of a boot sector, some administrative
368 data (FAT or super block, etc.) and the data area. Because that
369 administrative data is irrelevant as far as booting is concerned, it is
370 regarded as part of the data area for simplicity.
371
372 %%beginskip
373 $$
374 \begin{tabular}{|c|c|}
375   \hline
376   Boot sector & \hbox to 1.5in{\hfil} \\
377   \cline{1-1}
378   \multicolumn{2}{|c|}{} \\
379   \multicolumn{2}{|c|}{Data area} \\
380   \multicolumn{2}{|c|}{} \\
381   \hline
382   \end{tabular}
383 $$
384 %%endskip
385 %:\begin{verbatim}
386 %;    +---------------------------+
387 %;    |Boot sector|               |
388 %;    |-----------+               |
389 %;    |                           |
390 %;    |         Data area         |
391 %;    |                           |
392 %;    |                           |
393 %;    +---------------------------+
394 %:\end{verbatim}
395
396 The entire disk appears as one device (e.g. \path{/dev/fd0}) on Linux.
397
398 The MS-DOS boot sector has the following structure:
399
400 %%beginskip
401 $$
402 \begin{tabular}{r|c|}
403   \cline{2-2}
404   \tt 0x000 & Jump to the program code\\
405   \cline{2-2}
406   \tt 0x003 & \\
407   & Disk parameters \\
408   & \\
409   \cline{2-2}
410   \tt 0x02C/0x03E & \\
411   & Program code \\
412   & \\
413   & \\
414   \cline{2-2}
415   \tt 0x1FE & Magic number (0xAA55)\\
416   \cline{2-2}
417 \end{tabular}
418 $$
419 %%endskip
420 %:\begin{verbatim}
421 %;            +------------------------+
422 %;      0x000 |Jump to the program code|
423 %;            |------------------------|
424 %;      0x003 |                        |
425 %;            |    Disk parameters     |
426 %;            |                        |
427 %;            |------------------------|
428 %;0x02C/0x03E |                        |
429 %;            |      Program code      |
430 %;            |                        |
431 %;            |                        |
432 %;            |------------------------|
433 %;      0x1FE | Magic number (0xAA55)  |
434 %;            +------------------------+
435 %:\end{verbatim}
436
437 \LILO\ uses a similar boot sector, but it does not contain the disk
438 parameters part. This is no problem for Minix, Ext2 or similar file systems,
439 because
440 they don't look at the boot sector, but putting a \LILO\ boot sector on an
441 MS-DOS file system would make it inaccessible for MS-DOS.
442
443 Hard disks are organized in a more complex way than floppy disks. They
444 contain several data areas called partitions. Up to four so-called
445 primary partitions can exist on an MS-DOS hard disk. If more partitions
446 are needed, one primary partition is used as an extended partition that
447 contains several logical partitions.
448
449 The first sector of each hard disk contains a partition table, and an
450 extended partition and \emphasize{each} logical partition contains a partition
451 table too.
452
453 %%beginskip
454 $$
455 \begin{tabular}{|l|l|l|}
456   \hline
457   \multicolumn{3}{|l|}{Partition table\hbox to 2in{\hfil\tt /dev/hda~}} \\
458   \cline{2-3}
459   & \multicolumn{2}{l|}{Partition 1\hfill {\tt /dev/hda1}} \\
460   & \multicolumn{2}{l|}{} \\
461   \cline{2-3}
462   & \multicolumn{2}{l|}{Partition 2\hfill {\tt /dev/hda2}} \\
463   & \multicolumn{2}{l|}{} \\
464   \hline
465 \end{tabular}
466 $$
467 %%endskip
468 %:\begin{verbatim}
469 %;+--------------------------------------------+
470 %;| Partition table                  /dev/hda  |
471 %;| +------------------------------------------|
472 %;| | Partition 1                    /dev/hda1 |
473 %;| |                                          |
474 %;| |------------------------------------------|
475 %;| | Partition 2                    /dev/hda2 |
476 %;| |                                          |
477 %;+--------------------------------------------+
478 %:\end{verbatim}
479
480 The entire disk can be accessed as \path{/dev/hda}, \path{/dev/hdb},
481 \path{/dev/sda}, etc. The primary partitions are \path{/dev/hda1 $\ldots$
482 /dev/hda4}.
483
484 %%beginskip
485 $$
486 \begin{tabular}{|l|l|l|}
487   \hline
488   \multicolumn{3}{|l|}{Partition table\hbox to 2in{\hfil\tt /dev/hda~}} \\
489   \cline{2-3}
490   & \multicolumn{2}{l|}{Partition 1\hfill {\tt /dev/hda1}} \\
491   & \multicolumn{2}{l|}{} \\
492   \cline{2-3}
493   & \multicolumn{2}{l|}{Partition 2\hfill {\tt /dev/hda2}} \\
494   & \multicolumn{2}{l|}{} \\
495   \cline{2-3}
496   & \multicolumn{2}{l|}{Extended partition\hfill {\tt /dev/hda3}} \\
497   \cline{3-3}
498   & & Extended partition table \\
499   \cline{3-3}
500   & & Partition 3\hfill {\tt /dev/hda5}\\
501   & & \\
502   \cline{3-3}
503   & & Extended partition table \\
504   \cline{3-3}
505 & & Partition 4\hfill {\tt /dev/hda6}\\
506   & & \\
507   \hline
508 \end{tabular}
509 $$
510 %%endskip
511 %:\begin{verbatim}
512 %;+--------------------------------------------+
513 %;| Partition table                  /dev/hda  |
514 %;| +------------------------------------------|
515 %;| | Partition 1                    /dev/hda1 |
516 %;| |                                          |
517 %;| |------------------------------------------|
518 %;| | Partition 2                    /dev/hda2 |
519 %;| |                                          |
520 %;| |------------------------------------------|
521 %;| | Extended partition             /dev/hda3 |
522 %;| | +----------------------------------------|
523 %;| | | Extended partition table               |
524 %;| | |----------------------------------------|
525 %;| | | Partition 3                  /dev/hda5 |
526 %;| | |                                        |
527 %;| | |----------------------------------------|
528 %;| | | Extended partition table               |
529 %;| | |----------------------------------------|
530 %;| | | Partition 4                  /dev/hda6 |
531 %;| | |                                        |
532 %;+--------------------------------------------+
533 %:\end{verbatim}
534
535 This hard disk has two primary partitions and an extended partition
536 that contains two logical partitions. They are accessed as
537 \path{/dev/hda5 $\ldots$}
538
539 Note that the partition tables of logical partitions are not accessible
540 as the first blocks of some devices, while the main partition table,
541 all boot sectors and the partition tables of extended partitions are.
542
543 Partition tables are stored in partition boot sectors. Normally, only the
544 partition boot sector of the entire disk is used as a boot sector. It is
545 also frequently called the master boot record (MBR). Its structure is as
546 follows:
547
548 %%beginskip
549 $$
550 \begin{tabular}{r|c|}
551   \cline{2-2}
552   \tt 0x000 & \\
553   & Program code \\
554   & \\
555   & \\
556   \cline{2-2}
557   \tt 0x1BE & Partition table \\
558   & \\
559   \cline{2-2}
560   \tt 0x1FE & Magic number (0xAA55) \\
561   \cline{2-2}
562 \end{tabular}
563 $$
564 %%endskip
565 %:\begin{verbatim}
566 %;            +------------------------+
567 %;      0x000 |                        |
568 %;            |      Program code      |
569 %;            |                        |
570 %;            |                        |
571 %;            |------------------------|
572 %;      0x1BE |    Partition table     |
573 %;            |                        |
574 %;            |------------------------|
575 %;      0x1FE | Magic number (0xAA55)  |
576 %;            +------------------------+
577 %:\end{verbatim}
578
579 The \LILO\ boot sector is designed to be usable as a partition boot sector.
580 (I.e. there is room for the partition table.)
581 Therefore, the \LILO\ boot sector can be stored at the following locations:
582
583 \begin{itemize}
584   \item boot sector of a Linux floppy disk. (\path{/dev/fd0}, $\ldots$)
585   \item MBR of the first hard disk. (\path{/dev/hda}, \path{/dev/sda}, $\ldots$)
586   \item boot sector of a primary Linux file system partition on the first hard
587     disk. (\path{/dev/hda1}, $\ldots$)
588   \item partition boot sector of an extended partition on the first hard disk.
589     (\path{/dev/hda1}, $\ldots$)\footnote{Most FDISK-type programs don't
590       believe in booting from an extended partition and refuse to
591       activate it. \LILO\ is accompanied by a simple program
592       (\name{activate}) that doesn't have this restriction. Linux \name{fdisk}
593       also supports activating extended partitions.}
594 \end{itemize}
595
596 It \emphasize{can't} be stored at any of the following locations:
597
598 \begin{itemize}
599   \item boot sector of a non-Linux floppy disk or primary partition.
600   \item a Linux swap partition.
601   \item boot sector of a logical partition in an extended partition.%
602 \footnote{\LILO\ can be forced to put the boot sector on such a
603  partition by using the \raw{-b} option or the \craw{boot} variable.
604  However, only few programs that operate as master boot records
605  support booting from a logical partition.}
606   \item on the second hard disk. (Unless for backup installations,
607     if the current first disk will be removed or disabled, or if some
608     other boot loader is used, that is capable of loading boot sectors from
609     other drives.)
610 \end{itemize}
611
612 Although \LILO\ tries to detect attempts to put its boot sector at an
613 invalid location, you should not rely on that.
614
615
616 \subsection{Booting basics}
617
618 When booting from a floppy disk, the first sector of the disk, the so-called
619 boot sector, is loaded. That boot sector contains a small program that loads
620 the respective operating system. MS-DOS boot sectors also contain 
621 a data area, where disk and file system parameters (cluster size, number of
622 sectors, number of heads, etc.) are stored.
623
624 When booting from a hard disk, the very first sector of that disk, the
625 so-called master boot record (MBR) is loaded. This sector contains a
626 loader program and the partition table of the disk. The loader program
627 usually loads the boot sector, as if the system was booting from a floppy.
628
629 Note that there is no functional difference between the MBR and the boot
630 sector other than that the MBR contains the partition information but
631 doesn't contain any file system-specific information (e.g. MS-DOS disk
632 parameters).
633
634 The first 446 (0x1BE) bytes of the MBR are used by the loader program.
635 They are followed by the partition table, with a length of 64 (0x40)
636 bytes. The last two bytes contain a magic number that is sometimes used to
637 verify that a given sector really is a boot sector.
638
639 There is a large number of possible boot configurations. The most common
640 ones are described in the following sections.
641
642
643 \subsubsection{MS-DOS alone}
644
645 %%beginskip
646 \bootthree{DOS-MBR \sep MS-DOS \sep COMMAND.COM}
647 %%endskip
648 %:\begin{verbatim}
649 %;+-------------------------------------------------------+
650 %;| Master Boot Record    Boot sector    Operating system |
651 %;|-------------------------------------------------------|
652 %;| DOS-MBR ------------> MS-DOS ------> COMMAND.COM      |
653 %;+-------------------------------------------------------+
654 %:\end{verbatim}
655
656 This is what usually happens when MS-DOS boots from a hard disk: the DOS-MBR
657 determines the active partition and loads the MS-DOS boot sector. This boot
658 sector loads MS-DOS and finally passes control to \path{COMMAND.COM}. (This is
659 greatly simplified.)
660
661
662 \subsubsection{LOADLIN}
663
664 %%beginskip
665 \bootfour{DOS-MBR \sep MS-DOS \sep COMMAND.COM \emptys \\
666   \emptys \branch LOADLIN \sep Linux}
667 %%endskip
668 %:\begin{verbatim}
669 %4+------------------------------------------------------------+
670 %4| Master Boot Record    Boot sector    Operating system      |
671 %4|------------------------------------------------------------|
672 %4| DOS-MBR ------------> MS-DOS ------> COMMAND.COM           |
673 %4|                                 ---> LOADLIN ------> Linux |
674 %4+------------------------------------------------------------+
675 %:\end{verbatim}
676
677 A typical \name{LOADLIN} setup: everything happens like when booting MS-DOS,
678 but in \path{CONFIG.SYS} or \path{AUTOEXEC.BAT}, LOADLIN is invoked. Typically,
679 a program like \path{BOOT.SYS} is used to choose among configuration sections
680 in \path{CONFIG.SYS} and \path{AUTOEXEC.BAT}.
681 This approach has the pleasant property that no boot
682 sectors have to be altered.
683
684 Please refer to the documentation accompanying the LOADLIN package for
685 installation instructions and further details.
686
687
688 \subsubsection{\LILO\ started by DOS-MBR}
689
690 %%beginskip
691 \bootthree{DOS-MBR \sep LILO \sep Linux \\
692   \branch {\rm other OS} \emptys}
693 %%endskip
694 %:\begin{verbatim}
695 %;+-------------------------------------------------------+
696 %;| Master Boot Record    Boot sector    Operating system |
697 %;|-------------------------------------------------------|
698 %;| DOS-MBR ------------> LILO --------> Linux            |
699 %;|                  ---> other OS                        |
700 %;+-------------------------------------------------------+
701 %:\end{verbatim}
702
703 This is a ``safe'' \LILO\ setup: \LILO\ is booted by the DOS-MBR. No other boot
704 sectors have to be touched. If the other OS (or one of them, if there are
705 several other operating systems being used) should be booted without
706 using \LILO, the other
707 partition has to be marked ``active'' with \name{fdisk} or \name{activate}.
708
709 Installation:
710 \begin{itemize}
711   \item install \LILO\ with its boot sector on the Linux partition.
712   \item use \name{fdisk} or \name{activate} to make that partition active.
713   \item reboot.
714 \end{itemize}
715
716 Deinstallation:
717 \begin{itemize}
718   \item make a different partition active.
719   \item install whatever should replace \LILO\ and/or Linux.
720 \end{itemize}
721
722
723 \subsubsection{Several alternate branches}
724
725 %%beginskip
726 \bootfour{DOS-MBR \sep MS-DOS \sep COMMAND.COM \emptys \\
727   \emptys \branch LOADLIN \sep Linux \\
728   \branch LILO \sep Linux \emptys \\
729   \emptys \branch MS-DOS \cont \emptys}
730 %%endskip
731 %:\begin{verbatim}
732 %4+------------------------------------------------------------+
733 %4| Master Boot Record    Boot sector    Operating system      |
734 %4|------------------------------------------------------------|
735 %4| DOS-MBR ------------> MS-DOS ------> COMMAND.COM           |
736 %4|                                 ---> LOADLIN ------> Linux |
737 %4|                  ---> LILO --------> Linux                 |
738 %4|                                 ---> MS-DOS --- ...        |
739 %4+------------------------------------------------------------+
740 %:\end{verbatim}
741
742 An extended form of the above setup: the MBR is not changed and both branches
743 can either boot Linux or MS-DOS. (\LILO\ could also boot other
744 operating systems.)
745
746
747 \subsubsection{\LILO\ started by \name{BOOTACTV}\protect\footnotemark}
748 \footnotetext{Other, possibly better known boot switchers, e.g. \name{OS/2
749 BootManager} operate in a similar way. The installation procedures typically
750 vary.}
751
752 %%beginskip
753 \bootthree{BOOTACTV \sep LILO \sep Linux \\
754   \branch {\rm other OS} \emptys}
755 %%endskip
756 %:\begin{verbatim}
757 %;+-------------------------------------------------------+
758 %;| Master Boot Record    Boot sector    Operating system |
759 %;|-------------------------------------------------------|
760 %;| BOOTACTV -----------> LILO --------> Linux            |
761 %;|                  ---> other OS                        |
762 %;+-------------------------------------------------------+
763 %:\end{verbatim}
764
765 Here, the MBR is replaced by \name{BOOTACTV} (or any other interactive boot
766 partition selector) and the choice between Linux and the
767 other operating system(s) can be made at boot time. This approach should be
768 used if \LILO\ fails to boot the other operating system(s).\footnote{%
769 And the author would like to be notified if booting the other operating
770 system(s) doesn't work with \LILO, but if it works with an other boot partition
771 selector.}
772
773 Installation:
774 \begin{itemize}
775   \item boot Linux.
776   \item make a backup copy of your MBR on a floppy disk, e.g. \\
777     \verb"dd if=/dev/hda of=/fd/MBR bs=512 count=1"
778   \item install \LILO\ with the boot sector on the Linux partition.
779   \item install \name{BOOTACTV} as the MBR, e.g. \\
780     \verb"dd if=bootactv.bin of=/dev/hda bs=446 count=1"
781   \item reboot.
782 \end{itemize}
783
784 Deinstallation:
785 \begin{itemize}
786   \item boot Linux.
787   \item restore the old MBR, e.g. \\
788     \verb"dd if=/MBR of=/dev/hda bs=446 count=1" \\
789     or \verb"FDISK /MBR" under MS-DOS.
790 \end{itemize}
791
792 If replacing the MBR appears undesirable and if a second Linux partition
793 exists (e.g. \path{/usr}, \emphasize{not} a swap partition), \name{BOOTACTV}
794 can be merged with
795 the partition table and stored as the ``boot sector'' of that partition.
796 Then, the partition can be marked active to be booted by the DOS-MBR.
797
798 Example:
799 \begin{verbatim}
800 # dd if=/dev/hda of=/dev/hda3 bs=512 count=1
801 # dd if=bootactv.bin of=/dev/hda3 bs=446 count=1
802 \end{verbatim}
803
804 \emphasize{WARNING:} Whenever the disk is re-partitioned, the merged boot
805 sector on that ``spare'' Linux partition has to be updated too.
806
807
808 \subsubsection{\LILO\ alone}
809
810 %%beginskip
811 \boottwo{LILO \sep Linux \\
812   \branch {\rm other OS}}
813 %%endskip
814 %:\begin{verbatim}
815 %;    +----------------------------------------+
816 %;    | Master Boot Record    Operating system |
817 %;    |----------------------------------------|
818 %;    | LILO ---------------> Linux            |
819 %;    |                  ---> other OS         |
820 %;    +----------------------------------------+
821 %:\end{verbatim}
822
823 \LILO\ can also take over the entire boot procedure. If installed as the MBR,
824 \LILO\ is responsible for either booting Linux or any other OS. This approach
825 has the disadvantage, that the old MBR is overwritten and has to be restored
826 (either from a backup copy, with \verb"FDISK /MBR" on recent versions of
827 MS-DOS or by overwriting it with something like \name{BOOTACTV}) if Linux
828 should ever be removed from the system.
829
830 You should verify that \LILO\ is able to boot your other operating system(s)
831 before relying on this method.
832
833 Installation:
834 \begin{itemize}
835   \item boot Linux.
836   \item make a backup copy of your MBR on a floppy disk, e.g. \\
837     \verb"dd if=/dev/hda of=/fd/MBR bs=512 count=1"
838   \item install \LILO\ with its boot sector as the MBR.
839   \item reboot.
840 \end{itemize}
841
842 Deinstallation:
843 \begin{itemize}
844   \item boot Linux.
845   \item restore the old MBR, e.g. \\
846     \verb"dd if=/fd/MBR of=/dev/hda bs=446 count=1"
847 \end{itemize}
848
849 If you've installed \LILO\ as the master boot record, you have to
850 explicitly specify the boot sector (configuration variable
851 \craw{boot=}$\ldots$) when updating the map. Otherwise, it
852 will try to use the boot sector of your current root partition, which
853 will usually work, but it will probably leave your system unbootable.
854
855
856 \subsubsection{Names}
857
858 The following names have been used to describe boot sectors or parts of
859 operating systems:
860
861 \begin{description}
862   \item[``DOS-MBR''] is the original MS-DOS MBR. It scans the partition
863     table for a partition that is marked ``active'' and loads the boot
864     sector of that partition. Programs like MS-DOS' \name{FDISK}, Linux
865     \name{fdisk} or \name{activate} (accompanies \LILO)
866     can change the active marker in the partition table.
867   \item[``MS-DOS''] denotes the MS-DOS boot sector that loads the other parts
868     of the system (\path{IO.SYS}, etc.).
869   \item[``COMMAND.COM''] is the standard command interpreter of MS-DOS.
870   \item[``LOADLIN''] is a program that loads a Linux
871     kernel image from an
872     MS-DOS partition into memory and executes it. It is usually invoked
873     from \path{CONFIG.SYS} and is used in combination with a \path{CONFIG.SYS}
874     configuration switcher, like BOOT.SYS.\footnote{
875       \name{LOADLIN} is available for anonymous FTP from \\
876       \path{ftp://tsx-11.mit.edu/pub/linux/dos\_utils/lodlin\meta{n}.tar.gz} \\
877       \path{ftp://sunsite.unc.edu/pub/Linux/system/boot/dualboot/lodlin\meta{n}%
878 .tgz} \\
879       \name{BOOT.SYS} is available for anonymous FTP from \\
880       \path{ftp://ftp.funet.fi/pub/Linux/tools/boot142.zip}}
881   \item[``LILO''] can either load a Linux kernel or the boot sector of any
882     other operating system. It has a first stage boot sector that
883     loads the remaining parts of \LILO\ from various locations.\footnote{%
884       \LILO\ can be found in \\
885       \path{ftp://tsx-11.mit.edu/pub/linux/packages/lilo/lilo-\meta{n}.tar.gz}
886         \\
887       \path{ftp://sunsite.unc.edu/pub/Linux/system/boot/lilo/lilo-%
888 \meta{n}.tar.gz} \\
889       \path{ftp://lrcftp.epfl.ch/pub/linux/local/lilo/lilo-\meta{n}.tar.gz}}
890   \item[``BOOTACTV''] permits interactive selection of the partition from
891     which the boot sector should be read. If no key is pressed within a
892     given interval, the partition marked active is booted. \name{BOOTACTV} is
893     included in the \name{pfdisk} package. There are also several similar
894     programs, like PBOOT and OS-BS.\footnote{\name{pfdisk} is available for
895       anonymous FTP from \\
896       \path{ftp://sunsite.unc.edu/pub/Linux/utils/disk-management/pfdisk.tar.Z}
897         or \\
898       \path{ftp://ftp.funet.fi/pub/Linux/tools/pfdisk.tar.Z} \\
899       PBOOT can be found in \\
900       \path{ftp://ftp.funet.fi/pub/Linux/tools/pboot.zip}}
901 \end{description}
902
903
904 \subsection{Choosing the ``right'' boot concept}
905
906 Although \LILO\ can be installed in many different ways, the choice is
907 usually limited by the present setup and therefore,
908 typically only a small number of configurations which fit naturally
909 into an existing system remains. The following sections describe various
910 possible cases. See also section \ref{broken}.
911
912 The configuration file \path{/etc/lilo.conf} for the examples
913 could look like this:
914
915 \begin{verbatim}
916 boot = /dev/hda2
917 compact
918 image = /vmlinuz
919 image = /vmlinuz.old
920 other = /dev/hda1
921   table = /dev/hda
922   label = msdos
923 \end{verbatim}
924
925 It installs a Linux kernel image (\path{/vmlinuz}),
926 an alternate Linux kernel image (\path{/vmlinuz.old}) and
927 a chain loader to boot MS-DOS from \path{/dev/hda1}. The option \craw{compact}
928 on the second line instructs the map installer to optimize loading.
929
930 In all examples, the names of the IDE-type hard disk devices
931 (\path{/dev/hda$\ldots$}) are used. Everything applies to other disk types
932 (e.g. SCSI disks; \path{/dev/sda$\ldots$}) too.
933
934
935 \subsubsection{BIOS restrictions}
936 \label{broken}
937
938 Nowadays, an increasing number of systems is equipped with comparably large
939 disks or even with multiple disks. At the time the disk interface of the
940 standard PC BIOS has been designed (about 16 years ago), such configurations
941 were apparently considered to be too unlikely to be worth supporting.
942
943 The most common BIOS restrictions that affect \LILO\ are the limitation to
944 two hard disks and the inability to access more than 1024 cylinders per
945 disk. \LILO\ can detect both conditions, but in order to work around the
946 underlying problems, manual intervention is necessary.
947
948 The drive limit does not exist in every BIOS. Some modern motherboards
949 and disk controllers are equipped with a BIOS that supports more (typically
950 four) disk drives. When attempting to access the third, fourth, etc. drive,
951 \LILO\ prints a warning message but continues. Unless the BIOS really
952 supports more than two drives, the system will \emphasize{not} be able to
953 boot in that case.\footnote{However, if only ``unimportant'' parts of the
954 system are located on the ``high'' drives, some functionality may be
955 available.}
956
957 The cylinder limit is a very common problem with IDE disks. There, the
958 number of cylinders may already exceed 1024 if the drive has a capacity
959 of more than 504 MB. Many SCSI driver BIOSes present the disk geometry
960 in a way that makes the limit occur near 1 GB. Modern disk controllers
961 may even push the limit up to about 8 GB. All cylinders beyond the
962 1024th are inaccessible for the BIOS. \LILO\ detects this problem and
963 aborts the installation (unless the \craw{linear} option is used, see
964 section \ref{cfgglo}).
965
966 Note that large partitions that only partially extend into the ``forbidden
967 zone'' are still in jeopardy even if they appear to work at first, because
968 the file system does not know about the restrictions and may allocate
969 disk space from the area beyond the 1024th cylinder when installing new
970 kernels. \LILO\ therefore prints a warning message but continues as long
971 as no imminent danger exists.
972
973 There are four approaches of how such problems can be solved:
974 \begin{itemize}
975   \item use of a different partition which is on an accessible disk and
976     which does not exceed the 1024 cylinder limit. If there is only a DOS
977     partition which fulfills all the criteria, that partition can be
978     used to store the relevant files. (See section \ref{viados}.)
979   \item rearranging partitions and disks. This is typically a destructive
980     operation, so extra care should be taken to make good backups.
981   \item if the system is running DOS or Windows 95, \name{LOADLIN} can be
982     used instead of \LILO.
983   \item if all else fails, installation of a more capable BIOS, a different
984     controller or a different disk configuration.
985 \end{itemize}
986
987 \LILO\ depends on the BIOS to load the following items:
988 \begin{itemize}
989   \item \path{/boot/boot.b}
990   \item \path{/boot/map} (created when running \path{/sbin/lilo})
991   \item all kernels
992   \item the boot sectors of all other operating systems it boots
993   \item the startup message, if one has been defined
994 \end{itemize}
995
996 Normally, this implies that the Linux root file system should be in the
997 ``safe'' area. However, it is already sufficient to put all kernels into
998 \path{/boot} and to either mount a ``good'' partition on \path{/boot} or
999 to let \path{/boot} be a symbolic link pointing to or into such a
1000 partition.
1001
1002 See also \path{/usr/src/linux/Documentation/ide.txt} (or
1003 \path{/usr/src/linux/drivers/block/README.ide} in older kernels) for a detailed
1004 description of problems with large disks.
1005
1006
1007 \subsubsection{One disk, Linux on a primary partition}
1008
1009 If at least one primary partition of the first hard disk is used as a
1010 Linux file system (\path{/}, \path{/usr}, etc. but \emphasize{not} as a swap
1011 partition), the \LILO\ boot sector should be stored on that partition
1012 and it should be booted by the original master boot record or by a
1013 program like \name{BOOTACTV}.
1014
1015 %%beginskip
1016 $$
1017   \begin{tabular}{r|c|c|}
1018     \cline{2-3}
1019     & \multicolumn{2}{|l|}{MBR\hbox to 1.3in{\hfill\tt /dev/hda~}} \\
1020     \cline{3-3}
1021     & & MS-DOS\hfill\tt /dev/hda1 \\
1022     \cline{3-3}
1023     $\rightarrow$ & & Linux {\tt /}\hfill\tt /dev/hda2 \\
1024     \cline{2-3}
1025   \end{tabular}
1026 $$
1027 %%endskip
1028 %:\begin{verbatim}
1029 %;    +--------------------------+
1030 %;    | MBR            /dev/hda  |
1031 %;    | +------------------------|
1032 %;    | | MS-DOS       /dev/hda1 |
1033 %;    | |------------------------|
1034 %;--> | | Linux /      /dev/hda2 |
1035 %;    +--------------------------+
1036 %:\end{verbatim}
1037
1038 In this example, the \craw{boot} variable could be omitted, because
1039 the boot sector is on the root partition.
1040
1041
1042 \subsubsection{One disk, Linux on a logical partition}
1043
1044 If no primary partition is available for Linux, but at least one logical
1045 partition of an extended partition on the first hard disk contains a
1046 Linux file system, the \LILO\ boot sector should be stored in the partition
1047 sector of the extended partition and it should be booted by the original
1048 master boot record or by a program like \name{BOOTACTV}.
1049
1050 %%beginskip
1051 $$
1052   \begin{tabular}{r|c|c|c|}
1053     \cline{2-4}
1054     & \multicolumn{3}{|l|}{MBR\hbox to 1.3in{\hfill\tt /dev/hda~}} \\
1055     \cline{3-4}
1056     & & \multicolumn{2}{|l|}{MS-DOS\hfill\tt /dev/hda1} \\
1057     \cline{3-4}
1058     $\rightarrow$ & & \multicolumn{2}{|l|}{Extended\hfill\tt /dev/hda2} \\
1059     \cline{4-4}
1060     & & & Linux\hfill\tt /dev/hda5 \\
1061     \cline{4-4}
1062     & & & $\ldots$\hfill\tt /dev/hda6 \\
1063     \cline{2-4}
1064   \end{tabular}
1065 $$
1066 %%endskip
1067 %:\begin{verbatim}
1068 %;    +--------------------------+
1069 %;    | MBR            /dev/hda  |
1070 %;    | +------------------------|
1071 %;    | | MS-DOS       /dev/hda1 |
1072 %;    | |------------------------|
1073 %;--> | | Extended     /dev/hda2 |
1074 %;    | | +----------------------|
1075 %;    | | | Linux      /dev/hda5 |
1076 %;    | | |----------------------|
1077 %;    | | | ...        /dev/hda6 |
1078 %;    +--------------------------+
1079 %:\end{verbatim}
1080
1081 Because many disk partitioning programs refuse to make an extended
1082 partition (in our example \path{/dev/hda2}) active, you might have to
1083 use \name{activate}, which comes with the \LILO\ distribution.
1084
1085 OS/2 BootManager should be able to boot \LILO\ boot sectors from logical
1086 partitions. The installation on the extended partition itself is not
1087 necessary in this case.
1088
1089
1090 \subsubsection{Two disks, Linux (at least partially) on the first disk}
1091
1092 This case is equivalent to the configurations where only one disk
1093 is in the system. The Linux boot sector resides on the first hard
1094 disk and the second disk is used later in the boot process.
1095
1096 Only the location of the boot sector matters -- everything
1097 else (\path{/boot/boot.b},
1098 \path{/boot/map}, the root file system, a swap partition, other
1099 Linux file systems, etc.) can be located anywhere on the second disk,
1100 provided that the constraints described in section \ref{broken} are met.
1101
1102
1103 \subsubsection{Two disks, Linux on second disk, first disk has an extended
1104   partition}
1105
1106 If there is no Linux partition on the first disk, but there is an
1107 extended partition, the \LILO\ boot sector can be stored in the partition
1108 sector of the extended partition and it should be booted by the original
1109 master boot record or by a program like \name{BOOTACTV}.
1110
1111 %%beginskip
1112 $$
1113   \begin{tabular}{r|c|c|c|c|c|c|}
1114     \multicolumn{1}{r}{}
1115     & \multicolumn{3}{c}{\bf First disk} &
1116       \multicolumn{1}{r}{\qquad}
1117       & \multicolumn{2}{c}{\bf Second disk} \\
1118     \cline{2-4}\cline{6-7}
1119     & \multicolumn{3}{|l|}{MBR\hbox to 1.3in{\hfill\tt /dev/hda~}} &
1120       & \multicolumn{2}{|l|}{MBR\hbox to 1.3in{\hfill\tt /dev/hdb~}} \\
1121     \cline{3-4}\cline{7-7}
1122     & & \multicolumn{2}{|l|}{MS-DOS\hfill\tt /dev/hda1} &
1123       & & Linux\hfill\tt /dev/hdb1 \\
1124     \cline{3-4}\cline{7-7}
1125     $\rightarrow$ & & \multicolumn{2}{|l|}{Extended\hfill\tt /dev/hda2} &
1126       & & $\ldots$\hfill\tt /dev/hdb2 \\
1127     \cline{4-4}
1128     & & & $\ldots$\hfill\tt /dev/hda5 & & & \\
1129     \cline{4-4}
1130     & & & $\ldots$\hfill\tt /dev/hda6 & & & \\
1131     \cline{2-4}\cline{6-7}
1132   \end{tabular}
1133 $$
1134 %%endskip
1135 %:\begin{verbatim}
1136 %4             FIRST DISK                     SECOND DISK
1137 %4    +--------------------------+    +--------------------------+
1138 %4    | MBR            /dev/hda  |    | MBR            /dev/hdb  |
1139 %4    | +------------------------|    | +------------------------|
1140 %4    | | MS-DOS       /dev/hda1 |    | | Linux        /dev/hdb1 |
1141 %4    | |------------------------|    | |------------------------|
1142 %4--> | | Extended     /dev/hda2 |    | | ...          /dev/hdb2 |
1143 %4    | | +----------------------|    | |                        |
1144 %4    | | | ...        /dev/hda5 |    | |                        |
1145 %4    | | |----------------------|    | |                        |
1146 %4    | | | ...        /dev/hda6 |    | |                        |
1147 %4    +--------------------------+    +--------------------------+
1148 %:\end{verbatim}
1149
1150 The program \name{activate}, that accompanies \LILO, may have to be used to
1151 set the active marker on an extended partition, because MS-DOS' \name{FDISK}
1152 and some older version of Linux \name{fdisk} refuse to do that. (Which is
1153 generally a good idea.)
1154
1155
1156 \subsubsection{Two disks, Linux on second disk, first disk has no
1157   extended partition}
1158
1159 If there is neither a Linux partition nor an extended partition on the first
1160 disk, then there's only one place left, where a \LILO\ boot sector could be
1161 stored: the master boot record.
1162
1163 In this configuration, \LILO\ is responsible for booting all other operating
1164 systems too.
1165
1166 %%beginskip
1167 $$
1168   \begin{tabular}{r|c|c|c|c|c|}
1169     \multicolumn{1}{r}{}
1170     & \multicolumn{2}{c}{\bf First disk} &
1171       \multicolumn{1}{r}{\qquad}
1172       & \multicolumn{2}{c}{\bf Second disk} \\
1173     \cline{2-3}\cline{5-6}
1174     $\rightarrow$ & \multicolumn{2}{|l|}{MBR\hbox to 1.3in{
1175       \hfill\tt /dev/hda~}} &
1176       & \multicolumn{2}{|l|}{MBR\hbox to 1.3in{\hfill\tt /dev/hdb~}} \\
1177     \cline{3-3}\cline{6-6}
1178     & & MS-DOS\hfill\tt /dev/hda1 &
1179       & & Linux\hfill\tt /dev/hdb1 \\
1180     \cline{3-3}\cline{6-6}
1181     & & $\ldots$\hfill\tt /dev/hda2 &
1182       & & $\ldots$\hfill\tt /dev/hdb2 \\
1183     \cline{2-3}\cline{5-6}
1184   \end{tabular}
1185 $$
1186 %%endskip
1187 %:\begin{verbatim}
1188 %4             FIRST DISK                     SECOND DISK
1189 %4    +--------------------------+    +--------------------------+
1190 %4--> | MBR            /dev/hda  |    | MBR            /dev/hdb  |
1191 %4    | +------------------------|    | +------------------------|
1192 %4    | | MS-DOS       /dev/hda1 |    | | Linux        /dev/hdb1 |
1193 %4    | |------------------------|    | |------------------------|
1194 %4    | | ...          /dev/hda2 |    | | ...          /dev/hdb2 |
1195 %4    +--------------------------+    +--------------------------+
1196 %:\end{verbatim}
1197
1198 You should back up your old MBR before installing \LILO\ and verify that
1199 \LILO\ is able to boot your other operating system(s) before relying on
1200 this approach.
1201
1202 The line \verb"boot = /dev/hda2" in \path{/etc/lilo.conf} would have to be
1203 changed to \verb"boot = /dev/hda" in this example.
1204
1205
1206 \subsubsection{More than two disks}
1207
1208 On systems with more than two disks, typically only the first two can
1209 be accessed. The configuration choices are therefore the same as with
1210 two disks.
1211
1212 When attempting to access one of the extra disks, \LILO\ displays a
1213 warning message (\raw{Warning: BIOS drive 0x\meta{number} may not be
1214 accessible}) but does not abort. This is done in order to allow
1215 the lucky few whose BIOS (or controller-BIOS) does support more than
1216 two drives to make use of this feature. By all others, this warning
1217 should be considered a fatal error.
1218
1219 Note that the two disks restriction is only imposed by the BIOS.
1220 Linux normally has no problems using all disks once it is booted.
1221
1222
1223 \subsubsection{\path{/boot} on a DOS partition}
1224 \label{viados}
1225
1226 Recent kernels support all the functions \LILO\ needs to map files also
1227 on MS-DOS (or UMSDOS) file systems. Since DOS partitions tend to occupy
1228 exactly the places where BIOS restrictions (see section \ref{broken})
1229 are invisible, they're an ideal location for \path{/boot} if the native
1230 Linux file systems can't be used because of BIOS problems.
1231
1232 In order to accomplish this, the DOS partition is mounted read-write,
1233 a directory (e.g. \path{/dos/linux}) is created, all files from
1234 \path{/boot} are moved to that directory, \path{/boot} is replaced by
1235 a symbolic link to it, the kernels are also moved to the new directory,
1236 their new location is recorded in \path{/etc/lilo.conf}, and finally
1237 \path{/sbin/lilo} is run.
1238
1239 From then on, new kernels must always be copied into that directory on
1240 the DOS partition before running \path{/sbin/lilo}, e.g. when recompiling
1241 a kernel, the standard procedure changes from
1242
1243 \begin{verbatim}
1244 # make zlilo
1245 \end{verbatim}
1246
1247 to
1248
1249 \begin{verbatim}
1250 # make zImage
1251 # mv /dos/linux/vmlinuz /dos/linux/vmlinuz.old
1252 # mv arch/i386/boot/zImage /dos/linux/vmlinuz
1253 # /sbin/lilo
1254 \end{verbatim}
1255
1256 \emphasize{WARNING:} De-fragmenting such a DOS partition is likely to
1257 make Linux or even the whole system unbootable. Therefore, the DOS
1258 partition should either not be de-fragmented, or a Linux boot disk
1259 should be prepared (and tested) to bring up Linux and to run
1260 \path{/sbin/lilo} after the de-fragmentation.\footnote{Setting the
1261 ``system'' attribute from DOS on the critical files (e.g. everything
1262 in \path{C:$\backslash$LINUX}) may help to protect them from being
1263 rearranged. However, the boot floppy should still be ready, just in case.}
1264
1265
1266 \newpage
1267 \section{The boot prompt}
1268 \label{cmdopt}
1269
1270 Immediately after it's loaded, \LILO\ checks whether one of the following
1271 is happening:
1272
1273 \begin{itemize}
1274   \item any of the \key{Shift}, \key{Control} or \key{Alt} keys is
1275     pressed.
1276   \item \key{CapsLock} or \key{ScrollLock} is set.
1277 \end{itemize}
1278
1279 If this is the case, \LILO\ displays the \verb"boot:" prompt and waits for
1280 the name of a boot image (i.e. Linux kernel or other operating system).
1281 Otherwise, it boots the default boot image\footnote{%
1282 The default boot image is either the first boot image, the image specified
1283 with the \craw{default} variable, or the image that
1284 has been selected at the boot prompt.}
1285 or -- if a
1286 delay has been specified -- waits for one of the listed activities
1287 until that amount of time has passed.
1288
1289 At the boot prompt, the name of the image to boot can be entered. Typing
1290 errors can be corrected with \key{BackSpace}, \key{Delete},
1291 \key{Ctrl U} and \key{Ctrl X}. A list of known images can be obtained by
1292 pressing \key{?} or \key{Tab}.
1293
1294 If \key{Enter} is pressed and no file name has been entered, the default
1295 image is booted.
1296
1297
1298 \subsection{Boot command-line options}
1299
1300 \LILO\ is also able to pass command-line options to the kernel.
1301 Command-line options are words that follow the name of the boot
1302 image and that are separated by spaces.
1303
1304 Example:
1305 \begin{verbatim}
1306 boot: linux single root=200
1307 \end{verbatim}
1308
1309 This document only gives an overview of boot options. Please consult Paul
1310 Gortmaker's BootPrompt-HOWTO for a more complete and more up to date list.
1311 You can get it from
1312 \path{ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/BootPrompt-HOWTO.gz}
1313 or from one of the many mirror sites.
1314
1315
1316 \subsubsection{Standard options}
1317
1318 Recent kernels recognize a large number of options, among them are \raw{debug},
1319 \raw{no387}, \raw{no-hlt},
1320 \raw{ramdisk=\meta{size}}, \raw{reserve=\meta{base},\meta{size},$\ldots$},
1321 \raw{root=\meta{device}}, \raw{ro}, and \raw{rw}.
1322 All current \name{init} programs also recognize the option \raw{single}.
1323 The options \raw{lock} and \raw{vga} are processed by the boot loader itself.
1324 Boot command-line options are always case-sensitive.
1325
1326 \raw{single} boots the system in single-user mode. This bypasses most
1327 system initialization procedures and directly starts a root shell on the
1328 console. Multi-user mode can typically be entered by exiting the single-user
1329 shell or by rebooting.
1330
1331 \raw{root=\meta{device}} changes the root device. This overrides
1332 settings that may have been made in the boot image and on the
1333 \LILO\ command line. \meta{device} is either the hexadecimal device number
1334 %%beginskip
1335 \footnote{%
1336 This is a list of device numbers of some frequently used devices: \\
1337 \begin{tabular}{lllllll}
1338 \qquad
1339 & {\tt /dev/fd0} & 200\qquad & \tt /dev/hda1 & 301\qquad & /dev/sda1 & 801 \\
1340 & {\tt /dev/fd1} & 201 & \tt /dev/hda2 & 302 & /dev/sda2 & 802 \\
1341 & \multicolumn{2}{c}{$\cdots$} & \multicolumn{2}{c}{$\cdots$} &
1342 \multicolumn{2}{c}{$\cdots$} \\
1343 & & & \tt /dev/hdb1 & 341 & /dev/sdb1 & 811 \\
1344 & & & \tt /dev/hdb2 & 342 & /dev/sdb2 & 812 \\
1345 & \multicolumn{2}{c}{} & \multicolumn{2}{c}{$\cdots$} &
1346 \multicolumn{2}{c}{$\cdots$} \\
1347 \end{tabular}}
1348 %%endskip
1349 or the full path name of the device, e.g. \verb"/dev/hda3".%
1350 \footnote{The device names are hard-coded in the kernel. Therefore, only
1351 the ``standard'' names are supported and some less common devices may not
1352 be recognized. In those cases, only numbers can be used.}
1353
1354 \raw{reserve=\meta{base},\meta{size},$\ldots$} reserves IO port regions.
1355 This can be used to prevent device drivers from auto-probing addresses
1356 where other devices are located, which get confused by the probing.
1357
1358 \raw{ro} instructs the kernel to mount the root file system read-only.
1359 \raw{rw} mounts it read-write. If neither \raw{ro} nor \raw{rw} is
1360 specified, the setting from the boot image is used.
1361
1362 \raw{no-hlt} avoids executing a \raw{HLT} instructions whenever the system
1363 is idle. \raw{HLT} normally significantly reduces power consumption and
1364 therefore also heat
1365 dissipation of the CPU, but may not work properly with some clone CPUs.
1366 \raw{no387} disables using the hardware FPU even if one is present.
1367
1368 \raw{debug} enables more verbose console logging.
1369
1370 Recent kernels also accept the options \raw{init=\meta{name}} and
1371 \raw{noinitrd}. \raw{init} specifies the name of the \name{init} program
1372 to execute. Therefore, if single mode cannot be entered because \name{init}
1373 is mis-configured, one may still be able to reach a shell using
1374 \verb"init=/bin/sh". \raw{noinitrd} disables automatic loading of the initial
1375 RAM disk. Instead, its content is then available on \path{/dev/initrd}.
1376
1377 \raw{vga=\meta{mode}} alters the VGA mode set at startup. The values
1378 \raw{normal}, \raw{extended}, \raw{ask} or a decimal number are
1379 recognized. (See also page \pageref{vga}.)
1380
1381 \raw{kbd=\meta{code},$\ldots$} preloads a sequence of keystrokes in the
1382 BIOS keyboard buffer. The keystrokes have to be entered as 16 bit hexadecimal
1383 numbers, with the upper byte containing the scan code and the lower byte
1384 containing the ASCII code. Note that most programs only use the ASCII
1385 code, so the scan code can frequently be omitted. Scan code tables can be
1386 found in many books on PC hardware. Note that scan codes depend on the
1387 keyboard layout.
1388
1389 Finally, \raw{lock} stores the current command-line as the default
1390 command-line, so that \LILO\ boots the same image with the same options
1391 (including \raw{lock}) when invoked the next time.
1392
1393
1394 \subsubsection{Device-specific options}
1395
1396 There is also a plethora of options to specify certain characteristics
1397 (e.g. IO and memory addresses) of devices. Some common ones are
1398 \raw{ether}, \raw{floppy}, \raw{hd}, \raw{bmouse}, and \raw{sound}.
1399 The usage of these options is \raw{\meta{option}=\meta{number},$\ldots$}.
1400 Please consult the corresponding FAQs and HOWTOs for details. For an overview
1401 of all available options, consult the file \path{init/main.c} in the kernel
1402 source tree.
1403
1404
1405 \subsubsection{Other options}
1406
1407 Options of the type \raw{\meta{variable}=\meta{value}} which are neither
1408 standard options nor device-specific options,
1409 cause the respective variables to be set in the environment passed to
1410 \name{init}. The case of the variable name is preserved, i.e. it isn't
1411 automatically converted to upper case.
1412
1413 Note that environment variables passed to \name{init} are typically
1414 available in system initialization scripts (e.g. \path{/etc/rc.local}),
1415 but they're not visible from ordinary login sessions, because the \name{login}
1416 program removes them from the user's environment.
1417
1418
1419 \subsubsection{Repeating options}
1420
1421 The effect of repeating boot command-line options depends on the options.%
1422 \footnote{Options are frequently repeated when a string defined with
1423 \craw{append} or \craw{literal} is prepended to the parameters typed in by
1424 the user. Also, \LILO\ implicitly prepends the options \raw{ramdisk},
1425 \raw{ro}, \raw{root}, or \raw{rw} when \craw{ramdisk}, \craw{read-only},
1426 \craw{read-write}, or \craw{root}, respectively, are set in the configuration
1427 file.
1428 (\raw{lock} and \raw{vga} are handled by a different internal mechanism.)}
1429 There are three possible behaviours:
1430
1431 Options that only enable or disable a certain functionality can be repeated
1432 any number of times. \raw{debug}, \raw{lock}, \raw{no-hlt}, and \raw{no387}
1433 fall into this category.
1434
1435 Other options change a global setting whenever they appear, so only the
1436 value or presence of the last option matters. The antagonists \raw{ro} and
1437 \raw{rw} are such options. Also, \raw{ramdisk}, \raw{root}, and \raw{vga}
1438 work this way. Example: \raw{ro rw} would mount the root file system
1439 read-write.
1440
1441 Finally, when \raw{reserve} and many device-specific options are repeated,
1442 each occurrence has its own meaning, e.g. \raw{hd=$\ldots$ hd=$\ldots$} would
1443 configure two hard disks, and \raw{reserve=0x300,8 reserve=0x5f0,16} would
1444 reserve the ranges 0x300 to 0x307 and 0x5f0 to 0x5ff (which is equivalent to
1445 writing \raw{reserve=0x300,8,0x5f0,16}).
1446
1447
1448 \subsubsection{Implicit options}
1449
1450 \LILO\ always passes the string \raw{BOOT\_IMAGE=\meta{name}} to the
1451 kernel, where \meta{name} is the name by which the kernel is identified
1452 (e.g. the label). This variable can be used in \path{/etc/rc} to select
1453 a different behaviour, depending on the kernel.
1454
1455 When booting automatically, i.e. without human intervention, the word
1456 \raw{auto} is also passed on
1457 the command line. This can be used by \name{init} to suppress interactive
1458 prompts in the boot phase.
1459
1460
1461 \subsection{Boot image selection}
1462 \label{bootsel}
1463
1464 The details of selecting the boot image are somewhat complicated. The
1465 following tables illustrate them. First, if neither \craw{prompt} is
1466 set nor a shift key is being pressed:
1467
1468 $$
1469 \begin{tabular}{cc|cl}
1470   Externally & Command  & Auto- & Booted image \\
1471   provided   & line in  & matic & \\
1472   cmd. line\footnotemark
1473   & map file\footnotemark
1474   & boot\footnotemark
1475   & \\
1476   \hline
1477   No  & No  & Yes & Default image \\
1478   Yes & --- & Yes & Specified by external \\
1479       &     &     & command line \\
1480   No  & Yes & Yes & Specified by command line \\
1481       &     &     & in map file \\
1482 \end{tabular}
1483 \addtocounter{footnote}{-2}
1484 \footnotetext{Externally provided command lines could be used to
1485   add front-ends to \LILO. They would pass the respective command
1486   string to LILO, which would then interpret it like keyboard input. This
1487   feature is currently not used.}
1488 \addtocounter{footnote}{1}
1489 \footnotetext{This command line is set by invoking the map installer
1490     with the \raw{-R} option, by using the boot command-line option
1491     \raw{lock}, or if a fallback command line is set (with \craw{fallback}).}
1492 \addtocounter{footnote}{1}
1493 \footnotetext{I.e. the keyword \raw{auto} is added.}
1494 $$
1495
1496 If \craw{prompt} is not set and a shift key is being pressed:
1497 $$
1498 \begin{tabular}{cccc|cl}
1499   Input   & Empty  & Extern. & Cmd.l.  & Auto- & Booted image \\
1500   timeout & cmd.l. & cmd.l.  & in map  & matic & \\
1501           &        &         & file    & boot  & \\
1502   \hline
1503   No  & No  & --- & --- & No  & Specified by the user \\
1504   No  & Yes & --- & --- & No  & Default image \\
1505   Yes & n/a & --- & --- & Yes & Default image \\
1506 \end{tabular}
1507 $$
1508
1509 Finally, if the configuration variable \craw{prompt} is set:
1510 $$
1511 \begin{tabular}{cccc|cl}
1512   Input   & Empty  & Extern. & Cmd.l.  & Auto- & Booted image \\
1513   timeout & cmd.l. & cmd.l.  & in map  & matic & \\
1514           &        &         & file    & boot  & \\
1515   \hline
1516   No  & No  & No  & No  & No  & Specified by the user \\
1517   No  & Yes & No  & No  & No  & Default image \\
1518   Yes & n/a & No  & No  & Yes & Default image \\
1519   n/a & n/a & Yes & --- & Yes & Specified by external \\
1520       &     &     &     &     & command line \\
1521   n/a & n/a & No  & Yes & Yes & Specified by command \\
1522       &     &     &     &     & line in map file \\
1523 \end{tabular}
1524 $$
1525
1526 Note that \LILO\ pauses for the amount of time specified in \craw{delay}
1527 when at the end of a default command line. The automatic boot can then
1528 be interrupted by pressing a modifier key (\key{Shift}, \key{Ctrl}, etc.).
1529
1530 The default image is the first image in the map file or the image specified
1531 with the \craw{default} variable. However,
1532 after an unsuccessful boot attempt, the respective image becomes the
1533 default image.
1534
1535
1536 \newpage
1537 \section{Map installer}
1538
1539 The map installer program \path{/sbin/lilo} updates the boot sector
1540 and creates the map file. If the map installer detects an error, it terminates
1541 immediately and does not touch the boot sector and the map file.
1542
1543 Whenever the map installer updates a boot sector, the original boot
1544 sector is copied
1545 to \path{/boot/boot.\meta{number}}, where \meta{number} is the
1546 hexadecimal device number. If such a file already exists, no backup
1547 copy is made. Similarly, a file \raw{/boot/part.\meta{number}} is
1548 created if \LILO\ modifies the partition table. (See page \pageref{fix-table}.)
1549
1550
1551 \subsection{Command-line options}
1552
1553 The \LILO\ map installer can be invoked in the following ways:
1554
1555
1556 %%beginskip
1557 \def\seealso{See also sections \ref{corropt} and \ref{cfgglo}.}
1558 %%def\\seealso=See also sections \\ref{corropt} and \\ref{cfgglo}.
1559 %%endskip
1560
1561 \subsubsection{Show current installation}
1562 \label{invshow}
1563
1564 The currently mapped files are listed. With \raw{-v}, also many parameters
1565 are shown.
1566
1567 \begin{command}
1568   /sbin/lilo
1569     \unit{\[ -C \meta{config\_file} \]}
1570     \unit{-q}
1571     \unit{\[ -m \meta{map\_file} \]}
1572     \unit{\[ -v $\ldots$ \]}
1573 \end{command}
1574
1575 \begin{description}
1576   \item[\raw{-C \meta{config\_file}}]~\\
1577     Specifies the configuration file that is used by the map
1578     installer (see section \ref{config}). If \raw{-C} is omitted,
1579     \path{/etc/lilo.conf} is used.
1580   \item[\raw{-m \meta{map\_file}}]~\\
1581     Specifies an alternate map file. \seealso
1582   \item[\raw{-q}]~ \\
1583     Lists the currently mapped files.
1584   \item[\raw{-v $\ldots$}]~\\
1585     Increase verbosity. \seealso
1586 \end{description}
1587
1588
1589 \subsubsection{Create or update map}
1590 \label{creupd}
1591
1592 A new map is created for the images described in the configuration file
1593 \path{/etc/lilo.conf} and they are registered in the boot sector.
1594
1595 \begin{command}
1596   /sbin/lilo
1597     \unit{\[ -C \meta{config\_file} \]}
1598     \unit{\[ -b \meta{boot\_device} \]}
1599     \unit{\[ -c \]}
1600     \unit{\[ -l \]}
1601     \unit{\[ -i \meta{boot\_sector} \]}
1602     \unit{\[ -f \meta{disk\_tab} \]}
1603     \unit{\[ -m \meta{map\_file} \]}
1604     \unit{\[ -d \meta{delay\/} \]}
1605     \unit{\[ -v $\ldots$ \]}
1606     \unit{\[ -t \]}
1607     \unit{\[ -s \meta{save\_file} \|}
1608     \unit{-S \meta{save\_file} \]}
1609     \unit{\[ -P fix \|}
1610     \unit{-P ignore \]}
1611     \unit{\[ -r \meta{root\_dir} \]}
1612 \end{command}
1613
1614 \begin{description}
1615   \item[\raw{-b \meta{boot\_device}}]~\\
1616     Specifies the boot device. \seealso
1617   \item[\raw{-c}]~\\
1618     Enables map compaction. \seealso
1619   \item[\raw{-C \meta{config\_file}}]~\\
1620     Specifies an alternate configuration file. See also section \ref{invshow}.
1621   \item[\raw{-d \meta{delay}}]~\\
1622     Sets the delay before \LILO\ boots the default image. Note that the
1623     delay is specified in \emphasize{tenths} of a second. \seealso
1624   \item[\raw{-D \meta{name}}]~\\
1625     Specifies the default image. \seealso
1626   \item[\raw{-f \meta{disk\_tab}}]~\\
1627     Specifies a disk parameter table file. \seealso
1628   \item[\raw{-i \meta{boot\_sector}}]~\\
1629     Specifies an alternate boot file. \seealso
1630   \item[\raw{-L}]~\\
1631     Enables lba32 sector addresses. \seealso
1632   \item[\raw{-l}]~\\
1633     Enables linear sector addresses. \seealso
1634   \item[\raw{-m \meta{map\_file}}]~\\
1635     Specifies an alternate map file. \seealso
1636   \item[\raw{-P \meta{mode}}]~\\
1637     Specifies how invalid partition table entries should be handled. \seealso
1638   \item[\raw{-r \meta{root\_directory}}]~ \\
1639     Chroots to the specified directory before doing anything else. This is
1640     useful when running the map installer while the normal root file system
1641     is mounted somewhere else, e.g. when recovering from an installation
1642     failure with a recovery disk. The \raw{-r} option is implied if
1643     the environment variable \raw{ROOT} is set.\footnote{E.g. if your root
1644       partition is mounted on \path{/mnt}, you can update the map by simply
1645       running \raw{ROOT=/mnt /mnt/sbin/lilo}}
1646     The current directory is changed to the new root directory, so using
1647     relative paths may not work.
1648   \item[\raw{-s \meta{save\_file}}]~\\
1649     Specifies an alternate boot sector save file. \seealso
1650   \item[\raw{-S \meta{save\_file}}]~\\
1651     Like \raw{-s}, but overwrites old save files.
1652   \item[\raw{-t}]~ \\
1653     Test only. This performs the entire installation procedure except
1654     replacing the map file, writing the modified boot sector and fixing
1655     partition tables. This
1656     can be used in conjunction with the \raw{-v} option to verify that
1657     \LILO\ will use sane values.
1658   \item[\raw{-v $\ldots$}]~\\
1659     Increase verbosity. \seealso
1660 \end{description}
1661
1662
1663 \subsubsection{Change default command line}
1664 \label{invcmd}
1665
1666 Changes \LILO's default command line. See also section \ref{bootsel}.
1667
1668 \begin{command}
1669   /sbin/lilo
1670     \unit{\[ -C \meta{config\_file} \]}
1671     \unit{\[ -m \meta{map\_file} \]}
1672     \unit{-R \[ \meta{word} $\ldots$ \]}
1673 \end{command}
1674
1675 \begin{description}
1676   \item[\raw{-C \meta{config\_file}}]~\\
1677     Specifies an alternate configuration file. See also section \ref{invshow}.
1678   \item[\raw{-m \meta{map\_file}}]~\\
1679     Specifies an alternate map file. \seealso
1680   \item[\raw{-R \meta{word $\ldots$}}]~ \\
1681     Stores the specified words in the map file. The boot loader uses those
1682     words as the default command line when booting the next time. That command
1683     line is removed from the map file by the boot loader by overwriting the
1684     sector immediately after reading it. The first word has
1685     to be the name of a boot image. If \raw{-R} is not followed by any words,
1686     the current default command line in the map file is erased.\footnote{%
1687       \raw{-R} is typically used in reboot scripts, e.g. \\
1688 %%beginskip
1689 \tt
1690 %%endskip
1691 \#!/bin/sh \\
1692 cd / \\
1693 /sbin/lilo -R "\$*" \&\& reboot}
1694     If the command line isn't valid, the map installer issues an error
1695     message and returns a non-zero exit code.
1696 \end{description}
1697
1698
1699 \subsubsection{Kernel name translation}
1700
1701 Determines the path of the kernel.
1702
1703 \begin{command}
1704   /sbin/lilo
1705     \unit{\[ -C \meta{config\_file} \]}
1706     \unit{-I \meta{name}}
1707     \unit{\[ \meta{options} \]}
1708 \end{command}
1709
1710 \begin{description}
1711   \item[\raw{-C \meta{config\_file}}]~\\
1712     Specifies an alternate configuration file. See also section \ref{invshow}.
1713   \item[\raw{-I \meta{name} {$[$} \meta{options} {$]$}}]~ \\
1714     Translates the specified label name to the path of the corresponding kernel
1715     image and prints that path on standard output. This can be used to
1716     synchronize
1717     files that depend on the kernel (e.g. the \name{ps} database). The image
1718     name can be obtained from the environment variable \raw{BOOT\_IMAGE}. An
1719     error message is issued and a non-zero exit code is returned if no
1720     matching label name can be found. The existence of the image file is
1721     verified if the option character \raw{v} is added.
1722 \end{description}
1723
1724
1725 \subsubsection{De-installation}
1726
1727 Restores the boot sector that was used before the installation of \LILO.
1728 Note that this option only works properly if \LILO's directories (e.g.
1729 \path{/boot}) have not been touched since the first installation. See also
1730 section \ref{deinst}.
1731
1732 \begin{command}
1733   /sbin/lilo
1734     \unit{\[ -C \meta{config\_file} \]}
1735     \unit{\[ -s \meta{save\_file} \]}
1736     \unit{-u \| -U}
1737     \unit{\[ \meta{boot\_device} \]}
1738 \end{command}
1739
1740 \begin{description}
1741   \item[\raw{-C \meta{config\_file}}]~\\
1742     Specifies an alternate configuration file. See also section \ref{invshow}.
1743   \item[\raw{-s \meta{save\_file}}]~\\
1744     Specifies an alternate boot sector save file. \seealso
1745   \item[\raw{-u {$[$} \meta{device\_name} {$]$}}]~ \\
1746     Restores the backup copy of the specified boot sector. If no device is
1747     specified, the value of the \verb"boot" variable is used. If this one
1748     is also unavailable, \LILO\ uses the current root device. The name of
1749     the backup copy is derived from the device name. The \verb"-s" option
1750     or the \verb"backup" variable can be used to override this.
1751     \LILO\ validates the backup copy by checking a time stamp.
1752   \item[\raw{-U {$[$} \meta{device\_name} {$]$}}]~ \\
1753     Like \verb"-u", but does not check the time stamp.
1754 \end{description}
1755
1756
1757 \subsubsection{Print version number}
1758
1759 \begin{command}
1760   /sbin/lilo -V
1761 \end{command}
1762
1763 \begin{description}
1764   \item[\raw{-V}]~ \\
1765     Print the version number and exit.
1766 \end{description}
1767
1768
1769 \subsubsection{Options corresponding to configuration variables}
1770 \label{corropt}
1771
1772 There are also many command-line options that correspond to configuration
1773 variables. See section \ref{cfgglo} for a description.
1774
1775 $$
1776 \begin{tabular}{l|l}
1777   Command-line option           & Configuration variable \\
1778   \hline
1779   \raw{-b \meta{boot\_device}}  & \raw{boot=\meta{boot\_device}} \\
1780   \raw{-c}                      & \raw{compact} \\
1781   \raw{-d \meta{tsecs}}         & \raw{delay=\meta{tsecs}} \\
1782   \raw{-D \meta{name}}          & \raw{default=\meta{name}} \\
1783   \raw{-i \meta{boot\_sector}}  & \raw{install=\meta{boot\_sector}} \\
1784   \raw{-L}                      & \raw{lba32} \\
1785   \raw{-l}                      & \raw{linear} \\
1786   \raw{-m \meta{map\_file}}     & \raw{map=\meta{map\_file}} \\
1787   \raw{-P fix}                  & \raw{fix-table} \\
1788   \raw{-P ignore}               & \raw{ignore-table} \\
1789   \raw{-s \meta{backup\_file}}  & \raw{backup=\meta{backup\_file}} \\
1790   \raw{-S \meta{backup\_file}}  & \raw{force-backup=\meta{backup\_file}} \\
1791   \raw{-v $\ldots$}             & \raw{verbose=\meta{level}} \\
1792 \end{tabular}
1793 $$
1794
1795
1796 \subsection{Configuration}
1797 \label{config}
1798
1799 The configuration information is stored in the file \path{/etc/lilo.conf}
1800 and consists of variable assignments.
1801
1802
1803 \subsubsection{Syntax}
1804 \label{syntax}
1805
1806 The following syntax rules apply:
1807
1808 \begin{itemize}
1809   \item flag variables consist of a single word and are followed by
1810     whitespace or the end of the file.
1811   \item string variables consist of the variable name, optional whitespace,
1812     an equal sign, optional whitespace, the value and required whitespace,
1813     or the end of the file.
1814   \item a non-empty sequence of blanks, tabs, newlines and comments counts
1815     as whitespace.
1816   \item variable names are case-insensitive. Values are usually case-sensitive,
1817     but there are a few exceptions. (See below.)
1818   \item tabs and newlines are special characters and may not be part of a
1819     variable name or a value. The use of other control characters and
1820     non-ASCII characters is discouraged.
1821   \item blanks and equal signs may only be part of a variable name or a
1822     value if they are escaped by a backslash or if the value is embedded in
1823     double quotes. An equal sign may not be the only character in a name or
1824     value.
1825   \item an escaped tab is converted to an escaped blank. An escaped newline
1826     is removed from the input stream. An escaped backslash (i.e. two
1827     backslashes) is converted to a backslash. Inside quoted strings, only
1828     double quotes, backslashes, dollar signs, and newlines can be escaped.
1829   \item quoted strings can be continued over several lines by ending each
1830     incomplete line with a backslash. A single space is inserted in the
1831     string for the line end and all spaces or tabs that follow immediately
1832     on the next line.
1833   \item environment variables can be used by specifying them in the form
1834     \verb"$"\meta{name} or \verb"${"\meta{name}\verb"}". Dollar signs can
1835     be escaped.
1836   \item comments begin with a number sign and end with the next newline.
1837     All characters (including backslashes) until the newline are ignored.
1838 \end{itemize}
1839
1840 Example:
1841 \begin{verbatim}
1842 boot = $FD
1843 install = menu
1844 map = $MNT/map
1845 compact
1846 read-only
1847 append = "nfsroot=/home/linux-install/root \
1848   nfsaddrs=128.178.156.28:128.178.156.24::255.255.255.0:lrcinst"
1849 image = $MNT/zImage
1850 \end{verbatim}
1851
1852
1853 \subsubsection{Global options}
1854 \label{cfgglo}
1855
1856 \path{/etc/lilo.conf} begins with a possibly empty global options section.
1857 Many global options can also be set from the command line, but storing
1858 permanent options in the configuration file is more convenient.
1859
1860 The following global options are recognized:
1861
1862 \begin{description}
1863   \item[\craw{backup=}\meta{backup\_file}] Copy the original boot sector to
1864     \meta{backup\_file} (which may also be a device, e.g. \path{/dev/null})
1865     instead of \path{/boot/boot.\meta{number}}
1866   \item[\craw{boot=}\meta{boot\_device}] Sets the name of the device (e.g.
1867     a hard disk partition) that contains
1868     the boot sector. If \craw{boot} is omitted, the boot sector is read from
1869     (and possibly written to) the device that is currently mounted as root.
1870   \item[\craw{change-rules}] Defines partition type numbers. See section
1871     \ref{ptcr} for details.
1872   \item[\craw{compact}] Tries to merge read requests for adjacent sectors into
1873     a single read request. This drastically reduces load time and keeps the
1874     map smaller. Using \craw{compact} is especially recommended when booting
1875     from a floppy disk.
1876     \craw{compact} may conflict with \craw{linear} or \craw{lba32}, see
1877     section \ref{othpro}.
1878   \item[\craw{default=}\meta{name}] Uses the specified image as the default
1879     boot image. If \craw{default} is omitted, the image appearing first in the
1880     configuration file is used.
1881   \item[\craw{delay=}\meta{tsecs}] Specifies the number of \emphasize{tenths}
1882     of a second
1883     \LILO\ should wait before booting the first image. This is useful on
1884     systems that immediately boot from the hard disk after enabling the
1885     keyboard. \LILO\ doesn't wait if \craw{delay} is omitted or if \craw{delay}
1886     is set to zero.
1887   \item[\craw{disk=}\meta{device\_name}] Defines non-standard parameters
1888     for the specified disk. See section \ref{diskgeo} for details.
1889   \item[\craw{fix-table}]\label{fix-table}Allows \LILO\ to adjust 3D addresses
1890     in partition
1891     tables. Each partition entry contains a 3D (sector/head/cylinder) and a
1892     linear 32-bit address of the first and the last sector of the partition.
1893     If a
1894     partition is not track-aligned and if certain other operating systems
1895     (e.g. PC/MS-DOS or OS/2) are using the same disk, they may change the 3D
1896     address. \LILO\ can store its boot sector only on partitions where both
1897     address types correspond. \LILO\ re-adjusts incorrect 3D start addresses
1898     if \craw{fix-table} is set.
1899
1900     \emphasize{WARNING:} This does not guarantee that other operating systems
1901     may not attempt to reset the address later. It is also possible that this
1902     change has other, unexpected side-effects. The correct fix is to
1903     re-partition the drive with a program that does align partitions to tracks.
1904     Also, with some disks (e.g. some large EIDE disks with address
1905     translation enabled), under some circumstances, it may even be unavoidable
1906     to have conflicting partition table entries.
1907   \item[\craw{force-backup=}\meta{backup\_file}] Like \craw{backup}, but
1908     overwrite an old backup copy if it exists.
1909     \craw{backup=}\meta{backup\_file}
1910     is ignored if \craw{force-backup} appears in the same configuration file.
1911   \item[\craw{ignore-table}] Tells LILO to ignore corrupt partition tables and
1912     to put the boot sector even on partitions that appear to be unsuitable for
1913     that.
1914   \item[\craw{install=}\meta{boot\_sector}] Install the specified file as the
1915     new boot sector. If \craw{install} is omitted, \path{install=text} is used
1916     as the default.
1917   \item[\craw{keytable=}\meta{table\_file}] Re-map the keyboard as specified
1918     in this file. See section \ref{keytab} for details.
1919   \item[\craw{lba32}] Generate 32-bit Logical Block Addresses instead of 
1920     sector/head/cylinder addresses. If the BIOS supports packet addressing, 
1921     then packet calls will be used to access the disk. This allows booting 
1922     from any partition on disks with more than 1024 cylinders. If the BIOS 
1923     does not support packet addressing, then \craw{lba32} addresses are 
1924     translated to C:H:S, just as for \craw{linear}. All floppy disk references 
1925     are retained in C:H:S form.  Use of \craw{lba32} is recommended on all 
1926     post-1998 systems.
1927     \craw{lba32} may conflict with \craw{compact}, see section \ref{othpro}.
1928   \item[\craw{linear}] Generate linear sector addresses instead of
1929     sector/head/cylinder addresses. Linear addresses are translated at run
1930     time and do not depend on disk geometry. Note that boot disks
1931     may not be portable if \craw{linear} is used,
1932     because the BIOS service to
1933     determine the disk geometry does not work reliably for floppy disks.
1934     When using \craw{linear} with large disks, \path{/sbin/lilo} may
1935     generate references to inaccessible disk areas (see section \ref{broken}),
1936     because 3D sector addresses are not known before boot time.
1937     \craw{linear} may conflict with \craw{compact}, see section \ref{othpro}.
1938   \item[\craw{map=}\meta{map\_file}] Specifies the location of the map file.
1939     If \craw{map} is omitted, a file \path{/boot/map} is used.
1940   \item[\craw{message=}\meta{message\_file}] Specifies a file containing a
1941     message that is displayed before the boot prompt. No message is displayed
1942     while waiting for a modifier key (\key{Shift}, etc.) after printing
1943     ``LILO ''. In the message, the \raw{FF}
1944     character (\hbox{\key{Ctrl L}}) clears the local screen. The size of the
1945     message file is limited to 65535 bytes. The map file has to be rebuilt
1946     if the message file is changed or moved.
1947   \item[\craw{nowarn}] Disables warnings about possible future dangers.
1948   \item[\craw{prompt}] Forces entering the boot prompt without expecting any
1949     prior key-presses. Unattended reboots are impossible if \craw{prompt} is
1950     set and \craw{timeout} isn't.
1951   \item[\craw{serial=}\meta{parameters}] Enables control from a serial line.
1952     The specified serial port is initialized and \LILO\ is accepting input from
1953     it and from the PC's keyboard. Sending a break on the serial line
1954     corresponds to pressing a shift key on the console in order to get
1955     \LILO's attention. All boot images should be password-protected if the
1956     serial access is less secure than access to the console, e.g. if the
1957     line is connected to a modem. The parameter string has the following
1958     syntax: \\
1959     \raw{\meta{port},\meta{bps}\,\meta{parity}\,\meta{bits}} \\
1960     The components \meta{bps}, \meta{parity} and \meta{bits} can be
1961     omitted. If a component is omitted, all following components have to
1962     be omitted too. Additionally, the comma has to be omitted if only the
1963     port number is specified.
1964     \begin{description}
1965       \item[\meta{port}] the number of the serial port, zero-based. 0
1966         corresponds to \path{COM1} alias \path{/dev/ttyS0}, etc. All four
1967         ports can be used (if present).
1968       \item[\meta{bps}] the baud rate of the serial port. The following
1969         baud rates are supported: 110, 300, 1200, 2400, 4800, 9600, 19200, and
1970         38400 bps. Default is 2400 bps.
1971       \item[\meta{parity}] the parity used on the serial line. \LILO\ ignores
1972         input parity and strips the 8th bit. The following (upper or lower
1973         case) characters are used to describe the parity: \raw{n} for no
1974         parity, \raw{e} for even parity and \raw{o} for odd parity.
1975       \item[\meta{bits}] the number of bits in a character. Only 7 and 8
1976         bits are supported. Default is 8 if parity is ``none'', 7 if parity
1977         is ``even'' or ``odd''.
1978     \end{description}
1979     If \craw{serial} is set, the value of \craw{delay} is automatically raised
1980     to 20.
1981
1982     Example: \verb"serial=0,2400n8" initializes \path{COM1} with the
1983     default parameters.
1984   \item[\craw{timeout=}\meta{tsecs}] Sets a timeout (in tenths of a second) for
1985     keyboard input. If no key is pressed for the specified time, the first
1986     image is automatically booted. Similarly, password input is aborted if
1987     the user is idle for too long. The default timeout is infinite.
1988   \item[\craw{verbose=}\meta{level}] Turns on lots of progress reporting.
1989     Higher numbers give more verbose output. If \raw{-v} is additionally
1990     specified on the command line, \meta{level} is increased accordingly.
1991     The following verbosity levels exist:
1992     \begin{description}
1993       \item[$<$0] only warnings and errors are shown
1994       \item[0] prints one line for each added or skipped image
1995       \item[1] mentions names of important files and devices and why they
1996         are accessed. Also displays informational messages for exceptional
1997         but harmless conditions and prints the version number.
1998       \item[2] displays statistics and processing of temporary files and
1999         devices
2000       \item[3] displays disk geometry information and partition table change
2001         rules
2002       \item[4] lists sector mappings as they are written into the map file
2003         (i.e. after compaction, in a format suitable to pass it to the BIOS)
2004       \item[5] lists the mapping of each sector (i.e. before compaction, raw)
2005     \end{description}
2006     When using the \raw{-q} option, the levels have a slightly different
2007     meaning:
2008     \begin{description}
2009       \item[0] displays only image names
2010       \item[1] also displays all global and per-image settings
2011       \item[2] displays the address of the first map sector
2012     \end{description}
2013 \end{description}
2014
2015 Additionally, the kernel configuration parameters \craw{append}, \craw{initrd},
2016 \craw{ramdisk}, \craw{read-only}, \craw{read-write}, \craw{root} and
2017 \craw{vga}, and the general per-image options \craw{fallback}, \craw{lock},
2018 \craw{optional}, \craw{password}, \craw{restricted}, and
2019 \craw{single-key} can be set in
2020 the global options section. They are used as defaults if they aren't specified
2021 in the configuration sections of the respective images. See below for a
2022 description.
2023
2024 The plethora of options may be intimidating at first, but in ``normal''
2025 configurations, hardly any options but \craw{boot}, \craw{compact},
2026 \craw{delay}, \craw{root}, and \craw{vga} are used.
2027
2028
2029 \subsubsection{General per-image options}
2030 \label{cfggen}
2031
2032 The following options can be specified for all images, independent of their
2033 type:
2034 \begin{description}
2035   \item[\craw{alias=}\meta{name}] Specifies a second name for the current
2036     entry.
2037   \item[\craw{fallback=}\meta{command\_line}] Specifies a string that is stored
2038     as the default command line if the current image is booted. This is useful
2039     when experimenting with kernels which may crash before allowing
2040     interaction with the system. If using the \craw{fallback} option, the
2041     next reboot (e.g. triggered by a manual reset or by a watchdog timer)
2042     will load a different (supposedly stable) kernel. The command line by the
2043     fallback mechanism is
2044     cleared by removing or changing the default command line with the \raw{-R}
2045     option, see \ref{invcmd}.
2046   \item[\craw{label=}\meta{name}] By default, \LILO\ uses the main file name
2047     (without its
2048     path) of each image specification to identify that image. A different name
2049     can be used by setting the variable \craw{label}.
2050   \item[\craw{lock}] Enables automatic recording of boot command lines as the
2051     defaults for the following boots. This way, \LILO\ ``locks'' on a
2052     choice until it is manually overridden.
2053   \item[\craw{optional}] Omit this image if its main file is not available at
2054     map creation time. This is useful to specify test kernels that are not
2055     always present.
2056   \item[\craw{password=}\meta{password}] Ask the user for a password when
2057     trying to load this image. Because the configuration file contains
2058     unencrypted passwords when using this option, it should only be readable
2059     for the super-user. Passwords are always case-sensitive.
2060   \item[\craw{restricted}] Relaxes the password protection by requiring a
2061     password only if parameters are specified on the command line
2062     (e.g. \verb"single"). \craw{restricted} can only be used together with
2063     \craw{password}.
2064   \item[\craw{single-key}] Enables booting the image by hitting a
2065     single key, without the need to press \key{Enter} afterwards.
2066     \craw{single-key} requires that either the image's label or its
2067     alias (or both) is a single character. Furthermore, no other image label
2068     or alias may start with that character, e.g. an entry specifying a
2069     label \raw{linux} and an alias \raw{l} is not allowed with
2070     \craw{single-key}. Note that you can't specify command-line parameters for
2071     an entry for which only \craw{single-key}ed names exist.
2072 \end{description}
2073
2074 All general per-image options, with the exception of \craw{label} and
2075 \craw{alias}, can also be set in the global options section as defaults
2076 for all images.
2077
2078 Example:
2079 \begin{verbatim}
2080 password = Geheim
2081 single-key
2082 image = /vmlinuz
2083   label = linux
2084   alias = 1
2085   restricted
2086 other = /dev/hda1
2087   label = dos
2088   alias = 2
2089 \end{verbatim}
2090
2091
2092 \subsubsection{Per-image options for kernels}
2093 \label{cfgkern}
2094
2095 Each (kernel or non-kernel)
2096 image description begins with a special variable (see section \ref{bootimg})
2097 which is followed by optional
2098 variables.
2099 The following variables can be used for all image descriptions
2100 that describe a Linux kernel:
2101
2102 \begin{description}
2103   \item[\craw{append=}\meta{string}] Appends the options specified in
2104     {\meta{string}} to the parameter line passed to the kernel. This is
2105     typically used to specify parameters of hardware that can't be entirely
2106     auto-detected, e.g.\\
2107     \verb'append = "aha152x=0x140,11"'
2108   \item[\craw{initrd=}\meta{name}] Specifies the file that will be loaded at
2109     boot time as the initial RAM disk. 
2110   \item[\craw{literal=}\meta{string}] like \craw{append}, but removes all other
2111     options (e.g. setting of the root device). Because vital options can be
2112     removed unintentionally with \craw{literal}, this option cannot be set in
2113     the global options section.
2114   \item[\craw{ramdisk=}\meta{size}] Specifies the size of the optional RAM disk.
2115     A value of zero indicates that no RAM disk should be created. If this
2116     variable is omitted, the RAM disk size configured into the boot
2117     image is used.
2118   \item[\craw{read-only}] Specifies that the root file system should be
2119     mounted read-only. Typically, the system startup procedure re-mounts
2120     the root file system read-write later (e.g. after fsck'ing it).
2121   \item[\craw{read-write}] specifies that the root file system should be
2122     mounted read-write.
2123   \item[\craw{root=}\meta{root\_device}] Specifies the device that should be
2124     mounted as root. If the special name \craw{current} is used, the root
2125     device is set to the device on which the root file system is currently
2126     mounted. If the root has been changed with \raw{-r}, the respective
2127     device is used. If the variable \craw{root} is omitted, the root device
2128     setting contained in the kernel image is used. It can be changed
2129     with the \name{rdev} program.
2130   \item[\craw{vga=}\meta{mode}]\label{vga} Specifies the VGA text mode that
2131     should be selected when booting. The following values are recognized
2132     (case is ignored):
2133     \begin{description}
2134       \item[\craw{normal}] select normal 80x25 text mode.
2135       \item[\craw{extended}] select 80x50 text mode. The word \craw{extended}
2136         can be abbreviated to \craw{ext}.
2137       \item[\craw{ask}] stop and ask for user input (at boot time).
2138       \item[\meta{number}] use the corresponding text mode. A list of available
2139         modes can be obtained by booting with \raw{vga=ask} and pressing
2140         \key{Enter}.
2141     \end{description}
2142     If this variable is omitted, the VGA mode setting contained in the kernel
2143     image is used. \name{rdev} supports manipulation of the VGA text mode
2144     setting in the kernel image.
2145 \end{description}
2146
2147 All kernel per-image options but \craw{literal} can also be set in the global
2148 options section as defaults for all kernels.
2149
2150 If one of \craw{ramdisk}, \craw{read-only}, \craw{read-write}, \craw{root},
2151 or \craw{vga} is omitted in the configuration file and the
2152 corresponding value in the kernel image is changed, \LILO\ or the kernel
2153 will use the new value.
2154
2155 It is perfectly valid to use different settings for the same
2156 image, because \LILO\ stores them in the image descriptors and not in the
2157 images themselves.
2158
2159 Example:
2160 \begin{verbatim}
2161 image = /vmlinuz
2162   label = lin-hd
2163   root = /dev/hda2
2164 image = /vmlinuz
2165   label = lin-fd
2166   root = /dev/fd0
2167 \end{verbatim}
2168
2169
2170 \subsection{Boot image types}
2171 \label{bootimg}
2172
2173 \LILO\ can boot the following types of images:
2174 \begin{itemize}
2175   \item kernel images from a file.
2176   \item kernel images from a block device. (E.g. a floppy disk.)
2177   \item the boot sector of some other operating system.
2178 \end{itemize}
2179
2180 The image type is determined by the name of the initial
2181 variable of the configuration section.
2182
2183 The image files can reside on any media that is accessible at boot time.
2184 There's no need to put them on the root device, although this certainly
2185 doesn't hurt.
2186
2187
2188 \subsubsection{Booting kernel images from a file}
2189
2190 The image is specified as follows: \craw{image=}\meta{name}
2191
2192 Example:
2193 \begin{verbatim}
2194 image = /linux
2195 \end{verbatim}
2196
2197 See sections \ref{cfggen} and \ref{cfgkern} for the options that can be
2198 added in a kernel image section.
2199
2200
2201 \subsubsection{Booting kernel images from a device}
2202
2203 The range of sectors
2204 that should be mapped has to be specified. Either a range
2205 (\raw{\meta{start}-\meta{end}}) or a start and a distance
2206 (\raw{\meta{start}+\meta{number}}) have to be specified. \meta{start}
2207 and \meta{end} are zero-based. If only
2208 the start is specified, only that sector is mapped.
2209
2210 The image is specified as follows: \craw{image=}\meta{device\_name}\quad
2211 Additionally, the \craw{range} variable must be set.
2212
2213 Example:
2214 \begin{verbatim}
2215 image = /dev/fd0
2216   range = 1+512
2217 \end{verbatim}
2218
2219 All kernel options can also be used when booting the kernel from a device.
2220
2221
2222 \subsubsection{Booting a foreign operating system}
2223 \label{bootfor}
2224
2225 \LILO\ can even boot other operating systems, i.e. MS-DOS.
2226 To boot an other operating
2227 system, the name of a loader program, the device or file that contains the boot
2228 sector and the device that contains the partition table have to be
2229 specified.
2230
2231 The boot sector is merged with the partition table and stored in the map file.
2232
2233 Currently, the loaders \path{chain.b} and \path{os2\_d.b} exist.
2234 \path{chain.b} simply starts the specified boot sector.\footnote{The boot
2235 sector is loaded by \LILO's secondary boot loader before control is passed
2236 to the code of \path{chain.b}.} \path{os2\_d.b} it a variant of \path{chain.b}
2237 that can boot OS/2 from the second hard disk.
2238 The \craw{map-drive} option has to be used with \path{os2\_d.b} to
2239 actually swap the drives.
2240
2241 The image is specified as follows: \craw{other=}\meta{device\_name} or
2242 \craw{other=}\meta{file\_name}
2243
2244 In addition to the options listen in section \ref{cfggen}, the following
2245 variables are recognized:
2246 \begin{description}
2247   \item[\craw{change}] Change the partition table according to the rules
2248     specified in this \craw{change} section. This option is intended for
2249     booting systems which find their partitions by examining the
2250     partition table. See section \ref{ptch} for details.
2251   \item[\craw{loader=}\meta{chain\_loader}] Specifies the chain loader that
2252     should be used. If it is omitted, \path{/boot/chain.b} is used.
2253   \item[\craw{map-drive=}\meta{bios\_device\_code}] Instructs \path{chain.b}
2254     to installs a resident driver that re-maps the floppy
2255     or hard disk drives. This way, one can boot any operating system from a
2256     hard disk different from the first one, as long as that operating system
2257     uses \emphasize{only} the BIOS to access that hard disk.\footnote{So you
2258 should be very suspicious if the
2259 operating system requires any specific configuration or even drivers to use
2260 the disk it is booted from. Since there is a general trend to use optimized
2261 drivers to fully exploit the hardware capabilities (e.g. non-blocking disk
2262 access), booting systems from the second disk may become increasingly
2263 difficult.} This is known to work for PC/MS-DOS.
2264
2265     \craw{map-drive} is followed by the variable
2266     \craw{to=}\meta{bios\_device\_code} which specifies the drive that should
2267     effectively be accessed instead of the original one.
2268     The list of mappings is only searched until the first match is found.
2269     It is therefore possible to ``swap'' drives, see the second example below.
2270   \item[\craw{table=}\meta{device}] Specifies the device that contains the
2271     partition
2272     table. \LILO\ does not pass partition information to the booted operating
2273     system if this variable is omitted. (Some operating systems have other
2274     means to determine from which partition they have been booted. E.g. MS-DOS
2275     usually stores the geometry of the boot disk or partition in its boot
2276     sector.) Note that \path{/sbin/lilo} must be re-run if a partition table
2277     mapped referenced with \craw{table} is modified.
2278   \item[\craw{unsafe}] Do not access the boot sector at map creation time. This
2279     disables some sanity checks, including a partition table check. If the boot
2280     sector is on a fixed-format floppy disk device, using \craw{unsafe} avoids
2281     the need to put a readable disk into the drive when running the map
2282     installer. \craw{unsafe} and \craw{table} are mutually incompatible.
2283 \end{description}
2284
2285 None of these options can be set in the global options section.
2286
2287 Examples:
2288 \begin{verbatim}
2289 other = /dev/hda2
2290   label = dos
2291   table = /dev/hda
2292 \end{verbatim}
2293
2294 \begin{verbatim}
2295 other = /dev/hdb2
2296   label = os2
2297   loader = /boot/os2_d.b
2298   map-drive = 0x80
2299     to = 0x81
2300   map-drive = 0x81
2301     to = 0x80
2302 \end{verbatim}
2303
2304
2305 \subsection{Disk geometry}
2306 \label{diskgeo}
2307
2308 For floppies and most hard disks, \LILO\ can obtain the
2309 disk geometry information from the kernel. Unfortunately, there are some
2310 exotic disks or adapters which may either not supply this information or
2311 which may even return incorrect information.
2312
2313 If no geometry information is available, \LILO\ reports either the error \\
2314 \raw{geo\_query\_dev HDIO\_GETGEO (dev 0x\meta{number})} \\
2315 or \\
2316 \raw{Device 0x\meta{number}: Got bad geometry \meta{sec}/\meta{hd}/%
2317 \meta{cyl}}
2318
2319 If incorrect information is returned, booting may fail in several ways,
2320 typically with a partial ``LILO'' banner message. In this document, that
2321 is called a ``geometry mismatch''.
2322
2323 The next step should be to attempt setting the \craw{lba32} or \craw{linear} 
2324 configuration variable or the \raw{-L} or \raw{-l} command-line option. If
2325 this doesn't help, the entire disk geometry has to be specified explicitly.
2326 Note that \craw{linear} doesn't always work with floppy disks.
2327
2328 Another common use of disk sections is if an (E)IDE and a SCSI drive are
2329 used in the same system and the BIOS is configured to use the SCSI drive
2330 as the first drive. (Normally, the (E)IDE drive would be the first drive
2331 and the SCSI drive would be the second one.) Since \LILO\ doesn't know
2332 how the BIOS is configured, it needs to be told explicitly about this
2333 arrangement. (See the second example below.)
2334
2335
2336 \subsubsection{Obtaining the geometry}
2337
2338 The disk geometry parameters can be obtained by booting MS-DOS and
2339 running the program \path{DPARAM.COM} with the hexadecimal BIOS code of
2340 the drive as its argument, e.g. \verb"dparam 0x80" for the first hard
2341 disk. It displays the number of sectors per
2342 track, the number of heads per cylinder and the number of cylinders.
2343 All three numbers are one-based.
2344
2345 Alternatively, the geometry may also be determined by reading the information
2346 presented by the ``setup'' section of the ROM-BIOS or by using certain disk
2347 utilities under operating systems accessing the disk through the BIOS.
2348
2349
2350 \subsubsection{Specifying the geometry}
2351 \label{diskspec}
2352
2353 Disk geometry parameters are specified in the options section of the
2354 configuration file. Each disk parameter section begins with
2355 \craw{disk=}\meta{disk\_device}, similar to the way how boot images are
2356 specified.
2357 It is suggested to group disk parameter sections together, preferably
2358 at the beginning or the end of the options section.
2359
2360 For each disk, the following variables can be specified:
2361 \begin{description}
2362   \item[\craw{bios=}\meta{bios\_device\_code}] Is the number the BIOS uses
2363     to refer to that device. Normally, it's \raw{0x80} for the first hard
2364     disk and \raw{0x81} for the second hard disk. Note that hexadecimal
2365     numbers have to begin with ``0x''. If \craw{bios} is omitted,
2366     \LILO\ tries to ``guess'' that number.
2367   \item[\craw{sectors=}\meta{sectors}] and
2368   \item[\craw{heads=}\meta{heads}] specify the number of sectors per
2369     track and the number of heads, i.e. the number of tracks per
2370     cylinder. Both parameters have to be either specified together or
2371     they have to be entirely omitted. If omitted, \LILO\ tries to obtain
2372     that geometry information from the kernel.
2373   \item[\craw{cylinders=}\meta{cylinders}] Specifies the number of cylinders.
2374     This value is only used for sanity checks. If \craw{cylinders} is omitted,
2375     \LILO\ uses the information obtained from the kernel if geometry
2376     information had to be requested in order to determine some other
2377     parameter. Otherwise,\footnote{I.e. if the BIOS device code, the number
2378     of sectors, the number of heads and the partition start are specified.
2379     Note that the number of cylinders may appear to vary if \craw{cylinders}
2380     is absent and only some of the partition starts are specified.} it just
2381     assumes the number of cylinders to be 1024, which is the cylinder limit
2382     imposed by the BIOS.
2383   \item[\craw{inaccessible}] Marks the device as inaccessible (for the BIOS).
2384     This is useful if some disks on the system can't be read by the BIOS,
2385     although \LILO\ ``thinks'' they can. If one accidentally tries to use
2386     files located on such disks for booting, the map installer won't notice
2387     and the system becomes unbootable. The most likely use of
2388     \craw{inaccessible} is to prevent repetition after experiencing such a
2389     situation once. No other variables may be specified if a device is
2390     configured as \craw{inaccessible}.
2391 \end{description}
2392
2393 Additionally, partition subsections can be added with
2394 \craw{partition=}\meta{partition\_device}. Each partition section can
2395 contain only one variable:
2396 \begin{description}
2397   \item[\craw{start=}\meta{partition\_offset}] Specifies the zero-based
2398     number of the start sector of that partition. The whole disk always
2399     has a partition offset of zero. The partition offset is only necessary
2400     when using devices for which the kernel does not provide that
2401     information, e.g. CD-ROMs.
2402 \end{description}
2403
2404 Examples:
2405 \begin{verbatim}
2406 disk = /dev/sda
2407   bios = 0x80
2408   sectors = 32
2409   heads = 64
2410   cylinders = 632
2411   partition = /dev/sda1
2412     start = 2048
2413   partition = /dev/sda2
2414     start = 204800
2415   partition = /dev/sda3
2416     start = 500000
2417   partition = /dev/sda4
2418     start = 900000
2419 \end{verbatim}
2420
2421 \begin{verbatim}
2422 disk = /dev/sda
2423   bios = 0x80
2424 disk = /dev/hda
2425   bios = 0x81
2426 \end{verbatim}
2427
2428
2429 \subsection{Partition table manipulation}
2430 \label{ptman}
2431
2432 Some non-Linux operating systems obtain information about their partitions
2433 (e.g. their equivalent of the root file system) from the partition table.
2434 If more than one such operating system is installed on a PC, they may have
2435 conflicting interpretations of the content of the partition table. Those
2436 problems can be avoided by changing the partition table, depending on which
2437 operating system is being booted.
2438
2439 Partition table changes are specified in a \craw{change} section in the
2440 configuration file section describing the foreign operating system. Note
2441 that \craw{change} sections are only accepted if the build-time option
2442 \raw{REWRITE\_TABLE} is set.
2443
2444 The \craw{change} section contains subsections for each partition whose
2445 table entry needs to be modified. Partitions are specified with
2446 \craw{partition=}\meta{device\_name}
2447
2448 Changes are applied in the sequence in which they appear in the
2449 configuration file. Configurations containing changes that are redundant
2450 either by repeating a previous change or by changing its result further
2451 are invalid and refused by the map installer.
2452
2453 Internally, all changes are expressed as rules which specify the location
2454 (disk and offset in the partition table), the value this location must
2455 contain before the change, and the value that has to be stored. As a
2456 safety measure, the rule is ignored if the previous value is found to be
2457 different.
2458
2459
2460 \subsubsection{Partition activation}
2461
2462 This option is intended for booting systems which determine their boot
2463 partition by examining the active flag in the partition table. The flag
2464 is enabled with \craw{activate} and disabled with \craw{deactivate}.
2465 Note that only the current partition is affected. \LILO\ does not
2466 automatically change the active flags of other partitions and it also
2467 allows more than one partition to be active at the same time.
2468
2469 Example:
2470
2471 \begin{verbatim}
2472 other = /dev/sda4
2473   label = sco
2474   change
2475     partition = /dev/sda4
2476       activate
2477     partition = /dev/sda3
2478       deactivate
2479 \end{verbatim}
2480
2481
2482 \subsubsection{Partition type change rules}
2483 \label{ptcr}
2484
2485 Partition type changes are normally a transition between two possible values,
2486 e.g. a typical convention is to set the lowest bit in the upper nibble of the
2487 partition type (i.e. 0x10) in order to
2488 ``hide'', and to clear it to ``unhide'' a partition. \LILO\ performs these
2489 changes based on a set of rules. Each rule defines the name of a partition
2490 type, its normal value, and the value when hidden. Those rules are defined
2491 in the options section of the configuration file. The section defining
2492 them begins with \craw{change-rules}.
2493
2494 The following options and variables can appear in the section:
2495 \begin{description}
2496   \item[\craw{reset}] Removes all previously defined rules. This is needed
2497     if a user doesn't wish to use the pre-defined rules (see below).
2498   \item[\craw{type=}\meta{name}] Adds a rule for the type with the specified
2499     name. Type names are case-insensitive.
2500     The values are defined with \craw{normal=}\meta{byte} and
2501     \craw{hidden=}\meta{byte}. Values can be specified as decimal or as
2502     hexadecimal numbers with a leading \raw{0x}. If only one of the values
2503     is present, the other value is assumed to be the same number,
2504     but with the most significant bit inverted.
2505 \end{description}
2506
2507 \LILO\ pre-defines rules for the three partition types of DOS partitions.
2508 The following example removes the pre-defined rules and creates them again:
2509
2510 \begin{verbatim}
2511 change-rules
2512   reset
2513   type = DOS12
2514     normal = 0x01
2515     hidden = 0x11
2516   type = DOS16_small
2517     normal = 4 # hidden is 0x14
2518   type = DOS16_big
2519     hidden = 0x16
2520 \end{verbatim}
2521
2522
2523 \subsubsection{Partition type changes}
2524 \label{ptch}
2525
2526 Partition type changes are specified in the partition section as
2527 \craw{set=}\meta{name}\craw{\_}\meta{state}, where \meta{name} is the
2528 name of the partition type, and \meta{state} is its state, i.e.
2529 \craw{normal} or \craw{hidden}.
2530
2531 Example:
2532
2533 \begin{verbatim}
2534 other = /dev/sda3
2535   label = dos
2536   change
2537     partition = /dev/sda2
2538       set = dos16_big_normal
2539     partition = /dev/sda3
2540       activate
2541       set = DOS16_big_normal
2542 \end{verbatim}
2543
2544 Only one \craw{set} variable is allowed per partition section. In the
2545 rare event that more than one \craw{set} variable is needed, further
2546 partition sections can be used.
2547
2548
2549 \subsection{Keyboard translation}
2550 \label{keytab}
2551
2552 The PC keyboard emits so-called scan codes, which are basically key
2553 numbers. The BIOS then translates those scan codes to the character codes
2554 of the characters printed on the key-caps. By default, the BIOS normally
2555 assumes that the keyboard has a US layout. Once an operating system is
2556 loaded, this operating system can use a different mapping.
2557
2558 At boot time, \LILO\ only has access to the basic services provided
2559 by the BIOS and therefore receives the character codes for an US keyboard.
2560 It provides a simple mechanism to re-map the character codes to what is
2561 appropriate for the actual layout.\footnote{The current mechanism isn't
2562 perfect, because it sits on top of the scan code to character code
2563 translation performed by the BIOS. This means that key combinations that
2564 don't produce any useful character on the US keyboard will be ignored by
2565 \LILO. The advantage of this approach is its simplicity.}
2566
2567
2568 \subsubsection{Compiling keyboard translation tables}
2569
2570 \LILO\ obtains layout information from the keyboard translation tables
2571 Linux uses for the text console. They are usually stored in
2572 \path{/usr/lib/kbd/keytables}. \LILO\ comes with a program
2573 \name{keytab-lilo.pl} that reads those tables and generates a table
2574 suitable for use by the map installer. \name{keytab-lilo.pl} invokes
2575 the program \name{loadkeys} to print the tables in a format that is
2576 easy to parse.\footnote{On some systems, only root can execute
2577 \name{loadkeys}. It is then necessary to run \name{keytab-lilo.pl} as
2578 root too.}
2579
2580 \name{keytab-lilo.pl} is used as follows:
2581
2582 \begin{command}
2583   keytab-lilo.pl
2584     \unit{\[ -p \meta{old\_code}=\meta{new\_code} \] $\ldots$}
2585     \unit{\[\meta{path}\]\meta{default\_layout}\[.\meta{extension}\] \]} \\
2586     \unit{\[\meta{path}\]\meta{kbd\_layout}\[.\meta{extension}\] \]}
2587 \end{command}
2588
2589 \begin{description}
2590   \item[\raw{-p \meta{old\_code}=\meta{new\_code}}]~\\
2591     Specifies corrections (``patches'') to the mapping obtained from the
2592     translation table files. E.g. if pressing the upper case ``A'' should
2593     yield an at sign, \verb"-p 65=64" would be used. The \raw{-p} option can
2594     be repeated any number of times. The codes can also be given as
2595     hexadecimal or as octal numbers if they are prefixed with \verb"0x" or
2596     \verb"0", respectively.
2597   \item[\meta{path}] The directory in which the file resides. The default
2598     path is \path{/usr/lib/kbd/keytables}.
2599   \item[\meta{extension}] Usually the trailing \path{.map}, which is
2600     automatically added if the file name doesn't contain dots.
2601   \item[\meta{default\_layout}] Is the layout which specifies the
2602     translation by the BIOS. If none is specified, \path{us} is assumed.
2603   \item[\meta{kbd\_layout}] Is the actual layout of the keyboard.
2604 \end{description}
2605
2606 \name{keytab-lilo.pl} writes the resulting translation table as a binary
2607 string to standard output. Such tables can be stored anywhere with any name,
2608 but the suggested naming convention is \path{/boot/\meta{kbd}.ktl}
2609 (``\underline{K}eyboard \underline{T}able for \underline{L}ilo''), where
2610 \meta{kbd} is the name of the keyboard layout.
2611
2612 Example:
2613 \begin{verbatim}
2614 keytab-lilo.pl de >/boot/de.ktl
2615 \end{verbatim}
2616
2617
2618 \subsubsection{Using keyboard translation tables}
2619
2620 The keyboard translation table file is specified with the global configuration
2621 option \raw{keytable=\meta{table\_file}}. The complete name of the file has
2622 to be given.
2623
2624 Example:
2625 \begin{verbatim}
2626 keytable = /boot/de.klt
2627 \end{verbatim}
2628
2629
2630 \newpage
2631 \section{Installation and updates}
2632
2633
2634 \subsection{Installation}
2635
2636 This section describes the installation of \LILO. See section \ref{deinst}
2637 for how to uninstall \LILO.
2638
2639
2640 \subsubsection{Compatibility}
2641
2642 The kernel header files have to be in
2643 \path{/usr/include/linux} and the kernel usually has to be configured by
2644 running \raw{make config} before \LILO\ can be compiled.
2645
2646 \path{/bin/sh} has to be a real Bourne shell. \name{bash} is sufficiently
2647 compatible, but some \name{ksh} clones may cause problems.
2648
2649 A file named \path{INCOMPAT} is included in the distribution. It describes
2650 incompatibilities to older versions of \LILO\ and may also contain further
2651 compatibility notes.
2652
2653
2654 \subsubsection{Quick installation}
2655 \label{quickinst}
2656
2657 If you want to install \LILO\ on your hard disk and if you don't want
2658 to use all its features, you can use the quick installation script.
2659 Read \path{QuickInst} for details.
2660
2661 \name{QuickInst} can only be used for first-time installations or to
2662 entirely replace an existing installation, \emphasize{not}
2663 to update or modify an existing installation of \LILO. Be sure you've
2664 extracted \LILO\ into a directory that doesn't contain any files of
2665 other \LILO\ installations.
2666
2667
2668 \subsubsection{Files}
2669
2670 Some of the files contained in \path{lilo-21.tar.gz}:
2671
2672 \begin{description}
2673   \item[\path{lilo/README}]~\\
2674     This documentation in plain ASCII format. Some sections containing
2675     complex tables are only included in the \LaTeX\ version in
2676     \path{doc/user.tex}
2677   \item[\path{lilo/INCOMPAT}]~\\
2678     List of incompatibilities to previous versions of \LILO.
2679   \item[\path{lilo/CHANGES}]~\\
2680     Change history.
2681   \item[\path{lilo/VERSION}]~\\
2682     The version number of the respective release.
2683   \item[\path{lilo/QuickInst}]~\\
2684     Quick installation script.
2685   \item[\path{lilo/lilo-\meta{version}.lsm}]~\\
2686     The LSM (``\underline{L}inux \underline{S}oftware \underline{M}ap'') entry
2687     of the respective \LILO\ release.
2688   \item[\path{lilo/Makefile}]~\\
2689     Makefile to generate everything else.
2690   \item[\path{lilo/*.c}, \path{lilo/*.h}]~\\
2691     LILO map installer C source and common header files.
2692   \item[\path{lilo/*.S}]~\\
2693     LILO boot loader assembler source.
2694   \item[\path{lilo/activate.c}]~\\
2695     C source of a simple boot partition setter.
2696   \item[\path{lilo/dparam.s}]~\\
2697     Assembler source of a disk parameter dumper.
2698   \item[\path{lilo/mkdist}]~\\
2699     Shell script used to create the current \LILO\ distribution.
2700   \item[\path{lilo/keytab-lilo.pl}]~\\
2701     Perl script to generate keyboard translation tables.
2702   \item[\path{lilo/doc/README}]~\\
2703     Description of how to generate the documentation.
2704   \item[\path{lilo/doc/Makefile}]~\\
2705     Makefile used to convert the \LaTeX\ source into either DVI output or
2706     the plain ASCII README file.
2707   \item[\path{lilo/doc/user.tex}]~\\
2708     \LaTeX\ source of \LILO's user's guide (this document).
2709   \item[\path{lilo/doc/tech.tex}]~\\
2710     \LaTeX\ source of \LILO's technical overview.
2711   \item[\path{lilo/doc/*.fig}]~\\
2712     Various \name{xfig} pictures used in the technical overview.
2713   \item[\path{lilo/doc/fullpage.sty}]~\\
2714     Style file to save a few square miles of forest.
2715   \item[\path{lilo/doc/rlatex}]~\\
2716     Shell script that invokes \LaTeX\ repeatedly until all references have
2717     settled.
2718   \item[\path{lilo/doc/t2a.pl}]~\\
2719     \name{Perl} script to convert the \LaTeX\ source of the user's guide to
2720     plain ASCII.
2721 \end{description}
2722
2723 Files created after \raw{make} in \path{lilo/} (among others):
2724
2725 \begin{description}
2726   \item[\path{lilo/boot.b}]~\\
2727     Combined boot sector. \raw{make install} puts this file into \path{/boot}
2728   \item[\path{lilo/chain.b}]~\\
2729     Generic chain loader. \raw{make install} puts this file into \path{/boot}
2730   \item[\path{lilo/os2\_d.b}]~\\
2731     Chain loader to load \name{OS/2} from the second hard disk.
2732     \raw{make install} puts this file into \path{/boot}
2733   \item[\path{lilo/lilo}]~\\
2734     \LILO\ (map) installer. \raw{make install} puts this file into \path{/sbin}
2735   \item[\path{lilo/activate}]~\\
2736     Simple boot partition setter.
2737   \item[\path{lilo/dparam.com}]~\\
2738     MS-DOS executable of the disk parameter dumper.
2739 \end{description}
2740
2741
2742 \subsubsection{Normal first-time installation}
2743 \label{install}
2744
2745 First, you have to install the \LILO\ files:
2746
2747 \begin{itemize}
2748   \item extract all files from \path{lilo-\meta{version}.tar.gz} in a new
2749     directory.\footnote{E.g. \path{/usr/src/lilo}}
2750   \item configure the \path{Makefile} (see section \ref{cfgmf})
2751   \item run\quad\raw{make}\quad to compile and assemble all parts.
2752   \item run\quad\raw{make install}\quad to copy all \LILO\ files to
2753      the directories where they're installed. \path{/sbin} should now
2754      contain the file \path{lilo},  \path{/usr/sbin} should contain
2755      \path{keytab-lilo.pl}, and
2756      \path{/boot} should contain \path{boot.b}, \path{chain.b}, and
2757      \path{os2\_d.b}.
2758 \end{itemize}
2759
2760 If you want to use \LILO\ on a non-standard disk, you might have to determine
2761 the parameters of your disk(s) and specify them in the configuration file.
2762 See section \ref{diskgeo} for details.
2763 If you're using such a non-standard system, the next step is to test
2764 \LILO\ with the boot sector on a floppy disk:
2765
2766 \begin{itemize}
2767   \item insert a blank (but low-level formatted) floppy disk into
2768     \path{/dev/fd0}.
2769   \item run \raw{echo image=\meta{kernel\_image}}\verb" |"\\
2770     \raw{/sbin/lilo -C - -b /dev/fd0 -v -v -v} \\
2771     If you've already installed \LILO\ on your system, you might not want
2772     to overwrite your old map file.
2773     Use the \raw{-m} option to specify an alternate map file name.
2774   \item reboot. \LILO\ should now load its boot loaders from the floppy disk
2775     and then continue loading the kernel from the hard disk.
2776 \end{itemize}
2777
2778 Now, you have to decide, which boot concept you want to use. Let's assume
2779 you have a Linux partition on \path{/dev/hda2} and you want to install your
2780 \LILO\ boot sector there. The DOS-MBR loads the \LILO\ boot sector.
2781
2782 \begin{itemize}
2783   \item get a working boot disk, e.g. an install or recovery disk. Verify that
2784     you can boot
2785     with this setup and that you can mount your Linux partition(s) with it.
2786   \item if the boot sector you want to overwrite with \LILO\ is of any value
2787     (e.g. it's the MBR or if it contains a boot loader you might want to use
2788     if you encounter problems with \LILO), you should mount your boot disk
2789     and make a backup copy of your boot sector to a file on that floppy,
2790     e.g. \verb"dd if=/dev/hda of=/fd/boot_sector bs=512 count=1"
2791   \item create the configuration file \path{/etc/lilo.conf}, e.g. \\
2792 \meta{global settings} \\
2793 \meta{image specification} \\
2794 \verb"  "\meta{per-image options} \\
2795 $\ldots$ \\
2796     Be sure to use absolute paths for all files. Relative paths may cause
2797     unexpected behaviour when using the \raw{-r} option.
2798   \item now, you can check what \LILO\ would do if you were about to install
2799     it on your hard disk: \\
2800 \verb"/sbin/lilo -v -v -v -t"
2801   \item if you need some additional boot utility (i.e. \name{BOOTACTV}), you
2802     should install that now
2803   \item run \path{/sbin/lilo} to install \LILO\ on your hard disk
2804   \item if you have to change the active partition, use \name{fdisk} or
2805     \name{activate} to do that
2806   \item reboot
2807 \end{itemize}
2808
2809
2810 \subsubsection{Build-time configuration}
2811 \label{cfgmf}
2812
2813 Certain build-time parameters can be configured.
2814 They can either be edited in the top-level \path{Makefile} or they can be
2815 stored in a file \path{/etc/lilo.defines}. Settings in the \path{Makefile}
2816 are ignored if that file exists.
2817
2818 The following items can be configured:
2819 \begin{description}
2820   \item[\raw{BEEP}] Enables beeping after displaying ``LILO''. This is
2821     useful on machines which don't beep at the right time when booting
2822     and when working over a serial
2823     console. This option is disabled by default.
2824   \item[\raw{IGNORECASE}] Makes image name matching case-insensitive, i.e.
2825     ``linux'' and ``Linux'' are identical. This option is enabled by
2826     default. Note that password matching is always case-sensitive.
2827   \item[\raw{LARGE\_EDBA}] Loads \LILO\ at a lower address in order to
2828     leave more space for the EBDA (Extended BIOS Data Area). This is
2829     necessary on some recent MP systems. Note that enabling \raw{LARGE\_EDBA}
2830     reduces the maximum size of ``small'' images (e.g. ``Image'' or
2831     ``zImage'').
2832   \item[\raw{NO1STDIAG}] Do not generate diagnostics on read errors in the
2833     first stage boot loader. This avoids possibly irritating error codes
2834     if the disk controller has transient read problems. This option is
2835     disabled by default.
2836   \item[\raw{NODRAIN}] The boot loader empties the keyboard buffer
2837     when starting, because it may contain garbage on some systems. Draining
2838     the keyboard buffer can be disabled by setting the \raw{NODRAIN} option.
2839     \raw{NODRAIN} is disabled by default.
2840   \item[\raw{NOINSTDEF}] If the option \craw{install} is omitted, don't install
2841     a new boot sector, but try to modify the old boot sector instead. This
2842     option is disabled by default.
2843   \item[\raw{ONE\_SHOT}] Disables the command-line timeout (configuration
2844     variable \craw{timeout}) if any key is pressed. This way, very short
2845     timeouts can be used if \craw{prompt} is set. \raw{ONE\_SHOT} is disabled
2846     by default.
2847   \item[\raw{READONLY}] Disallows overwriting the default command line sector
2848     of the map file. This way, command lines set with \raw{-R} stay in effect
2849     until they are explicitly removed. \raw{READONLY} also disables
2850     \craw{lock}, \craw{fallback}, and everything enabled by
2851     \raw{REWRITE\_TABLE}. This option is disabled by default.
2852   \item[\raw{REWRITE\_TABLE}] Enables rewriting the partition table at boot
2853     time. This may be necessary to boot certain operating systems who
2854     expect the active flag to be set on their partition or who need changes
2855     in partition types. See also section
2856     \ref{ptman}. This option is \emphasize{dangerous} and it is disabled by
2857     default.
2858   \item[\raw{USE\_TMPDIR}] Use the directory indicated in the \raw{TMPDIR}
2859     environment variable when creating temporary device files. If \raw{TMPDIR}
2860     is not set or if \LILO\ is compiled without \raw{USE\_TMPDIR}, temporary
2861     device files are created in \path{/tmp}.\footnote{Note that, while honoring
2862     \raw{TMPDIR} is the ``right'' thing to do, the fact that \LILO\ has to
2863     create temporary device files at all may indicate that the operating
2864     environment is not completely set up, so \raw{TMPDIR} may point to an
2865     invalid location.} This option is disabled by default.
2866   \item[\raw{VARSETUP}] Enables the use of variable-size setup segments.
2867     This option is enabled by default and is only provided to fall back to
2868     fixed-size setup segments in the unlikely case of problems when using
2869     prehistoric kernels.
2870   \item[\raw{XL\_SECS=\meta{sectors}}] Enable support for extra large
2871     (non-standard) floppy disks. The number of sectors is set in the BIOS
2872     disk parameter table to the specified value. Note that this hack may
2873     yield incorrect behaviour on some systems. This option is disabled by
2874     default.
2875 \end{description}
2876
2877 \path{/etc/lilo.defines} should be used if one wishes to make
2878 permanent configuration changes. The usual installation procedures don't
2879 touch that file. Example:
2880
2881 \begin{verbatim}
2882 -DIGNORECASE -DONE_SHOT
2883 \end{verbatim}
2884
2885 After changing the build-time configuration, \LILO\ has to be recompiled
2886 with the following commands:
2887
2888 \begin{verbatim}
2889 make distclean
2890 make
2891 \end{verbatim}
2892
2893
2894 \subsubsection{Floppy disk installation}
2895
2896 In some cases\footnote{E.g. if no hard disk is accessible through the BIOS.},
2897 it may be desirable to install \LILO\ on a floppy disk in a way that it can
2898 boot a kernel without accessing the hard disk.
2899
2900 The basic procedure is quite straightforward (see also section \ref{broken}):
2901 \begin{itemize}
2902   \item a file system has to be created on the file system
2903   \item the kernel and \path{boot.b} have to be copied to the floppy disk
2904   \item \path{/sbin/lilo} has to be run to create the map file
2905 \end{itemize}
2906
2907 This can be as easy as
2908 \begin{verbatim}
2909 /sbin/mke2fs /dev/fd0
2910 [ -d /fd ] || mkdir /fd
2911 mount /dev/fd0 /fd
2912 cp /boot/boot.b /fd
2913 cp /zImage /fd
2914 echo image=/fd/zImage label=linux |
2915   /sbin/lilo -C - -b /dev/fd0 -i /fd/boot.b -c -m /fd/map
2916 umount /fd
2917 \end{verbatim}
2918
2919 The command line of \path{/sbin/lilo} is a little tricky. \raw{-C -} takes
2920 the configuration from standard input (naturally, one could also write the
2921 configuration into a file), \raw{-b /dev/fd0} specifies that the boot sector
2922 is written to the floppy disk, \raw{-i /fd/boot.b} takes the first and second
2923 stage loaders from the floppy, \raw{-c} speeds up the load process, and
2924 \raw{-m /fd/map} puts the map file on the floppy too.
2925
2926
2927 \subsection{Updates}
2928
2929 \LILO\ is affected by updates of kernels, the whole system and (trivially)
2930 of \LILO\ itself. Typically, only \path{/sbin/lilo} has to be run after
2931 any of those updates and everything will be well again (at least as far
2932 as \LILO\ is concerned).
2933
2934
2935 \subsubsection{\LILO\ update}
2936 \label{liloupd}
2937
2938 Before updating to a new version of \LILO, you should read at least the 
2939 file \path{INCOMPAT} which describes incompatibilities with previous
2940 releases.
2941
2942 After that, the initial steps are the same as
2943 for a first time installation: extract all files, configure the \path{Makefile},
2944 run \raw{make} to build
2945 the executables and run \raw{make install} to install the files.
2946
2947 The old versions of \path{boot.b}, \path{chain.b}, etc. are automatically
2948 renamed to \path{boot.old}, \path{chain.old}, etc. This is done to ensure
2949 that you can boot even if the installation procedure does not finish.
2950 \path{boot.old}, \path{chain.old}, etc. can be deleted after the map file
2951 is rebuilt.
2952
2953 Because the locations of \path{boot.b}, \path{chain.b}, etc. have changed
2954 and because the map file format may be different too, you have to update
2955 the boot sector and the map file. Run \path{/sbin/lilo} to do this.
2956
2957
2958 \subsubsection{Kernel update}
2959 \label{kernupd}
2960
2961 Whenever any of the kernel files that are accessed by \LILO\ is moved or
2962 overwritten, the map has to be re-built.\footnote{It is advisable to
2963 keep a second, stable, kernel image that can be booted if you forget
2964 to update the map after a change to your usual kernel image.} Run
2965 \path{/sbin/lilo} to do this.
2966
2967 The kernel has a make target ``zlilo'' that copies the kernel
2968 to \path{/vmlinuz} and runs \path{/sbin/lilo}.
2969
2970
2971 \subsubsection{System upgrade}
2972
2973 Normally, system upgrades (i.e. installation or removal of packages, possibly
2974 replacement of a large part of the installed binaries) do not affect \LILO.
2975 Of course, if a new kernel is installed in the process, the normal kernel
2976 update procedure has to be followed (see section \ref{kernupd}). Also, if
2977 kernels are removed or added, it may be necessary to update the configuration
2978 file.
2979
2980 If \LILO\ is updated by this system upgrade, \path{/sbin/lilo} should be
2981 run before booting the upgraded system. It is generally a good idea not to
2982 rely on the upgrade procedure to perform this essential step automatically.
2983
2984 However, system upgrades which involve removal and re-creation of entire
2985 partitions (e.g. \path{/}, \path{/usr}, etc.) are different. First, they
2986 should be avoided, because they bear a high risk of losing other critical
2987 files, e.g. the \path{/etc/XF86Config} you've spent the last week fiddling
2988 with. If an upgrade really has to be performed in such a brute-force way,
2989 this is equal with total removal of \LILO, followed by a new installation.
2990 Therefore, the procedures described in the sections \ref{deinst} and
2991 \ref{liloupd} have to be performed. If you've forgotten to make a backup
2992 copy of \path{/etc/lilo.conf} before the destructive upgrade, you might
2993 also have to go through section \ref{install} again.
2994
2995
2996 \subsection{\LILO\ de-installation}
2997 \label{deinst}
2998
2999 In order to stop \LILO\ from being invoked when the system boots, its
3000 boot sector has to be either removed or disabled. All other files belonging
3001 to \LILO\ can be deleted \emphasize{after} removing the boot sector,
3002 if desired.%
3003 \footnote{Backup copies of old boot sectors may be needed when removing
3004 the boot sector. They are stored in \path{/boot}.}
3005
3006 Again, \emphasize{when removing Linux, \LILO\ must be de-installed before (!)
3007 its files (\path{/boot}, etc.) are deleted.} This is
3008 especially important if \LILO\ is operating as the MBR.
3009
3010 LILO 14 (and newer) can be de-installed with \verb"lilo -u". If LILO 14
3011 or newer is currently installed, but the first version of LILO installed was
3012 older than 14, \verb"lilo -U" may work. When using \verb"-U", the warning
3013 at the end of this section applies.
3014
3015 If \LILO's boot sector has been installed on a primary partition and is
3016 booted by the ``standard'' MBR or some partition switcher program, it can be
3017 disabled by making a different partition active. MS-DOS' FDISK, Linux
3018 \name{fdisk} or \LILO's \name{activate} can do that.
3019
3020 If \LILO's boot sector is the master boot record (MBR) of a disk, it has
3021 to be replaced with a different MBR, typically MS-DOS' ``standard'' MBR.
3022 When using MS-DOS 5.0 or above, the MS-DOS MBR can be restored with
3023 \verb"FDISK /MBR". This only alters the boot loader code, not the
3024 partition table.
3025
3026 \LILO\ automatically makes backup copies when it overwrites boot sectors.
3027 They are named \path{/boot/boot.\meta{nnnn}}, with \meta{nnnn}
3028 corresponding to the device number, e.g. \raw{0300} is \path{/dev/hda},
3029 \raw{0800} is \path{/dev/sda}, etc. Those backups can be used to restore
3030 the old MBR if no easier method is available. The commands are \\
3031 \raw{dd if=/boot/boot.0300 of=/dev/hda bs=446 count=1} or \\
3032 \raw{dd if=/boot/boot.0800 of=/dev/sda bs=446 count=1} \\
3033 respectively.
3034
3035 \emphasize{WARNING:} Some Linux distributions install \path{boot.\meta{nnnn}}
3036 files
3037 from the system where the distribution was created. Using
3038 those files may yield unpredictable results. Therefore, the file creation
3039 date should be carefully checked.
3040
3041
3042 \subsection{Installation of other operating systems}
3043 \label{instoth}
3044
3045 Some other operating systems (e.g. MS-DOS 6.0) appear to modify the MBR in
3046 their install procedures. It is therefore possible that \LILO\ will stop
3047 to work after such an installation and Linux has to be booted from floppy
3048 disk. The original state can be restored by either re-running
3049 \path{/sbin/lilo } (if \LILO\ is installed as the MBR) or by making
3050 \LILO's partition active (if it's installed on a primary partition).
3051
3052 It is generally a good idea to install \LILO\ after the other operating
3053 systems have been installed. E.g. OS/2 is said to cause trouble when
3054 attempting to add it to an existing Linux system. (However, booting
3055 from floppy and running \path{/sbin/lilo} should get around most
3056 interferences.)
3057
3058 Typically, the new operating system then has to be added to \LILO's
3059 configuration (and \path{/sbin/lilo} has to be re-run) in order to boot
3060 it.
3061
3062 See also section \ref{othpro} for a list of known problems with some
3063 other operating systems.
3064
3065
3066 \newpage
3067 \section{Troubleshooting}
3068
3069 All parts of \LILO\ display some messages that can be used to diagnose
3070 problems. 
3071
3072
3073 \subsection{Map installer warnings and errors}
3074
3075 Most messages of the map installer (\path{/sbin/lilo}) should be
3076 self-explanatory. Some messages that indicate common errors are
3077 listed below. They are grouped
3078 into fatal errors and warnings (non-fatal errors).
3079
3080
3081 \subsubsection{Fatal errors}
3082
3083 \begin{description}
3084   \item[\raw{Boot sector of \meta{device\_name} doesn't have a boot %
3085     signature}]
3086   \item[\raw{Boot sector of \meta{device\_name} doesn't have a LILO %
3087     signature}]~\\
3088     The sector from which \LILO\ should be uninstalled doesn't appear to be a
3089     \LILO\ boot sector.
3090   \item[\raw{Can't put the boot sector on logical partition \meta{number}}]~\\
3091     An attempt has been made to put \LILO's boot sector on the current
3092     root file system partition which is on a logical partition. This usually
3093     doesn't have the desired effect, because common MBRs can only boot
3094     primary partitions. This check can be bypassed by explicitly
3095     specifying the boot partition with the \raw{-b} option or by setting
3096     the configuration variable \craw{boot}.
3097   \item[\raw{Checksum error}]~\\
3098     The descriptor table of the map file has an invalid checksum. Refresh
3099     the map file \emphasize{immediately} !
3100   \item[\raw{Device 0x\meta{number}: Configured as inaccessible.}]~\\
3101      There is a \craw{disk} section entry indicating that the device is
3102      inaccessible
3103      from the BIOS. You should check carefully that all files \LILO\ tries to
3104      access when booting are on the right device.
3105   \item[\raw{Device 0x\meta{number}: Got bad geometry \meta{sec}/\meta{hd}/%
3106 \meta{cyl}}]~\\
3107     The device driver for your SCSI controller does not support geometry
3108     detection. You have to specify the geometry explicitly (see section
3109     \ref{diskgeo}).
3110   \item[\raw{Device 0x\meta{number}: Invalid partition table, entry %
3111     \meta{number}}]~\\
3112     The 3D and linear addresses of the first sector of the specified partition
3113     don't correspond. This is typically caused by partitioning a disk with
3114     a program that doesn't align partitions to tracks and later using
3115     PC/MS-DOS or OS/2 on that disk. \LILO\ can attempt to correct the problem,
3116     see page \pageref{fix-table}.
3117   \item[\raw{Device 0x\meta{number}: Partition type 0x\meta{number} does not
3118     seem suitable for a LILO boot sector}]~\\
3119     The location where the \LILO\ boot sector should be placed does not seem
3120     to be suitable for that. (See also also section \ref{diskorg}). You should
3121     either adjust the partition type to reflect the actual use or put the
3122     boot sector on a different partition. This consistency check only yields
3123     a warning (i.e. \LILO\ continues) if the option \craw{ignore-table} is
3124     set.
3125   \item[\raw{\meta{device\_name} is not a valid partition device}]~\\
3126     The specified device is either not a device at all, a whole disk, or
3127     a partition on a different disk than the one in whose section its
3128     entry appears.
3129   \item[\raw{\meta{device\_name} is not a whole disk device}]~\\
3130     Only the geometry of whole disks (e.g. \path{/dev/hda}, \path{/dev/sdb},
3131     etc.) can be redefined when using \craw{disk} sections.
3132   \item[\raw{DISKTAB and DISK are mutually exclusive}]~\\
3133     You cannot use a \path{disktab} file and disk geometry definitions in the
3134     configuration file at the same time. Maybe \path{/etc/disktab} was
3135     accidentally used, because that's the default for backward-compatibility.
3136     You should delete \path{/etc/disktab} after completing the transition to
3137     \craw{disk} sections.
3138   \item[\raw{Duplicate entry in partition table}]~\\
3139     A partition table entry appears twice. The partition table has to be
3140     fixed with \name{fdisk}.
3141   \item[\raw{Duplicate geometry definition for \meta{device\_name}}]~\\
3142     A disk or partition geometry definition entry for the same device appears
3143     twice in the configuration file. Note that you mustn't write a partition
3144     section for the whole disk --- its start sector is always the first
3145     sector of the disk.
3146   \item[\raw{First sector of \meta{device} doesn't have a valid boot %
3147     signature}]~\\
3148     The first sector of the specified device does not appear to be a valid
3149     boot sector. You might have confused the device name.\footnote{Because
3150     different partition programs may display the partitions in a different
3151     order, it is possible that what you think is your first partition isn't
3152     \path{/dev/hda1}, etc. A good method to verify the content of a partition
3153     is to try to mount it.}
3154   \item[\raw{geo\_comp\_addr: Cylinder \meta{number} beyond end of media %
3155     (\meta{number})}]~\\
3156     A file block appears to be located beyond the last cylinder of the disk.
3157     This probably indicates an error in the disk geometry specification (see
3158     section \ref{diskgeo}) or a file system corruption.
3159   \item[\raw{geo\_comp\_addr: Cylinder number is too big (\meta{number} $>$
3160    1023)}]~\\
3161     Blocks of a file are located beyond the 1024th cylinder of a hard disk.
3162     \LILO\ can't access such files, because the BIOS limits cylinder numbers to
3163     the range 0$\ldots$1023. Try moving the file to a different place,
3164     preferably a
3165     partition that is entirely within the first 1024 cylinders of the disk.
3166   \item[\raw{Hole found in map file (\meta{location})}]~\\
3167     The map installer is
3168     confused about the disk organization. Please report this error.
3169   \item[\raw{\meta{item} doesn't have a valid LILO signature}]~\\
3170     The specified item has been located, but is not part of \LILO.
3171   \item[\raw{\meta{item} has an invalid stage code (\meta{number})}]~\\
3172     The specified item has probably been corrupted. Try re-building
3173     \LILO.
3174   \item[\raw{\meta{item} is version \meta{number}. Expecting version%
3175       \meta{number}.}]~\\
3176     The specified entity is either too old or too new. Make sure all parts
3177     of \LILO\ (map installer, boot loaders and chain loaders) are from the
3178     same distribution. \footnote{The expected version number may be different
3179     from the version number of the \LILO\ package, because file version
3180     numbers are only increased when the file formats change.}
3181   \item[\raw{Kernel \meta{name} is too big}]~\\
3182     The kernel image (without the setup
3183     code) is bigger than 512 kbytes (or 448 kbytes, if built with
3184     \raw{LARGE\_EDBA}). \LILO\ would overwrite itself when trying
3185     to load such a kernel. This limitation only applies to old kernels which
3186     are loaded below 0x10000 (e.g. ``Image'' or ``zImage''). Try building the
3187     kernel with ``bzImage''. If this is undesirable for some reason, try
3188     removing some unused drivers and compiling the kernel again.
3189     This error may also occur if the kernel image is damaged or if it
3190     contains trailing ``junk'', e.g. as the result of copying an entire boot
3191     floppy to the hard disk.
3192   \item[\raw{LOCK and FALLBACK are mutually exclusive}]~\\
3193     Since \craw{lock} and \craw{fallback} both change the default command line,
3194     they can't be reasonably used together.
3195   \item[\raw{Map \meta{path} is not a regular file.}]~\\
3196     This is probably the result of an attempt to omit writing a map file, e.g.
3197     with \raw{-m /dev/null}. The \raw{-t} option should be used to accomplish
3198     this.
3199   \item[\raw{Must specify SECTORS and HEADS together}]~\\
3200     It is assumed that disks with a ``strange'' number of sectors will also
3201     have a ``strange'' number of heads. Therefore, it's all or nothing.
3202   \item[\raw{No geometry variables allowed if INACCESSIBLE}]~\\
3203     If a device is configured as \craw{inaccessible} (see section
3204     \ref{diskspec}),
3205     its \craw{disk} section must not contain any geometry variables.
3206   \item[\raw{No image \meta{image} is defined}]~\\
3207     The command line specified either with the \raw{-R} option or with
3208     \craw{fallback} does not contain the name of a valid image. Note that
3209     optional images which have not been included in the map file are not
3210     considered as valid.
3211   \item[\raw{Partition entry not found}]~\\
3212     The partition from which an other
3213     operating system should be booted isn't listed in the specified
3214     partition table. This either means that an incorrect partition
3215     table has been specified or that you're trying to boot from a
3216     logical partition. The latter usually doesn't work. You can bypass
3217     this check by omitting the partition table specification (e.g.
3218     omitting the variable \craw{table}).
3219   \item[\raw{Single-key clash: "\meta{name}" vs. "\meta{name}"}]~\\
3220     The specified image labels or aliases conflict because one
3221     of them is a single character and has the \craw{single-key} option set,
3222     and the other name begins with that character.
3223   \item[\raw{Sorry, don't know how to handle device \meta{number}}]~\\
3224     \LILO\ uses files that are located on a device for which
3225     there is no easy way to determine the disk geometry. Such devices have
3226     to be explicitly described, see section \ref{diskgeo}.
3227   \item[\raw{This LILO is compiled READONLY and doesn't support $\ldots$}]~\\
3228     If \LILO\ is not allowed to write to the disk at boot time (see section
3229     \ref{cfgmf}), options like \craw{lock} and \craw{fallback} are unavailable.
3230   \item[\raw{This LILO is compiled without REWRITE\_TABLE and doesn't support
3231     $\ldots$}]~\\
3232     If \LILO\ is not allowed to rewrite partition tables at boot time (see
3233     section \ref{ptman}), options like \craw{activate} and \craw{set} (in a
3234     \craw{change} section) are unavailable. You may also get this error if
3235     \LILO\ is compiled with \raw{READONLY} enabled.
3236   \item[\raw{Timestamp in boot sector of \meta{device} differs from date of %
3237     \meta{file}}]~\\
3238     The backup copy of the boot sector does not appear to be an ancestor of
3239     the current boot sector. If you are absolutely sure that the boot sector
3240     is indeed correct, you can bypass this check by using \raw{-U} instead
3241     of \raw{-u}.
3242   \item[\raw{Trying to map files from unnamed device 0x\meta{number}
3243     (NFS ?)}]~\\
3244     This is probably the same problem as described below, only with the
3245     root file system residing on NFS.
3246   \item[\raw{Trying to map files from your RAM disk.
3247     Please check -r option or ROOT environment variable.}]~\\
3248     Most likely, you or some installation script is trying to invoke
3249     \LILO\ in a way that some of the files is has to access reside on the
3250     RAM disk. Normally, the \raw{ROOT} environment variable should be set
3251     to the mount point of the effective root device if installing
3252     \LILO\ with a different root directory. See also sections \ref{creupd}
3253     and \ref{install}.
3254   \item[\raw{VGA mode presetting is not supported by your kernel.}]~\\
3255     Your kernel sources appear to be very old ('93 ?). \LILO\ may work on
3256     your system if you remove the \craw{vga} option.
3257   \item[\raw{write \meta{item}: \meta{error\_reason}}]~\\
3258     The disk is probably full or mounted read-only.
3259 \end{description}
3260
3261
3262 \subsubsection{Warnings}
3263 \label{warnings}
3264
3265 Messages labeled with ``Warning'' can be turned off with the \craw{nowarn}
3266 option.
3267
3268 \begin{description}
3269   \item[\raw{FIGETBSZ \meta{file\_name}: \meta{ error\_reason}}]~\\
3270     The map installer is unable to determine the block size of a file system.
3271     It assumes a block size of two sectors (1kB).
3272   \item[\raw{Ignoring entry '\meta{variable\_name}'}]~\\
3273     The command-line option corresponding to the specified variable is set.
3274     Therefore, the configuration file entry is ignored.
3275   \item[\raw{Setting DELAY to 20 (2 seconds)}]~\\
3276     Because accidentally booting the wrong kernel or operating system may
3277     be very inconvenient on systems that are not run from a local display,
3278     the minimum delay is two seconds if the \craw{serial} variable is set.
3279   \item[\raw{(temp) \meta{item}: \meta{error\_reason}}]~\\
3280     Deleting a temporary file has failed for the specified reason.
3281   \item[\raw{Warning: BIOS drive 0x\meta{number} may not be accessible}]~\\
3282     Because most BIOS versions only support two floppies and two hard disks,
3283     files located on additional disks may be inaccessible. This warning
3284     indicates that some kernels or even the whole system may be unbootable.
3285   \item[\raw{Warning: COMPACT may conflict with LINEAR on some systems}]~\\
3286     Please see section \ref{othpro} for a description of this problem.
3287   \item[\raw{Warning: \meta{config\_file} should be owned by root}]~\\
3288     In order to prevent users from compromising system integrity, the
3289     configuration file should be owned by root and write access for all other
3290     users should be disabled.
3291   \item[\raw{Warning: \meta{config\_file} should be readable only for root if
3292     using PASSWORD}]~\\
3293     Users should not be allowed to read the configuration file when using the
3294     \craw{password} option, because then, it contains unencrypted passwords.
3295   \item[\raw{Warning: \meta{config\_file} should be writable only for root}]~\\
3296     See ``\raw{Warning: \meta{config\_file} should be owned by root}''.
3297   \item[\raw{Warning: device 0x\meta{number} exceeds 1024 cylinder limit}]~\\
3298     A disk or partition exceeds the 1024 cylinder limit imposed by the BIOS.
3299     This may result in a fatal error in the current installation run or in
3300     later installation runs. See ``\raw{geo\_comp\_addr:
3301     Cylinder number is too big (\meta{number} $>$ 1023)}'' for details.
3302   \item[\raw{Warning: \meta{device} is not on the first disk}]~\\
3303     The specified partition is probably not on the first disk. \LILO's boot
3304     sector can only be booted from the first disk unless some special boot
3305     manager is used.
3306   \item[\raw{WARNING: The system is unbootable !}]~\\
3307     One of the last installation steps has failed. This warning is typically
3308     followed by a fatal error describing the problem.
3309 \end{description}
3310
3311
3312 \subsection{Boot loader messages}
3313
3314 The boot loader generates three types of messages: progress and error messages
3315 while it is loading, messages indicating disk access errors, and error
3316 messages in response to invalid command-line input. Since messages of the
3317 latter type are usually self-explanatory, only the two other categories
3318 are explained.
3319
3320
3321 \subsubsection{\LILO\ start message}
3322
3323 When \LILO\ loads itself, it displays the word ``LILO''. Each letter is
3324 printed before or after performing some specific action. If \LILO\ fails
3325 at some point, the letters printed so far can be used to identify the
3326 problem. This is described in more detail in the technical overview.
3327
3328 Note that some hex digits may be inserted after the first ``L'' if a
3329 transient disk problem occurs. Unless LILO stops at that point, generating
3330 an endless stream of error codes, such hex digits do not indicate a
3331 severe problem.
3332
3333 \begin{description}
3334   \item[\rm (\meta{nothing})] No part of \LILO\ has been loaded.
3335     \LILO\ either isn't installed or the partition on which its boot
3336     sector is located isn't active.
3337   \item[\raw{L \meta{error} $\ldots$}] The first stage boot loader has been
3338     loaded and started, but it can't load the second stage boot loader.
3339     The two-digit error codes indicate the type of problem. (See also section
3340     \ref{bioserr}.) This condition usually indicates a media failure or a
3341     geometry mismatch (e.g. bad disk parameters, see section \ref{diskgeo}).
3342   \item[\raw{LI}] The first stage boot loader was able to load the second
3343     stage boot loader, but has failed to execute it. This can either be
3344     caused by a geometry mismatch or by moving \path{/boot/boot.b} without
3345     running the map installer.
3346   \item[\raw{LIL}] The second stage boot loader has been started, but it
3347     can't load the descriptor table from the map file. This is typically
3348     caused by a media failure or by a geometry mismatch.
3349   \item[\raw{LIL?}] The second stage boot loader has been loaded at an
3350     incorrect address. This is typically caused by a subtle geometry
3351     mismatch or by moving \path{/boot/boot.b} without running the map
3352     installer.
3353   \item[\raw{LIL-}] The descriptor table is corrupt. This can either be caused
3354     by a geometry mismatch or by moving \path{/boot/map} without running
3355     the map installer.
3356   \item[\raw{LILO}] All parts of \LILO\ have been successfully loaded.
3357 \end{description}
3358
3359
3360 \subsubsection{Disk error codes}
3361 \label{bioserr}
3362
3363 If the BIOS signals an error when \LILO\ is trying to load a boot
3364 image, the respective error code is displayed. The following BIOS
3365 error codes are known:
3366
3367 \begin{description}
3368   \item[\raw{0x00}] ``Internal error''. This code is generated by
3369     the sector read routine of the \LILO\ boot loader whenever an
3370     internal inconsistency is detected. This might be caused by corrupt
3371     files. Try re-building the map file. Another possible cause for this
3372     error are attempts to access cylinders beyond 1024 while using the
3373     \craw{linear} option. See section \ref{broken} for more details and
3374     for how to solve the problem.
3375   \item[\raw{0x01}] ``Illegal command''. This shouldn't happen, but if it
3376     does, it may indicate an attempt to access a disk which is not supported
3377     by the BIOS. See also ``Warning: BIOS drive 0x\meta{number} may not be
3378     accessible'' in section \ref{warnings}.
3379   \item[\raw{0x02}] ``Address mark not found''. This usually indicates
3380     a media problem. Try again several times.
3381   \item[\raw{0x03}] ``Write-protected disk''. This should only occur on
3382     write operations.
3383   \item[\raw{0x04}] ``Sector not found''. This typically indicates a
3384     geometry mismatch. If you're booting a raw-written disk image, verify
3385     whether it was created for disks with the same geometry as the one
3386     you're using. If you're booting from a SCSI disk or a large IDE disk,
3387     you should check,
3388     whether \LILO\ has obtained correct geometry data from the kernel or
3389     whether the geometry definition corresponds
3390     to the real disk geometry. (See section \ref{diskgeo}.) Removing
3391     \craw{compact} may help too. So may adding \craw{lba32} or \craw{linear}.
3392   \item[\raw{0x06}] ``Change line active''. This should be a transient
3393     error. Try booting a second time.
3394   \item[\raw{0x07}] ``Invalid initialization''. The BIOS failed to properly
3395     initialize the disk controller. You should control the BIOS setup
3396     parameters. A warm boot might help too.
3397   \item[\raw{0x08}] ``DMA overrun''. This shouldn't happen. Try booting
3398     again.
3399   \item[\raw{0x09}] ``DMA attempt across 64k boundary''. This shouldn't
3400     happen, but may inicate a disk geometry mis-match. Try omitting 
3401     the \craw{compact} option. You may need to specify the disk geometry 
3402     yourself.
3403   \item[\raw{0x0C}] ``Invalid media''. This shouldn't happen and might
3404     be caused by a media error. Try booting again.
3405   \item[\raw{0x10}] ``CRC error''. A media error has been detected. Try
3406     booting several times,
3407     running the map installer a second time (to put the map file at some
3408     other physical location or to write ``good data'' over
3409     the bad spot), mapping out the bad sectors/tracks and, if all else
3410     fails, replacing the media.
3411   \item[\raw{0x11}] ``ECC correction successful''. A read error occurred,
3412     but was corrected. \LILO\ does not recognize this condition and
3413     aborts the load process anyway. A second load attempt should
3414     succeed.
3415   \item[\raw{0x20}] ``Controller error''. This shouldn't happen.
3416   \item[\raw{0x40}] ``Seek failure''. This might be a media problem. Try
3417     booting again.
3418   \item[\raw{0x80}] ``Disk timeout''. The disk or the drive isn't ready.
3419     Either the media is bad or the disk isn't spinning. If you're booting
3420     from a floppy, you might not have closed the drive door. Otherwise,
3421     trying to boot again might help.
3422   \item[\raw{0xBB}] ``BIOS error''. This shouldn't happen. Try booting
3423     again. If the problem persists, removing the \craw{compact} option or
3424     adding/removing \craw{linear} or \craw{lba32} might help.
3425 \end{description}
3426
3427 If the error occurred during a write operation, the error code (two hex
3428 digits) is prefixed with a ``W''. Although write errors don't affect the
3429 boot process, they might indicate a severe problem, because they usually
3430 imply that \LILO\ has tried to write to an invalid location.
3431 If spurious write errors occur on a system, it might be a good idea
3432 to configure \LILO\ to run read-only (see section \ref{cfgmf}).
3433
3434 Generally, invalid geometry and attempts to use more than two disks without a
3435 very modern BIOS may yield misleading error codes. Please check carefully
3436 if \path{/sbin/lilo} doesn't emit any warnings. Then try using the
3437 \craw{linear} or \craw{lba32} option (see section \ref{cfgglo}).
3438
3439
3440 \subsection{Other problems}
3441 \label{othpro}
3442
3443 This section contains a collection of less common problems that have been
3444 observed. See also section \ref{instoth} for general remarks on using
3445 \LILO\ with other operating systems. Some of the problems are obscure and
3446 so are the work-arounds.
3447
3448 \begin{itemize}
3449   \item If \LILO\ doesn't go away even if you erase its files, format your
3450     Linux partition, etc., you've probably installed \LILO\ as your MBR and
3451     you've forgotten to deinstall it before deleting its files. See section
3452     \ref{deinst} for what you can do now.
3453   \item For yet unknown reasons, \LILO\ may fail on some systems with
3454     AMI BIOS if the ``Hard Disk Type 47 RAM area'' is set to ``0:300''
3455     instead of ``DOS 1K''.
3456   \item Some disk controller BIOSes perform disk geometry/address translations
3457     that
3458     are incompatible with the way the device's geometry is seen from Linux,
3459     i.e. without going through the BIOS. Particularly, large IDE disks and
3460     some PCI SCSI
3461     controllers appear to have this problem. In such cases, either the
3462     translated geometry has to be specified in a \craw{disk} section or the
3463     sector address translation can be deferred by using the \craw{linear}
3464     option. In a setup where floppies are not normally used for booting,
3465     the \craw{linear} approach should be preferred, because this avoids
3466     the risk of specifying incorrect numbers.
3467   \item OS/2 is said to be bootable from a logical partition with
3468     \LILO\ acting as the primary boot selector if \LILO\ is installed on
3469     the MBR, the OS/2 BootManager is on an active primary partition and
3470     \LILO\ boots BootManager. Putting \LILO\ on an extended partition
3471     instead is said to crash the OS/2 FDISK in this scenario.
3472
3473     Note that booting \LILO\ from BootManager (so BootManager is the
3474     primary selector) or booting OS/2 directly from a primary partition
3475     (without BootManager) should generally work. See also section
3476     \ref{instoth}.
3477   \item Windows NT is reported to be bootable with \LILO\ when \LILO\ acts as
3478     the MBR and the Windows NT boot loader is on the DOS partition. However,
3479     NT's disk manager complains about LILO's MBR when trying to edit the
3480     partition table.
3481   \item Some PC UNIX systems (SCO and Unixware have been reported to exhibit
3482     this problem) depend on their partition being active. See section
3483     \ref{ptman} for how this can be accomplished.
3484   \item Future Domain TMC-1680 adapters with the BIOS versions 3.4 and 3.5
3485     assign BIOS device numbers in the wrong order, e.g. on a two-disk system,
3486     \path{/dev/sda} becomes \raw{0x81} and \path{/dev/sdb} becomes
3487     \raw{0x80}. This can be fixed with the following \craw{disk} section:\\
3488     \verb"disk=/dev/sda bios=0x81 disk=/dev/sdb bios=0x80"\\
3489     Note that this is only valid for a two-disk system. In three-disk
3490     systems, \path{/dev/sdc} would become \raw{0x80}, etc. Also, single-disk
3491     systems don't have this problem (and the ``fix'' would break them).
3492   \item Some BIOSes don't properly recognize disks with an unusual partition
3493     table (e.g. without any partition marked active) and refuse to boot from
3494     them. This can also affect the second hard disk and the problem may
3495     only occur if the system is booted in a particular way (e.g. only after a
3496     cold boot).
3497   \item On some systems, using \craw{linear} and \craw{compact} or 
3498     \craw{lba32} and \craw{compact} together
3499     leads to a boot failure. The exact circumstances under which this
3500     happens are still unknown.
3501 \end{itemize}
3502
3503 %%beginskip
3504 \end{document}
3505 %%endskip