By Thomas Leichtenstern
You can get Windows XP to dual-boot with Linux by editing the Windows boot.ini file, but the Vista bootloader needs much more coaxing. The simple boot.ini is replaced with a binary file, and you'll need the necessary tools to configure it. Another problem for Linux users is that, if you try to install Vista after you install Linux, Vista just replaces the existing bootloader without detecting the other system. With a little extra effort, however, you can still keep your dual-boot system running. This article describes some strategies for dual-booting Vista and Linux.
Because Vista disables Linux boot capability, you'll need some Linux-friendly way to start the system and make the necessary changes. In this article, I'll use the SystemRescueCd [2] live Linux distribution. SystemRescueCd comes with features such as NTFS filesystem write access and the GAG bootloader, which I'll describe later in this article. If you have your own favorite live rescue CD, make sure your CD has all the necessary features described in this article, and adapt the procedures as necessary.
If you are planning to install more than one operating system on your computer, just remember that the old adage of saving the best until last. More or less all Linux distributions detect an existing Windows system during the install and integrate it into the boot menu. Like previous Microsoft systems, the Vista installer ignores existing bootloaders and overwrites them with the Vista bootloader without popping up a warning message or asking you to confirm.
This doesn't mean the Vista bootloader is incapable of booting other operating systems; it's just far more difficult to configure than with Vista's predecessor, Windows XP. Because the boot.ini control file has been replaced by a binary in Vista, and you will need a special command-line program called bcdedit.exe to edit the file.
To open the Windows shell, right click All Programs|Tools|Command line in the Start menu, and select Run as administrator, to run the shell with the required privileges. To display the options supported by the editor, type bcdedit /? or bcdedit /help at the command line. Using Bcdedit to set up a boot configuration for Linux is fairly complicated, as the box titled "Setting up the Vista Bootloader for Linux" reveals.
The graphical Bcdedit front-end, EasyBCD [3] (Figure 1), which is based on .NET, facilitates the configuration of the Windows bootloader. EasyBCD can handle multiple Windows boot scenarios as well as dual-boot sceanrios with Linux, BSD, or Mac OS X. Thanks to an integrated redirector, all you need to do is install the Linux bootloader (Grub or Lilo) in the boot block of your system partition. EasyBCD removes the need to create an image of the boot block.
The command bcdedit /export c:\bootloaderbac backs up the Windows bootloader settings; bcdedit /import c:\bootloaderbac restores them. Note that this only applies to the settings but not to the bootloader itself, which resides in the MBR. See the box titled "Restoring the Vista Bootloader."
Setting up the Vista Bootloader for Linux |
The following section explains how to boot Linux systems with the Vista bootloader. This process assumes that you will be using IDE disks. If you have SCSI or SATA, you will need to run the mount command to discover which system has been installed on which device (for example, /dev/sda1).
|
Restoring the Vista Bootloader |
If necessary, you can restore the original Vista bootloader using the Vista boot DVD. Launch the setup tool, and in the window that follows the country settings, select Computer repair options; then select the menu item at the bottom Command line. Enter bootrec.exe /Fixmbr, followed by bootrec.exe /Rebuildbcd. This sequence restores the bootloader to its original state. |
The most elegant approach to running Vista and Linux on the same machine involves installing Linux after completing the Vista install. Most distributions detect Windows and automatically add an entry for it to the boot menu.
If this option is not available to you, because you are updating from Windows XP to Vista, for example - you have a number of options for reactivating Grub [4] when you are done. The easiest way is to back up your MBR before you start and to restore the MBR after installing Vista, in order to restore the original bootloader. To do so, pop up a console on Linux, and, working as root, enter # dd if=/dev/hda of=/mbrbackup.img bs=512 count=1. If your system is installed on an SATA or SCSI disk, replace /dev/hda with /dev/sda.
As you will be temporarily unable to access Linux after installing Vista, you will need to boot from the System Rescue CD live distribution.
Mount the drive that you stored the MBR image on in the previous step, and give the following command to restore the MBR: dd if=/mbrbackup.img of=/dev/hda bs=512 count=1.
As your Grub configuration file, /boot/grub/menu.lst, does not have an entry for Vista thus far, you will need to add an entry.
To do so, either use your distribution's boot configuration, for instance, YaST if you have SUSE (Figure 2), or edit the file manually. The Grub configuration file is titled menu.lst and resides in a directory titled /boot/grub/.
If Vista is installed on the first partition on your disk, you can add the following entry to the file:
title Vista rootnoverify hd0,0) chainloader hd0,0)+1
Note that Grub enumerates disks and partitions from zero upward. For example, if the system you need to boot is on the third partition on your second hard disk, Grub will refer to this as (hd1,2).
As an alternative to the entry in menu.lst, you can boot Vista via the Grub shell (see Figure 3). To access the shell, you can press [C] in text-only mode (which you are able to access by pressing [Esc] in the boot menu).
Type the following commands one after another, rootnoverify (hd0,0), chainloader (hd0,0)+1, boot, and press [Enter] after each command.
Even if you don't have a backup of your MBR, it is easy enough to install the Grub bootloader. To do so, boot the SystemRescueCd or an equivalent, and mount the drive with your Linux installation in /mnt/linux.
The grub-install --root-directory=/mnt/linux/boot /dev/hda command will install Grub to the MBR on your disk and copy the other required files to your/boot/grub directory. The last step is to create a /boot/grub/menu.lst file or modify an existing file (see Listing 1).
Listing 1: menu.lst |
01 # /boot/grub/menu.lst 02 # Example for dual-boot 03 # with Windows Vista 04 default 0 05 timeout 10 06 gfxmenu (hd0,4)/boot/message 07 title Linux 08 root (0,4) 09 kernel /boot/vmlinuz 10 root=/dev/hda5 11 initrd /boot/initrd 12 title Vista 13 rootnoverify (hd0,0) 14 chainloader (hd0,0)+1 |
The GAG Universal Bootloader [5] (Figure 4) is a less well known alternative to the standard boot managers. GAG stands for Gestor de Arranque Grafico, which, translated to English, means "Graphical Boot Manager."
GAG supports Windows, Linux, OS/2, and all known BSD derivatives. Besides English, the interface supports most European languages.
The software can manage hard disks up to a size of 4TByte. GAG does not need a separate partition; it installs itself in the 32KB reserved block at the start of the disk. It also supports setting a password for the setup and for each operating system.
Just like the Vista bootloader, GAG requires a Linux bootloader in the Linux system partition boot block. To install GAG from the SystemRescueCd, select the Start GAG Bootloader entry. Install GAG in the first window launches the setup, which starts with a keyboard selection. This will be 1: QWERTY for English. After selecting the language in the next dialog, you can press [S] to launch into the setup.
[N] for "new" opens an overview of the partitions on your system. Type the letter at the start of the partition entry to specify the partition with the bootable system. A pop-up window then asks you to specify the names that will appear in the boot menu, along with a password. A blank entry disables the password. Assign an icon to each new entry, and save your settings by pressing [H].
To verify the entries, press [Z] (back to main menu). The bootloader should be ready for use, and pressing the corresponding number should boot the system of your choice.
GAG also supports a floppy-based installation, although as of this writing, it does not support the more modern option of booting from a USB stick.
Windows Vista keeps the bad habits of its older siblings. Installing Vista or upgrading from Windows XP will overwrite any existing boot managers without a word of warning.
Although the bcdedit program does support the integration of Linux into the Vista boot manager, the process is extremely complex.Grub gives you a far more elegant approach, and just a couple of lines in the configuration file are all it takes to boot Vista. GAG, the graphical boot manager, makes this even easier, giving you options for adding multiple operating systems to a friendly boot menu. If you prefer to keep the Vista bootloader, EasyBCD gives you a graphical front-end to facilitate the configuration.
INFO |
[1] Windows Vista: http://www.microsoft.com/windows/products/windowsvista/
[2] System Rescue CD: http://www.sysresccd.org [3] EasyBCD: http://neosmart.net [4] Grub bootloader: http://www.gnu.org/software/grub [5] GAG bootloader: http://gag.sourceforge.net |