Saturday, July 4, 2009

Add Ubuntu 9.04 to Windows XP boot manager

I was quite impressed with Ubuntu lately, we’ve been using it at work a couple of weeks ago to recover data from a 7 years old Windows server that wasn’t able to boot properly (high CPU usage on services.exe, with no actual services started) – thanks to my friend Daniel for suggesting it.

And now I’ve decided to the Ubuntu Live on my Dell Inspiron 9300 work laptop (Intel Pentium M 1.86, 2 GB RAM, ATI Radeon Mobility X300, Seagate ST910021A 7200rpm HDD) – very happy with my 3 year old Windows XP Professional, curious to see how it compares. Ubuntu ran so well that I decided to install it on it’s own partition, with the intention to keep the Windows boot manager.

The installation was a breeze, the live CD has all the necessary tools – resized one of the partitions to make some room for a dedicated 5 GB partition for the data, no swap for now. I was a bit worried that it might not fit, but in the end it installed everything and even left 2.7 GB free! nice work, Ubuntu.

Decided to install the GRUB boot loader on the Ubuntu partition (in my case /dev/sda4) and then rebooted. As expected, the Windows XP boot manager was still there, with the normal entries, no Ubuntu.

Then I found this post explaining how to extract the Linux boot sector into a file (ubuntu.bin) and add it as a boot entry in Windows XP boot.ini. For that I had to boot back with the Ubuntu Live CD, run the command (obviously change to match your partitions):
sudo dd if=/dev/sda4 of=/media/Windows/ubuntu.bin bs=512 count=1
Reboot back to Windows XP and added the entry c:\ubuntu.bin="Ubuntu 9.04" to boot.ini:



Restart and there it was in the boot menu - selecting the Ubuntu 9.04 entry presents the Grub boot entries, allowing to start the newly installed Ubuntu from hard-drive.

Quite impressed (I know I’m repeating myself, but I really am). The UI runs fast, still to do some customisations (managed to map Win+D on my home Shuttle to show the desktop), but overall it seems to runs nicely, quite friendly and had no installation problems at all.

I’ve been trying Ubuntu on my home Shuttle (P4 Prescott 3 GHz, 2 GB RAM, ATI Radeon 9600XT, 7200rpm HDD) and I wasn’t impressed at all, in my opinion Windows XP runs much better on that machine. Same as I tried Windows 7 on it and didn’t impressed either, it ran well with visual effects and all, but not as responsive as I expected. I guess what I’m trying to say is, you should be open minded and try a few OSs to find the one that works better for you on your system - especially nowadays when there's plenty of live boot Linuxes to try and Microsoft opening up and releasing Windows preview / beta versions.

6 comments :

  1. Hi Dan,
    Very nice informative article. But couldn't understand the ubuntu.bin part. Well I too installed Ubuntu 9.04 on my system, but I have some problems.First,I have XP & Ubuntu installed on one drive and Win 7 on another drive. Now when i try to enter Ubuntu, everytime i need to insert the CD!! I think i need to install the Grub Boot loader. Can you tell me how to do that, so that i need not keep CD every time.my email id is rama.geek@gmail.com.

    ReplyDelete
  2. Hi Sasi,

    Since you have Windows 7 installed you are using Windows 7 boot manager, see if this post helps:

    http://dandar3.blogspot.com/2009/06/how-to-add-ubuntu-904-boot-entry-to.html

    I wouldn't install now, or do not install Grub in MBR as that would overwrite W7 boot manager.

    You can email me at dan.dar33@gmail.com if you like to discuss this further.

    ReplyDelete
  3. Hey Dan,

    Do you know how to change the boot loader so that Ubuntu boots by default instead of Windows?

    ReplyDelete
  4. @Kenux
    Probably the easiest is to go to System Properties > Advanced (tab) > Settings (button) > System Startup > Default operating system: choose Ubuntu > OK.

    Otherwise you could probably edit the boot.ini and change the line:

    default=c:\ubuntu.bin

    ReplyDelete
  5. Hello Dan!

    I have a question about that ubuntu.bin file... I need help! Can I rename that to debian.bin if I'm installing Debian aside WinXP?

    Thanks in advance!

    ReplyDelete
  6. I don't have details on Debian but you might be able to follow the same details (the name of the .bin file file is irrelevant) - the important parts are to install Debian on it's own partition and choose to install the boot manager in the Debian partition (not the MBR cause it will override the XP boot manager). Then extract the boot manager using dd and add that to XP boot.ini.

    If not, I guess another alternative is to install Debian in it's own partition, choose to install the Debian boot loader in MBR (overriding XP), and then find a way to integrate XP in the Debian boot loader, rather than the other way around like I did.

    I did it this way cause it was easier for me to remove say Ubuntu at some point just by removing the entry from boot.ini and repurposing the partition. If you override the MBR with another boot loader (Linux), if you manage to boot into XP and want to restore it, you can run fixmbr (http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/bootcons_fixmbr.mspx?mfr=true) at some point and restore the Windows XP boot loader (you might be able to do that from a XP boot CD in recovery mode).

    If this it too confusing and you don't want to break your PC first, I would recommend to see the posts I wrote on Macrium Reflect Free (see them in Backup label), backup your XP image and then you can restore at a later stage and try again.

    ReplyDelete