Linux.com

Feature

Boot-managing your Linux+Windows box

By Mayank Sharma on November 19, 2004 (8:00:00 AM)

Share    Print    Comments   

Operating system tinkerers have learned to their displeasure that installing Windows after Linux on a system with a dual-boot configuration disables access to Linux. Here's how to get the system up and booting in no time.

Every system with more than one operating system installed needs a boot manager -- a piece of software that allows users to choose which operating system they wish to use. The boot manager generally resides in the master boot record (MBR) of the hard disk.

The most popular boot managers that come with Linux distributions are LILO (LInux LOader) and GRUB (GRand Unified Bootloader). Lately many distributions, such as Fedora, are encouraging the use of GRUB.

If you install or re-install Windows on a system that already has Linux installed, the Windows bootloader will replace GRUB or LILO in the MBR, so that after you are done installing, you will simply boot into Windows. This doesn't mean your Linux distribution has been erased or uninstalled; it simply means that your current bootloader is unaware of where to find it. It's up to you to tweak the system to get your boot manager back.

Rescuing GRUB

If you were using GRUB as your boot manager, you just need to reinstall it. Use the first installation disk of the distribution you had installed. Pop it in your drive and, if necessary, change the boot order in your BIOS to boot off the CD-ROM drive. Reboot, and at the boot prompt, enter:

boot: linux rescue

Let the installer load itself into the rescue mode. When the installer asks you which partition holds the distribution that has to be rescued, select the appropriate partition. The installer will finally mount this partition at /mnt/sysimage and drop you to the shell. To re-install GRUB you need to be 'in' the distribution's environment, so enter the command chroot /mnt/sysimage, then install GRUB in the MBR with the command grub-install /dev/hda.

Press Ctrl-D twice to log out and restart. Voila -- there's GRUB. But where's Windows?

Well, now you have to tell GRUB where it can find Windows. Boot into Linux, log in as root, and issue the fdisk -l command. You should see output similar to the following:

Disk /dev/hda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1         255     2048256    6  FAT16
/dev/hda2             256        3545    26426925    f  W95 Ext'd (LBA)
/dev/hda3            3546        4865    10602900   83  Linux
/dev/hda5             256         893     5124703+   b  W95 FAT32
/dev/hda6             894         959      530113+  82  Linux swap
/dev/hda7             960        1724     6144831   83  Linux
/dev/hda8            1725        2010     2297263+  83  Linux
/dev/hda9            2011        2270     2088418+   b  W95 FAT32
/dev/hda10           2271        2780     4096543+   b  W95 FAT32
/dev/hda11           2781        3545     6144831   83  Linux

Note the device values corresponding to the partition in which you installed Windows. Edit the file /etc/grub.conf and append the following lines, substituting hd0 for hda (or hd1 for hdb and so on). The partition number, specified after the comma below, should be one less than the number you noted. This tells GRUB on which disk and in what partition is Windows installed.

title Windows
	rootverify (hd0,0)
	chainloader +1

Save the file and reboot. This time GRUB will show the Windows entry (as specified next to title in the configuration file).

Rescuing LILO

The process of reclaiming LILO is similar to the one for GRUB. Boot from the first installation disk. Enter the rescue mode as described above. Mount the "to-be-rescued" system under /mnt/sysimage and chroot to it as shown.

If you lost LILO because you re-installed Windows, just issuing the /sbin/lilo command should do the trick. If you lost LILO because of a fresh installation of Windows, issue the fdisk -l command and note the device values next to the partition into which you installed Windows, then edit the file /etc/lilo.conf and append these lines to the end:

other=/dev/hda1
        label=Windows

Use your device values instead of the /dev/hda1 above.

Save the file and issue the /sbin/lilo command. You should see a list of entries that LILO adds to the boot list. Windows (or whatever you specified as the label) should be listed as well.

Now you can reboot, and when the system comes up again, both operating systems should appear on the boot menu.

If you have a choice, which boot manager should you use? Trust me when I say there are as many GRUB vs. LILO battles as there are GNOME vs. KDE, but unlike the latter you can use only one boot manager per machine.

There are various other tricks you can do with boot managers, such as putting up an animated screen instead of simple text. Take some time to go through the configuration files of whichever boot manager you use. Read their documentation to fully understand and appreciate their power and usefulness.

Share    Print    Comments   

Comments

on Boot-managing your Linux+Windows box

Note: Comments are owned by the poster. We are not responsible for their content.

Boot Loader

Posted by: Anonymous Coward on November 19, 2004 10:08 PM
I like rub-a-dub-Grub. I started using it
when I began playing with RedHat a few years
ago. So far we've been getting along great.

#

configuartion of dual boot systems

Posted by: Anonymous Coward on November 20, 2004 12:50 PM
Any one have advise for new Linux users about general configuartion of dual boot systems? I'm on a college campus with a very pro-windows IT enviroment, but am starting to use linux more and more. Should I look into a 2 hard drive? (Actually, it would be a third--I already have one for my OS and programs and another for data). Or will partitioning do me?

Any thoughts, good websites, etc?

#

Re:configuartion of dual boot systems

Posted by: Anonymous Coward on November 20, 2004 06:31 PM
since you are a disk guy, i would suggest you get a disk to install linux on. don't use the entire disk for just one distro. install several distros.

#

Pain

Posted by: Anonymous Coward on May 28, 2006 06:46 PM
[URL=http://painrelief.fanspace.com/index.htm] Pain relief [/URL]
[URL=http://lowerbackpain.0pi.com/backpain.htm] Back Pain [/URL]
[URL=http://painreliefproduct.guildspace.com] Pain relief [/URL]
[URL=http://painreliefmedic.friendpages.com] Pain relief [/URL]
[URL=http://nervepainrelief.jeeran.com/painrelief<nobr>.<wbr></nobr> htm] Nerve pain relief [/URL]

#

Re:configuartion of dual boot systems

Posted by: Administrator on November 20, 2004 06:32 PM
Hi,



In my opinion you could do with partitioning just as well. There is actually nothing to it and this (partitioning) has been discussed to shreds in many message boards.



Try <A HREF="http://www.linuxquestions.org/" title="linuxquestions.org">LQ.org</a linuxquestions.org> This is an excellent resource for users to learn quickly. A search on LQ would come up with good discussions<nobr> <wbr></nobr>:)



The quickest way to find solutions is to ask at such message boards. The best resource too are message boards and wikis.
Try <A HREF="http://wiki.linuxquestions.org/" title="linuxquestions.org">LQ wiki</a linuxquestions.org>



Cheers.

--Shashank Sharma

<A HREF="http://ls-l.blogspot.com/" title="blogspot.com">My blog</a blogspot.com>

#

Grub security

Posted by: Anonymous Coward on November 21, 2004 10:35 PM
Always try to use grub over lilo. Lilo has no security. Grub has no security by default, so set a grub bootloader password. If you do not, users will be able to boot single user mode as root without being asked for a password.<nobr> <wbr></nobr>:O)

#

Re:Grub security

Posted by: Anonymous Coward on November 22, 2004 08:04 PM
Putting

restricted
password=xxxxxxxxx

in your lilo.conf will set up lilo so you can't enter single user mode without password.

Next, just chmod lilo.conf to be readable only by root

#

Re:Grub security

Posted by: Anonymous Coward on November 22, 2004 09:26 PM
If you do not, users will be able to boot single user mode as root without being asked for a password.


Use a better distribution, one that challenges you for the root password when you enter single user mode.

#

Re:Grub security

Posted by: Anonymous Coward on November 22, 2004 10:32 PM
User boots from his own CD, and mounts the HD -> no security. You disable booting from CD in BIOS -> user changes it back. You set up a password for BIOS -> user opens the box and clear the password by an appropriate jumper. Etc. In short: its impossible to have unbreakable security if your users have physical access to the machine. If you don't trust them, you are doomed.

#

Re:Grub security

Posted by: Anonymous Coward on November 22, 2004 11:28 PM
But in an environment where they may have limited time with the machine these precautions may thwart an attack. On a laptop this may be sufficient to prevent access if the laptop is stolen as many theives will not have the depth of experience to eliminate a bios password.

Using passwords for protection is not a guarantee but is a good idea.

~veatnik

#

Dual Boot

Posted by: Administrator on November 20, 2004 09:19 PM
Now does this method of partitioning works as well under WINXP and WIN2000 ? Because i see a fat32 file system in the partition label for the windowz sector.

#

Boot-managing your Linux+Windows box

Posted by: Anonymous [ip: 74.229.100.13] on November 27, 2007 03:46 PM
Ok on rescuing Grub, however, how does one get to the boot prompt in Linspire 6.

Ed @ 5wood@bellsouth.net

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya