old-www/FAQ/Linux-FAQ/booting.html

923 lines
15 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>Booting the OS</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="The Linux FAQ"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Linux Distributions"
HREF="linux-distributions.html"><LINK
REL="NEXT"
TITLE="Application Software Management"
HREF="app-management.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>The Linux FAQ</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="linux-distributions.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="app-management.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="booting"
></A
>8. Booting the OS</H1
><DIV
CLASS="qandaset"
><DL
><DT
>Q: <A
HREF="booting.html#boot-linux-from-ms-dos"
>Can Linux Boot from MS-DOS?</A
></DT
><DT
>Q: <A
HREF="booting.html#boot-linux-from-os2s-boot"
>How Can Linux Boot from OS/2's Boot Manager?</A
></DT
><DT
>Q: <A
HREF="booting.html#boot-time-parameters"
>How Do I Set the Boot-Time Configuration?</A
></DT
><DT
>Q: <A
HREF="booting.html#lilo-boot-kernel-image"
>How Do I Get LILO to Boot the Kernel Image?</A
></DT
><DT
>Q: <A
HREF="booting.html#remove-lilo-so-my-system-boots"
>Can I Remove LILO So the System Boots DOS Again?</A
></DT
><DT
>Q: <A
HREF="booting.html#partitions-checked-each-reboot"
>Why Does the System Check the Ext2fs Partitions Each Reboot?</A
></DT
><DT
>Q: <A
HREF="booting.html#make-sure-it-boots"
>How Do I Make Sure the System Boots after Re-Installing the Operating System?</A
></DT
><DT
>Q: <A
HREF="booting.html#make-rescue-floppy"
>How To Make a Rescue Floppy</A
></DT
></DL
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="boot-linux-from-ms-dos"
></A
><B
>Q: </B
>Can Linux Boot from MS-DOS?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>If LILO doesn't work, and if the machine has MS-DOS or
Microsoft Windows, you may be left with a computer that won't boot. This can
also happen on an upgrade to your Linux distribution. Re-installing LILO is
the last thing that the installation does.
</P
><P
>It is vitally important when installing or upgrading Linux on a dual boot
machine, to have a MS-DOS or Windows rescue disk nearby so you can
<TT
CLASS="literal"
>FDISK -MBR</TT
>. Then you can go about using <TT
CLASS="filename"
>LOADLIN.EXE</TT
>
instead of LILO.
</P
><P
>This <TT
CLASS="filename"
>config.sys</TT
> file is one possible way to
invoke <TT
CLASS="filename"
>LOADLIN.EXE</TT
> and boot MS-DOS or Linux.
</P
><P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
> [menu] menuitem=DOS, Dos Boot menuitem=LINUX, Linux Boot
[LINUX] shell=c: edhatloadlin.exe c: edhatautobootvmlinuz vga=5 root=/dev
[DOS] STACKS = 0,0 rem all the other DOS drivers get loaded here.
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>This creates a menu where you can directly jump to
<TT
CLASS="filename"
>LOADLIN.EXE</TT
> before all of the MS-DOS drivers get loaded.
</P
><P
>The paths and options are peculiar to one machine and should
be intuitively obvious to the most casual observer. See the
<TT
CLASS="filename"
>LOADLIN.EXE</TT
> docs for options. They are the same as LILO,
and options are just passed to the kernel, anyhow.
</P
><P
>[Jim Harvey]
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="boot-linux-from-os2s-boot"
></A
><B
>Q: </B
>How Can Linux Boot from OS/2's Boot Manager?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>#Create a partition using OS/2's <TT
CLASS="filename"
>FDISK.EXE</TT
> (Not Linux's <B
CLASS="command"
>fdisk</B
>).
</P
><P
></P
><OL
TYPE="1"
><LI
><P
>Format the partition under OS/2, either with FAT or HPFS.
This is so that OS/2 knows about the partition being formatted.
(This step is not necessary with <SPAN
CLASS="application"
>OS/2 Warp 3.0</SPAN
>.)
</P
></LI
><LI
><P
>Add the partition to the Boot Manager.
</P
></LI
><LI
><P
>Boot Linux, and create a file system on
the partition using <B
CLASS="command"
>mkfs -t ext2</B
> or
<B
CLASS="command"
>mke2fs</B
>. At this point you may, if you like, use Linux's
<B
CLASS="command"
>fdisk</B
> to change the code of the new partition to type 83
(Linux Native)this may help some automated installation scripts find the
right partition to use.
</P
></LI
><LI
><P
>Install Linux on the partition.
</P
></LI
><LI
><P
>Install LILO on the Linux partition NOT on the master boot record of the hard drive.
This installs LILO as a second-stage boot loader on the Linux partition itself,
to start up the kernel specified in the LILO configuration file.
To do this, you should put
</P
><P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
> boot = /dev/hda2 </PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>(where <TT
CLASS="filename"
>/dev/hda2</TT
> is the partition you want to
boot from) in your <TT
CLASS="filename"
>/etc/lilo/config</TT
> or
<TT
CLASS="filename"
>/etc/lilo.config</TT
> file.
</P
></LI
><LI
><P
>Make sure that it is the Boot Manager partition that is
marked active, so that you can use Boot Manager to choose what to boot.
</P
></LI
></OL
><P
>There is a set of HOWTO's on the subject of multi-boot systems at the LDP Home Page,
<A
HREF="http://tldp.org"
TARGET="_top"
><I
CLASS="citetitle"
>http://tldp.org</I
></A
>.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="boot-time-parameters"
></A
><B
>Q: </B
>How Do I Set the Boot-Time Configuration?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>You can configure Linux at the
<TT
CLASS="literal"
>lilo:</TT
> prompt either by typing the kernel arguments at the
<TT
CLASS="literal"
>BOOT lilo:</TT
> prompt, or by adding an
<TT
CLASS="literal"
>append=</TT
> directive to the
<TT
CLASS="filename"
>/etc/lilo.conf</TT
> file; for example,
at the LILO prompt (example only):
</P
><P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>BOOT lilo: parport=0x3bc,7
parport=0x3bc,none serial=0x3f8,4 serial=0x2f8,3 </PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>Example statement for <TT
CLASS="filename"
>/etc/lilo.conf</TT
>:
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="programlisting"
>&#13;append="parport=0x3bc,none serial=0x3f8,4 serial=0x2f8,3"
</PRE
></FONT
></TD
></TR
></TABLE
><P
>If you modify the <TT
CLASS="filename"
>/etc/lilo.conf</TT
> file, be
sure to run the <B
CLASS="command"
>lilo</B
> command to install the new
configuration.
</P
><P
>Configuration notes for specific hardware
devices are in the documentation of the kernel source distribution,
<TT
CLASS="filename"
>/usr/src/linux/Documentation</TT
> in most distributions.
</P
><P
>Refer to the <B
CLASS="command"
>lilo</B
> and
<TT
CLASS="filename"
>/etc/lilo.conf</TT
> manual pages, as well as the LDP
<I
CLASS="citetitle"
>BootPrompt-HowTo</I
>,
see <A
HREF="online-resources.html#howtos-and-other-documentation"
><I
>Where Is the Documentation?</I
></A
>,
and the documentation in <TT
CLASS="filename"
>/usr/doc/lilo</TT
>.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="lilo-boot-kernel-image"
></A
><B
>Q: </B
>How Do I Get LILO to Boot the Kernel Image?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>From kernel versions 1.1.80 on, the compressed kernel image, which is what LILO needs to find,
is in <TT
CLASS="filename"
>arch/i386/boot/zImage</TT
>, or <TT
CLASS="filename"
>arch/i386/boot/bzImage</TT
> when it is
built, and is normally
stored in the <TT
CLASS="filename"
>/boot/</TT
> directory. The <TT
CLASS="filename"
>/etc/lilo.conf</TT
> file should refer to the
<TT
CLASS="filename"
>vmlinuz</TT
> symbolic link, not the actual kernel image.
</P
><P
>This was changed to make it easier to build kernel versions
for several different processors from one source tree.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="remove-lilo-so-my-system-boots"
></A
><B
>Q: </B
>Can I Remove LILO So the System Boots DOS Again?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>The <B
CLASS="command"
>lilo</B
> program (not the complete
<SPAN
CLASS="application"
>LILO</SPAN
> package), uses the command line option
<B
CLASS="command"
>-u</B
> to uninstall the <SPAN
CLASS="application"
>LILO</SPAN
> boot
loader. You have to supply the device name of the device you installed
<SPAN
CLASS="application"
>LILO</SPAN
> on, for example:
</P
><P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
> lilo -u /dev/hda</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>This rewrites the original, pre-<SPAN
CLASS="application"
>LILO</SPAN
> master boot record back to the first hard
drive, from the boot record saved in <TT
CLASS="filename"
>/boot/boot.0300</TT
>. If
you installed <SPAN
CLASS="application"
>LILO</SPAN
> to a partition as a secondary
boot loader, for example, <TT
CLASS="filename"
>/dev/hda1</TT
>,
<B
CLASS="command"
>lilo</B
> re-installs the original boot sector from the save
file <TT
CLASS="filename"
>/boot/boot.0301</TT
>. Refer to the
<B
CLASS="command"
>lilo</B
> manual page for details. Thanks to Villy Kruse for
reminding me to update this answer.
</P
><P
>If you have an earlier version of <SPAN
CLASS="application"
>LILO</SPAN
>, you will have to use the DOS
(MS-DOS 5.0 or later, or OS/2) <TT
CLASS="literal"
>FDISK /MBR</TT
> (which is not
documented). This will overwrite the lilo boot loader with a standard <SPAN
CLASS="application"
>MS-DOS</SPAN
>
Master Boot Record. If you have <SPAN
CLASS="application"
>DR-DOS 6.0</SPAN
>, go
into <TT
CLASS="filename"
>FDISK.EXE</TT
> in the normal way and then select the
<TT
CLASS="literal"
>Re-write Master Boot Record</TT
> option.
</P
><P
>If you create a boot floppy during the Windows installation process, make sure that
it contains the programs <SPAN
CLASS="application"
>FDISK.EXE</SPAN
>,
<SPAN
CLASS="application"
>FORMAT.COM</SPAN
>, and
<SPAN
CLASS="application"
>SYS.COM</SPAN
>, and use that to re-install MS-DOS on the
hard disk.
</P
><P
>If you don't have MS-DOS or DR-DOS, you need to
have the boot sector that LILO saved when you first installed it. You did
keep that file, didn't you? It's probably called
<TT
CLASS="filename"
>boot.0301</TT
> or some such. Type:
</P
><P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
> dd if=boot.0301 of=/dev/hda bs=445 count=1</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>(or <TT
CLASS="filename"
>/dev/sda</TT
> if you're using a SCSI disk). This may also
wipe out your partition table, so beware! If you're desperate, you could use
</P
><P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
> dd if=/dev/zero of=/dev/hda bs=512 count=1</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>This will erase your partition table and boot sector
completely: you can then reformat the disk using your favorite software. But
this will render the contents of your disk inaccessible you'll lose it all
unless you're an expert.
</P
><P
>Note that the <SPAN
CLASS="application"
>DOS</SPAN
> MBR boots whichever (single!) partition is
flagged as "active." You may need to use <B
CLASS="command"
>fdisk</B
> to set
and clear the active flags on partitions appropriately.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="partitions-checked-each-reboot"
></A
><B
>Q: </B
>Why Does the System Check the Ext2fs Partitions Each Reboot?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>Refer to <A
HREF="error-messages.html#ext2-fs-warning-mounting"
><I
><I
>EXT2-fs: warning: mounting unchecked file system</I
></I
></A
>.
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="make-sure-it-boots"
></A
><B
>Q: </B
>How Do I Make Sure the System Boots after Re-Installing the Operating System?</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>This should work whether you're re-installing Linux or some other, commercial, operating system:
</P
><P
></P
><UL
><LI
><P
>Insert a blank, formatted floppy in drive A:
</P
></LI
><LI
><P
>Save a copy of the boot hard drive's Master Boot Record to the floppy, by executing the command:
</P
><P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
> #dd if=/dev/hda of=/dev/fd0 count=1</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
><TT
CLASS="literal"
>dd</TT
> is a standard program on Linux systems. A MS-Windows
compatible version is available from
<A
HREF="ftp://ftp.gnu.org/"
TARGET="_top"
><I
CLASS="citetitle"
>ftp://ftp.gnu.org/</I
></A
>, as well as many MS software archives.
</P
></LI
><LI
><P
>Test that the floppy boots the system by rebooting with the floppy in the A: drive.
</P
></LI
><LI
><P
>Then you should be able to install the
other operating system (on a different hard drive and/or partition, if you
don't want to uninstall Linux).
</P
></LI
><LI
><P
>After installation, boot Linux again from the floppy, and re-install the MBR with
the command: <TT
CLASS="filename"
>/sbin/lilo</TT
>.
</P
></LI
></UL
><P
>[Jacques Guy]
</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="make-rescue-floppy"
></A
><B
>Q: </B
>How To Make a Rescue Floppy</P
></DIV
><DIV
CLASS="answer"
><P
><B
>A: </B
>Make a file system on it with bin, etc, lib and dev
directorieseverything you need. Install a kernel on it and arrange to have
LILO boot it from the floppy (see the LILO documentation, in
<TT
CLASS="filename"
>lilo.u.*.ps</TT
>).
</P
><P
>If you build the kernel (or
tell LILO to tell the kernel) to have a RAM disk the same size as the floppy
the RAM disk will be loaded at boot time and mounted as root in place of the
floppy.
</P
><P
>See the <I
CLASS="citetitle"
>Bootdisk HOWTO</I
>.
</P
></DIV
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="linux-distributions.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="app-management.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Linux Distributions</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Application Software Management</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>