old-www/LDP/LG/issue61/padala.html

290 lines
12 KiB
HTML

<!--startcut ==============================================-->
<!-- *** BEGIN HTML header *** -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD>
<title>Booting Linux from the NT Boot Menu LG #61</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
ALINK="#FF0000">
<!-- *** END HTML header *** -->
<CENTER>
<A HREF="http://www.linuxgazette.com/">
<H1><IMG ALT="LINUX GAZETTE" SRC="../gx/lglogo.jpg"
WIDTH="600" HEIGHT="124" border="0"></H1></A>
<!-- *** BEGIN navbar *** -->
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="okopnik.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue61/padala.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../faq/index.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="steffler.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
<!-- *** END navbar *** -->
<P>
</CENTER>
<!--endcut ============================================================-->
<H4 ALIGN="center">
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">Booting Linux from the NT Boot Menu</font></H1>
<H4>By <a href="mailto:p_padala@yahoo.com">Pradeep Padala</a></H4>
</center>
<P> <HR> <P>
<!-- END header -->
<p>
Why an article on Linux in an NT boot menu? We have HOWTOs, don't we?
The HOWTOs give step by step instructions, but unfortunately
they don't provide everything we want. They are geared towards people who are
new to Linux and are very good at explaining things to
newbies. But when it comes to doing something out of the ordinary,
we're stuck. This article is a meant to fill that void.
</p>
<p>
To start with one, day I got the crazy idea that it would be nice to
have a single boot loader to boot everything from one manager instead of
having both a LILO and an NT boot manager. So which manager should I
choose? I chose NT boot manager because when we install LILO and
boot NT from it, NT still presents its own boot menu and it's annoying
enough
to need to be asked two times to boot the right operating system . So I
thought of removing LILO and using NT loader to present a nice menu for
booting all the operating systems I have. Okay then, How do we do it? I
searched through the HOWTOs. The mini HOWTO <a href="http://www.linuxdoc.org/HOWTO/
mini/Linux+NT-Loader.html">HOWTO NT OS Loader + Linux mini-HOWTO</a>
gives a good overview of the
process. But unfortunately my brain couldn't grasp the concept. As a
result, when I first followed the steps I got an unusable system. After
3 days of hard work and rebooting and fiddling with an unusable system
3 times, concepts began to become clear.</p>
<P> Here we Go.
<h3>NT Boot Loader</h3>
<p>
The NT boot loader loads the operating system image by reading the
initialization file boot.ini. Have a look at it now. It contains something
like:
</p>
<pre>
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINNT
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Workstation Version 4.00"
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Workstation Version 4.00
[VGA mode]" /basevideo /sos
</pre>
<p>
this says to boot the operating system from the partition as
mentioned. That is it takes the first 512 bytes of information which
is required for booting the corresponding OS. So how do we boot Linux
using this concept. Simple! we can have the first 512 bytes of Linux
boot partition (the boot sector for Linux) in a file and give it to
NT boot manager. We can modify the boot.ini file as follows:</p>
<pre>
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINNT
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Workstation Version 4.00"
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Workstation Version
4.00 [VGA mode]" /basevideo /sos
<b>C:\boot.lnx="Redhat Linux 6.2"</b>
</pre>
<p> Where boot.lnx is the file which contains the required 512 bytes.
But
we have to get the 512 bytes. How do we do that? The HOWTO gives a
good example of how to do it. Here we need the first 512 bytes of
Linux boot partition which says to NT just to boot Linux. So we make
a dummy lilo.conf file and pass it to LILO and tell it to install the
boot sector for linux at the top of Linux partition. Then we peel the
first 512 bytes from this and put it into a file and give it to NT.
Then we install LILO in MBR and take care of loading WINNT as the
default OS. We create the lilo.conf to write NT as default and
install it.
</p>
<h3>Let's do it.</h3>
<p>
First let me explain my example environment. I loaded Red Hat out
of the box with the default options during installation. It installs
LILO in MBR and updates it according to the options given during
installation regarding what other OSes (such as NT) you have. Here I
have
NT only. When I reboot after installation, LILO comes up with two
options to boot--Linux and DOS. When I enter DOS, it goes into NT boot
manager.
What are we trying to make? We want to make LILO start the NT boot
manger as default and in NT boot manager, we want to have an option
to
boot Linux.</p>
<p>
What are we trying to make? We want to make LILO to start NT boot manger as
default and in NT boot manager we want to have an option to boot Linux.
</p>
<p>
We start here. First boot into Linux. Make a dummy lilo.conf file like
this:
Copy lilo.conf to lilo.dummy and open lilo.dummy with vi. edit it to look
some thing like this:
</p>
<pre>
# lilo.dummy file
boot = /dev/hda3 # Linux resides in /dev/hda3 in my machine.
# replace it with the partition in which you installed linux
timeout=0 # Time out zero to avoid lilo waiting for us
vga = normal
read-only
default=linux
image = /boot/vmlinuz
label = linux
root = /dev/hda3
</pre>
<p>
Then execute LILO with this dummy file as the argument with the command. This
installs linux boot sector on /dev/hda3.
</p>
/sbin/lilo -C lilo.dummy<br>
Peel off the first 512 bytes with this command.<br>
dd if=/dev/hda3 of=boot.lnx bs=512 count=1 <br><br>
We copy the file boot.lnx to c drive. If c drive is mounted as /win/c we
copy with the command <br><br>
cp boot.lnx /win/c
<br>
or mount c drive and copy the file as
<br>
mount /dev/hda1 /win/c<br>
cp boot.lnx /win/c<br>
<br>
Then change the boot.ini file as indicated here.
<br>
<pre>
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINNT
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Workstation Version 4.00"
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Workstation Version
4.00 [VGA mode]" /basevideo /sos
C:\boot.lnx="Redhat Linux 6.2"
</pre>
<h3>Installing LILO in MBR.</h3>
<p>
Just change the lilo.conf file to reflect winNT as the default OS with
no delay in booting into it and tell LILO to install it in MBR.
</p>
<pre>
boot = /dev/hda # Install it in MBR
timeout=0
vga = normal
read-only
default=win # We need NT as default
image = /boot/vmlinuz # We can remove this entry with out any
#problems as we will not be booting Linux from LILO
label = linux
root = /dev/hda3
other = /dev/hda1
label = win
</pre>
<p>
install LILO again. Before rebooting, make sure that you have a rescue disk
at hand. You can use the Red Hat installation disk as the rescue disk.
See the Pitfalls section to find out how to use to for rescue. or
You can make a boot disk with the command
</p>
mkbootdisk,
<br>
<br>
which you can use for rescue. See the <a href=http://www.linuxdoc.org/HOWTO/Bootdisk-HOWTO/index.html>Bootdisk-HOWTO</a> for more details on how to make boot disk.<br><br>
Then reboot and watch the magic.
<br>
<p>
Are you still unsatisfied? I know what is bothering you. You want LILO to
be eliminated completely. Do this. Get a DOS floppy that has fdisk and
boot the machine with the floppy. Then run "fdisk /mbr" to overwrite the
master boot record. I don't know what happens with this option. I am still
unsure about
this and if any one knows what this option does, please <a href="mailto: ppadala@hss.hns.com">
write to me</a>.
</p>
<ol><lh><h3>Pitfalls:</h3>
<li>
<p>
Remember every time you change your kernel or make any changes to
lilo.conf, you have to follow the process again and make a new copy of
boot.lnx and give it to NT.
</p>
<li>
<p>
If you have done some thing wrong and you can't boot Linux, then boot with
the rescue disk and install LILO again as follows:
</p>
(You can use red hat installaion CD as the rescue disk. At the installation menu type rescue and enter)<br><br>
<ul type=disc>
<li>boot with rescue disk<br>
<li>mount linux partition<br>
mount /dev/hda3 /mnt<br>
<li>change root<br>
chroot /mnt<br>
<li>change lilo.conf to some thing sane like
<pre>
boot = /dev/hda
timeout=500
prompt
vga = normal
read-only
default=linux
image = /boot/vmlinuz
label = linux
root = /dev/hda3
other = /dev/hda1
label = win
</pre>
<li>install lilo<br>
/sbin/lilo<br>
<li>do a sync and unmount /dev/hda3<br>
sync<br>
umount /mnt<br>
<li>Reboot<br>
/sbin/reboot<br>
</ul>
</ol>
<!-- *** BEGIN copyright *** -->
<P> <hr> <!-- P -->
<H5 ALIGN=center>
Copyright &copy; 2000, Pradeep Padala.<BR>
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 61 of <i>Linux Gazette</i>, January 2001</H5>
<!-- *** END copyright *** -->
<!--startcut ==========================================================-->
<HR><P>
<CENTER>
<!-- *** BEGIN navbar *** -->
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="okopnik.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue61/padala.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../faq/index.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="steffler.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
<!-- *** END navbar *** -->
</CENTER>
</BODY></HTML>
<!--endcut ============================================================-->