Back to HOWTOs

Dual Booting Ubuntu Linux and Windows XP


My goal is to add Ubuntu Linux to the laptop which already has Windows XP installed (I have another guide for installing with Windows Vista using Wubi). This HOWTO does not cover the case where Linux is installed first, then Windows is (re)installed (if anyone know of good HOWTOs for this scenario, let me know so that I can link them) (if you do install Windows second and it overwrites your Linux bootloader, this link and this link show how to recover). I think, in general, installing Linux second is more useful.

An alternative to the method described in the HOWTO below is to use the partitioning tool and dual boot system that comes with the Ubuntu installer. In the Ubuntu forums, I have seen this page recommended as a good guide for those interested in trying that procedure. As mentioned in the Ubuntu documentation, the Ubuntu installer is not 100% effective in resizing NTFS partitions. Thus, while more complex, the advantages of using the method described in the HOWTO below include:

  • It gives you more control of the installation process and, I think, gives you more opportunity to diagnose and fix problems if the installation goes awry.
  • If the NTFS resizing in the Ubuntu installer fails, this method is more reliable in its partitioning. Thus, it can be used if a dual boot attempt with the Ubuntu installer fails.
  • The partitioning and Linux installation sections are relatively generic and, therefore, should be mappable to Linux distributions other than Ubuntu which may not have as good of dual boot installer (if any) included.

If you're interested in emulating Windows in Ubuntu, you might check out this guide on how to use QEMU, a free emulator. If you are interested in running Ubuntu as a guest OS via virtualization, you may consider using the freely available VMware Player and EasyVMX to create the Ubuntu virtual machine.

The relevant information for this install is:

  • Laptop: Toshiba Satellite M45-S165
    Output of lshw, lspci, and lsusb commands
  • Windows Software: Windows XP SP2 (Later upgraded to SP3)
  • Linux Software: Ubuntu Hoary Hedgehog 5.04
    (Later upgraded to Breezy Badger 5.10)
    (Later upgraded to Dapper Drake 6.06)
    (Later upgraded to Edgy Eft 6.10)
    (Later upgraded to Feisty Fawn 7.04)
    (New install for Gutsy Gibbon 7.10)
    (Later upgraded to Hardy Heron 8.04)
    (Later upgraded to Intrepid Ibex 8.10)

Note: This guide appears on both TuxMobil and Linux on Laptops.


  1. Partition Your Hard Drive
    1. This may not be necessary, but unless the Windows is a brand new installation (e.g., you just bought the computer), it's probably a good idea to defrag your hard drive in Windows before starting the partition process.
    2. Download the Linux System Rescue CD (I used version 0.2.15 originally; some tools on the CD and are noted in the instructions). Even if you don't want to dual boot your system, this is a nice tool to have if your system every gets majorly screwed up since it is a live CD (i.e., the OS runs from the CD, not your hard drive). I wouldn't recommend even trying to do a Linux install without this CD!
    3. Did I mention that the Linux System Rescue CD is absolutely vital? OK, so the next step is to burn the System Rescue to a CD. On the System Rescue website, you'll download and ISO image.
      • For Windows XP, use the ISO Recorder Power Tool by Alex Feinman. Note that there are different versions for SP1 and SP2 that are incompatible if not used with the correct XP version.
      • For Linux, there's a ton of HOWTOs for burning ISO images to a CD. Do a search.
      • For other versions of Windows, I'm not aware of any tools to do this, but I haven't really searched.
    4. Make sure your BIOS is set up to boot from the CD before the hard drive.
    5. Boot your machine with the System Rescue CD in your drive. After it loads, run the QTParted tool, which is a Partition Magic clone. Note: Newer versions of the System Rescure CD include GParted instead of QTParted and may require you to run startx in order to run it.
    6. Decide how much space you want for each partition. There will be four partitions: Windows, Linux, Linux Swap Space, and a FAT32 partition for sharing data between Windows and Linux. The FAT32 partition was a necessity for me when the installation didn't go as planned. For my 80 GB hard drive, I used:
      • Windows XP: 60 GB
      • Ubuntu Linux: 14 GB
      • Linux Swap: 1 GB (the rule of thumb is twice as large as your RAM)
      • FAT32: 5 GB
      Note that there are tools (e.g., LinuxReader) that allow you to view file systems read-only in Windows.
    7. Note that older BIOS's have a limitation that they can only access data near the beginning of the hard drive. See the reference section if you have an older BIOS for which this is a concern. I assume a BIOS without this limitation for the rest of this HOWTO!
    8. Resize your Windows partition by shrinking it to your desired size. Keep the Windows partition at the beginning of the drive. So, in my example, there is now a 60 GB partition NTFS partition at the beginning of the drive and 20 GB of free space at the end of the drive. The names of the partitions are not that important, they just help you remember which partition is which, so, when you create each of them, you should name in a way that makes sense (e.g., Windows XP, Ubuntu Linux, Linux Swap, and OS Share).
    9. Add the Linux partition directly after the Windows partition. This partition must be primary and not extended (since only primary partitions are bootable). Note: I was informed that it is not necessary to make the Linux partition primary because the dd command in Step 8 will create the necessary boot file and is placed on the Windows partition which is primary. The QTParted version I was running had an error when I tried to make the partition filesystem type ext3, so I just used ext2. Later, we'll use the Ubuntu installer to format the partition as ext3 since this is the newer filesystem for Linux and it supports journaling. But for now, ext2 is fine. Note that in this example, the Linux partition is the second primary partition (Windows is the first primary partition). You must remember on which primary partition Linux resides.
    10. Next, I created an extended partition since neither the Linux swap space nor the FAT32 partition need to be bootable and the system is limited to four primary partitions. This just leave the option of adding up to two more bootable partitions in the future if need be, but it's not necessary to make these two partitions extended. Note that if QTParted gives you some specific configuration options, it is all right if the fourth partition ends up as a primary. The main point is that the Linux and Windows partitions need to be primary in order to be bootable.
    11. In the extended partition, I first created the Linux swap space partition. As might be expected, the type for this is linux-swap.
    12. Then, I created the FAT32 partition at the end of the hard drive. The type for this partition is fat32.
    13. We're finished with the partitioning part! Exit QTParted, reboot the system (shutdown -r now), remove the CD after shutting down but before the system starts booting again (or else you'll end up booting the System Rescue CD again).

  2. Installing Ubuntu Linux
    1. First, make sure you can still boot into Windows after doing the partitioning. Windows should recognize the new FAT32 partition and assign it a drive letter. Then, place the Ubuntu CD in your CD drive and reboot. The Ubuntu download is an ISO image.
    2. At first, nothing appeared on my screen for the installation process when I pressed Enter at the first prompt. So, I had to use the command: linux vga=771 at the first prompt.
      • With Gutsy Gibbon 7.10, I first got the following error message when I booted with the Alternate Install CD (the text-based installed):
        MP-BIOS bug: 8254 timer not connected to IO-APIC
        After adding the noapic and nolapic boot options, I just got a black screen. To solve this problem, I added vga=771 to the boot options as well. So, my final boot option additions to get the installation started were:
        noapic nolapic vga=771
    3. Go through the Ubuntu install process as normal until you get to the part about partitioning. At this point, edit the partitions manually.
      • Don't do anything to the Windows partition.
      • Set the Linux partition to be of type ext3, it's mount point to be /, and make it bootable.
      • Set the Linux swap partition to the the swap space.
      • Set the FAT32 partition to have a mount point of /osshare or something similar. It does not need to be formatted.
    4. Continue in the Ubuntu install process until you get to the part about GRUB. DO NOT INSTALL GRUB in the Master Boot Record (MBR)! If you install GRUB in the MBR, all bets are're on your own (Note: not really...if you install GRUB on the MBR, you can reverse it by putting your Windows disk in, select Recovery Console when you boot, and type FIXMBR). It will request that GRUB be installed in a bootable partition, so you can use your Linux partition (this is why making it primary and bootable was important) (Note: newer versions of Ubuntu require you to click on ADVANCED to specify the hard drive). If your Linux partition is the second partition on your first hard drive (if you have multiple hard drives), you will use the GRUB code (hd0,1). The "0" immediately after "hd" indicates the first hard drive (counting starts at zero instead of one). The "1" after the comma indicates the second primary partition (again, counting starts at zero instead of one). If your Linux partition is on another hard drive or some primary partition other than the second one, change the GRUB code accordingly.
    5. After the Ubuntu installation finishes, it asks you to reboot without the Ubuntu CD to finish the installation. If this reboot works for you, great! However, when I rebooted, the Windows boot loader was rather upset that another partition had been set as the active partition (the Ubuntu install process did this automatically) and gave me the rather ominous and scary error message, "Operating System Missing". The rest of this section deals with how to finish the installation if the reboot doesn't work (if you do not have this error, then you can skip to step 8).
    6. Put the handy Linux System Rescue CD back in the drive and reboot.
    7. Using QTParted again, make the Windows partition "active" or "boot" (instead of the Linux partition). Reboot and make sure that Windows now loads correctly. This solves the problem of having the computer rendered completely useless, but does not help with finishing the Linux install. So, reboot with the Linux System Rescue CD again.
    8. Now, we're going to use the Linux System Rescue CD to dual boot using Window's bootloader. Start by making a mount point for the OS Share partition:
      mkdir /mnt/osshare
      Then, mount the partition (Note: Newer versions of the System Rescue CD may require you to use a mount type of vfat instead of msdos):
      mount -t msdos /dev/hda6 /mnt/osshare
      If you're not sure which device (e.g., /dev/hda6) your OS Share partition is, you can use QTParted to see the device number. Finally, we'll create a file that Windows can use to boot Linux:
      dd if=/dev/hda2 of=/mnt/osshare/ubuntu.bin bs=512 count=1
      Where /dev/hda2 is the device for your Linux partition (again, use QTParted to find the device number if you're unsure).
    9. Reboot into Windows. When you get there, you should now see a ubuntu.bin file on your FAT32 partition. Here's the steps to get the Windows boot loader to load Linux:
      1. Copy ubuntu.bin to C:\
      2. Go to C:\ and in the explore menubar, go to Tools --> Folder Options --> View and select "Show hidden files and folders" and uncheck the "Hide protected Operating System Files" box and apply these changes.
      3. You should now see a Boot or Boot.ini file in C:\. Right click on it and under properties, uncheck the "Read-Only" box.
      4. Open the C:\Boot.ini file with Notepad (or some other text editor) and make the last line:
        C:\ubuntu.bin="Ubuntu Linux"
        Note that you may have to add this line or their may already be a similar line that says something about an "Unknown Operating System" that you can modify. Also, I'd recommend changing the timeout in the Boot.ini file to be something like 5 or 10 instead of 30.
      5. Make the Boot.ini "Read-Only" again. You can also make the ubuntu.bin file "Read-Only" and "Hidden" as well.
    10. Reboot the computer. This time, you should see a a screen during booting that ask you to choose between Windows and Ubuntu Linux. Choose Ubuntu Linux and let the Ubuntu install process finish (this took about half an hour on my laptop).

  3. Getting X To Work
    1. Towards the end of the install process, it will ask you to indicate which resolutions your monitor can use. I found these specs online for my laptop.
    2. X (the monitor graphics engine) failed at the end of my install process. The quick fix I found online is to edit your /etc/X11/Xorg.conf file by changing the Driver "ati" line to Driver "vesa". The display worked fine after rebooting.
      • In Edgy Eft 6.10, I switched the driver back to ati and it now works fine and gives much better graphics and resolution.
      • In Gutsy Gibbon 7.10, I had the ATI driver issues (My graphics card was an ATI Radeon Xpress 200M). To solve it, I had to add Option "DRI" "off" to the Device section for my graphics card in /etc/X11/xorg.conf.

  4. Getting the Wireless Card to Work
    1. If your wireless card is not recognized, you can try to use your Windows drivers to get it recognized using the ndiswrapper tool. First, find the drivers for your wireless card in Windows. This should be a *.inf file and, for me, there is also a *.sys file. For my system, the two files are net5211.inf and ar5211.sys. Copy these two files into a directory in Linux (say, ~/win_drivers). Note that these two files must be in the same directory.
    2. If you did the standard install for Ubuntu, then you'll have to add the ndiswrapper package via the Synaptic Package Manager.
    3. Do the following commands:
      ndiswrapper -i ~/win_drivers/net5311.inf;
      ndiswrapper -m;
      modprobe ndiswrapper;
      ndiswrapper -l;
      The last command should indicate that your driver and hardware are present.
    4. Finally, add the ndiswrapper to the startup modules in /etc/modules by adding a line that says:

  5. Other Random Tidbits
    • I wanted to /osshare partition to be accessible by all users (not just root). So, in /etc/fstab, I modified the /osshare entry to be:
      /dev/hda6 /osshare vfat user,umask=0000 0 0
      Note that this gives rwx access to all users. If you want more restricted access, you can change the umask code and/or change the owner and group. Do a search to find out how to do such modifications.
    • Adobe Acroread 5 did not work after I installed the package. After reading the forums, the minor modifications necessary are:
      cd /usr/lib/Acrobat5/bin;
      mv acroread;
      Then, edit /usr/lib/Acrobat5/bin/acroread by replacing:
    • The boot-up for Ubuntu can take quite some time when it tries to configure your network interfaces and contact the NTP server. This may be exacerbated for laptops since you are not always connected to a network during boot-up. This happens because the computer will wait for DHCP and DNS timeouts before continuing the boot-up process if the network and/or network interfaces are unavailable.

      I think that this is an issue the Ubuntu developers are working to resolve. In the meantime, here are a couple of things (from the Ubuntu forums) that you can do to speed up the process.

      Lower the DHCP timeout to be something like 5 seconds instead of the default, 60 seconds. In /etc/dhcp3/dhclient.conf, uncomment the line that specifies the timeout and set it to a lower value:

      timeout 5; # DHCP timeout of 5 seconds

      Specify the IP address of a nearby NTP server instead of using a domain name. In /etc/default/ntpdate, change the NTPSERVERS field to be an IP address:

      NTPSERVERS="" # Use a server geographically close to you

      You can find a list of public NTP servers on this page (click on the HostName to get the IP address). Now, when the computer is not connected to the network during boot-up, it will timeout much sooner because it does not try to do a DNS lookup.

    • Here are some cheat sheets for how to do stuff in Ubuntu:

Upgrading Versions

In general, I've always used the Update Manager method listed on Ubuntu's site and the upgrade went smoothly (except for the upgrade to Gutsy Gibbon 7.10).

Installing Gutsy Gibbon 7.10

Gutsy hates my computer. Every since installing Hoary Hedgehog 5.04, I have been able to use Ubuntu's update system to upgrade to the next version. There were the occasional gliches (most notably, the Edgy upgrade that broke xorg-core), but nothing I couldn't recover from with a little searching. Here are some of the issues that I had to resolve to get Gutsy working:

  • "MP-BIOS bug: 8254 timer not connected to IO-APIC" Error Message: For a fresh install, I had to add the boot options noapic nolapic vga=771.
  • ATI driver issues when starting X: I had to add to the Device section of /etc/X11/xorg.conf the line Option "DRI" "off".
  • Turn on networking in recovery mode: When I needed to go to recovery mode (see below), the wired Ethernet was not working even after running:
    /etc/init.d/networking start
    This gave me the warning message "Ignoring unknown interface eth0=eth0". To solve this, I had to edit the file /etc/network/interfaces by uncommenting the following line:
    auto eth0
    iface eth0 inet dhcp # Uncomment this line
    After this, the networking was functional so I could do package updates.
  • Crash during initial package update: When Gutsy was finally installed, the first thing I did was, of course, run the Update Manager to get the newer packages. Unfortunately, this crashed the system during the package initialization and when I rebooted, X would just hang and never give a login screen.

    In recovery mode, I discovered in /var/crash/ that the crash was caused by a corrupt linked list in the scrollkeeper package:

    *** glibc detected *** /usr/bin/scrollkeeper-update: corrupted double-linked list: 0x08052238
    It looks like there are several bugs opened for this (148722, 144896, 157370, 158901, 178799, 179084). I was able to boot into recovery mode and when I did apt-get update, it gave me the message that I needed to run the following command since not all packages were installed correctly:
    dpkg --configure -a
    After doing this, I did apt-get update one more time and was then able to reboot and X started correctly.

  • Big fonts on login: At my login screen, the fonts were huge (like 70+ pt). It was still functional, but very aggravating. It looks like the best current solution to this is to add the following option to the Monitor section of your /etc/X11/xorg.conf:
    Option "DDC" "no"

Components Not Working in Ubuntu

  • Wireless networking. Though, the wireless card appears to be reconized fine (using ndiswrapper) and can discover access points in Dapper, I have been unable to get connected to my WPA-encrypted home network. the GNOME Network Manager that can be downloaded from one of the Ubuntu repositories seems to be getting closer to allowing me to connect using WPA, but it still doesn't quite work for me. In Edgy, wireless networking now works with WPA networks using the GNOME Network Manager.
  • USB mouse. After upgrading to Edgy Eft, the USB mouse stopped working correctly. After several minutes of use, it would freeze and be unusable until rebooting. This seems to be fixed after adding the noapic boot option. In /boot/grub/menu.lst, the noapic option should be added to the boot option list.
  • The modem. After trying a few things (e.g., scanModem, SmartLink modem, Conexant's HSF Modem), nothing worked. I haven't tried to get this working after Hoary Hedgehog 5.04.
  • The Real Player package didn't work. I don't plan to work on this right now. In Dapper, using the realplay package from Medibuntu repository works fine.
  • Totem, which plays DVDs, doesn't work. Using the VLC Media Player along with the libdvdcss2 package from Medibuntu repository, DVDs now play in Dapper.