Creating a Dual-Boot Windows XP and Ubuntu Laptop
Pages: 1, 2, 3

Installing GRUB and Making Ubuntu Bootable Using the Windows Bootloader

The remainder of the Ubuntu install is straightforward, until you must choose whether to install the GRUB bootloader to the Master Boot Record (MBR). To be extra protective of my working Windows installation, I chose not to install GRUB to my MBR, which led me to a screen titled "Install the GRUB boot loader on a hard disk." Here, I identified my Ubuntu partition:



(hd0,1)

In GRUB's zero-based drive identification convention, this indicates the first disk drive (drive hd0), second partition (partition 1).

After installing GRUB, Ubuntu will request a reboot to complete its installation running from the hard drive. On both of my systems, the reboot produced the ominous message "Missing operating system." This message is the result of Ubuntu having set its own partition as the active partition. The Windows bootloader, which is still installed in the master boot record, cannot boot Windows because the Windows partition is not flagged as active; the Windows bootloader also has no knowledge of the Ubuntu operating system, so that cannot boot either.

To make the system bootable into both Windows and Ubuntu, reboot into the System Rescue CD. Run QtParted, select the Windows partition (for example, /dev/hda1), and select Operations->Set Active. Select Device->Commit to commit your changes. The QtParted progress window will display the operations, ending with "Operations completed successfully." Exit QtParted, but don't shut down.

Now you must copy data from the Ubuntu partition to a file that the Windows bootloader can use for booting Ubuntu. The FAT32 partition, which is accessible to both Linux and Windows, is useful. At the System Rescue CD command prompt, mount the FAT32 partition:

# mkdir /mnt/share
# mount -t msdos /dev/hda4 /mnt/share

Note: on your system, the /dev identification of the FAT32 drive may differ. Mount using the correct partition designation for your system.

Make a file containing data copied from the boot sector of your Linux drive (substitute your Linux drive designation if it is not /dev/hda2):

# dd if=/dev/hda2 of=/mnt/share/ubuntu.bin bs=512 count=1

If you enter:

# ls -l /mnt/share

you should see the file ubuntu.bin with size 512 bytes.

Now configure the Windows bootloader. Shut down the system and let Windows boot. Copy the ubuntu.bin file from the FAT32 Windows drive to drive C:\. Next, edit the system startup settings. Open the Control Panel, select System, and go to the Advanced tab. Click the "Startup and Recovery" Settings button. Click the Edit button to edit the startup options file manually (Figure 3).

the Windows bootloader startup settings
Figure 3. Navigating to edit the Windows bootloader startup settings

Clicking Edit loads the boot.ini file into Notepad. Add a new line at the end of the file:

C:\UBUNTU.BIN="Ubuntu Linux"

Save the file and close Notepad. Make sure the "Time to display list of operating systems" has a value of at least 5 or 10, to give yourself plenty of time to select the operating system at boot time. Click OK to save the Startup settings.

You now have a dual-boot XP/Ubuntu notebook computer. Reboot the computer and select "Ubuntu Linux" to complete the installation and configuration of Ubuntu. Linux configuration issues vary for different computers; I've added some Related Links with pointers to help.

Accessing the Shared Partition from Ubuntu

Ubuntu mounts the shared FAT32 partition at boot time:

kevin@lyrahpnx:~$ df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hda2             30233928   1766828  26931288   7% /
tmpfs                   517816        16    517800   1% /dev/shm
tmpfs                   517816     12588    505228   3%
    /lib/modules/2.6.12-9-386/volatile
/dev/hda1             19451896   3548380  15903516  19% /media/hda1
/dev/hda4             25916224       160  25916064   1% /share

By default, the root user owns the partition:

kevin@lyrahpnx:~$ ls -l /share
total 48
drwxr-xr-x  2 root root 16384 2006-02-09 11:03 Recycled
drwxr-xr-x  3 root root 16384 2006-02-09 11:03 System Volume Information
-rwxr-xr-x  1 root root   512 2006-02-09 10:56 ubuntu.bin

You won't be able to access the shared partition from Ubuntu Linux using your normal login name unless you change this.

The simplest solution is to have the /share partition mounted at boot time specifying your login ID as the owner. First, display your user ID record from /etc/passwd (substitute your user name for kevin):

kevin@lyrahpnx:~$ cat /etc/passwd | grep kevin
kevin:x:1000:1000:Kevin Farnham,,,:/home/kevin:/bin/bash

The third and fourth items are the user ID and group ID; these are necessary when you modify the mount command in /etc/fstab.

Because fstab is a critical Linux system file, make a backup copy of your working version before you edit the file. Then, edit fstab (use sudo, because root owns the file), and change the options section for the /share entry to defaults,uid=uuuu,gid=gggg, where uuuu is your user ID and gggg is your group ID. Here's my revised /etc/fstab (note the /dev/hda4 /share entry):

kevin@lyrahpnx:/etc$ cat fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/hda2       /               ext3    defaults,errors=remount-ro 0       1
/dev/hda1       /media/hda1     ntfs    defaults        0       0
/dev/hda4       /share          vfat    defaults,uid=1000,gid=1000        0       0
/dev/hda3       none            swap    sw              0       0
/dev/hdb        /media/cdrom0   udf,iso9660 user,noauto     0       0

When you reboot into Ubuntu, the share partition will be mounted with your user name having full ownership and full access.

Conclusion

Converting a single disk-drive notebook computer into a dual-boot Windows XP/Ubuntu Linux system requires advance planning and careful execution of multiple sequences of steps. However, the benefit of being able to boot either Windows or Linux on a portable system, and to share data between the two, is well worth the effort for people who work in both realms.

Related Links

Kevin Farnham is the owner of Lyra Technical Systems, Inc, a small consulting and publishing company.


Return to the Linux DevCenter.