Starting Linux through Windows XP boot list (boot.ini)

Posted on July 22 2009 by Andre Noel

Last week I had to recover the grub in a notebook after a Windows reinstall. The easiest way would be running an Ubuntu live cd and run the grub program. But I hadn’t a cd and tried with a bootable usb stick and… nothing. That notebook doesn’t boot by usb. I tried also with a sd card, but had the same problem…

The solution: Burn a CD? No. Let’s do something more criative…

Well, we know that Windows XP also has his boot list (boot.ini), so why not to put Linux on the list?

Unfortunately, it’s not so easy as edit the grub menu, but it’s still easy.

First, you have to create an image from the master sector of a HD which has the grub installed (I used my notebook). Open terminal and type:

sudo dd if=/dev/sda1 of=bootsect.lnx bs=512 count=1

Maybe you have to change /dev/sda1 for other device, depending on your HD.

This command creates the bootsect.lnx file. Put it on c:\ on Windows. After that we will edit the boot.ini on Windows.

There’s two ways to do this: you can edit the c:\boot.ini directly (it may be hidden and read-only) or you can right click on “My Computer”, go to “Preferences”, “Advanced” tab, and click the button to edit boot preferences. So the boot.ini is opened on notepad.

On boot.ini, paste the following line at the end of the file:

c:\bootsect.lnx="Linux"

Save, close and reboot.

Now your Windows asks you if you want to start Windows or Linux.

And voi là.

(I think it’s the biggest post I wrote in English, so forgive me for the mistakes)

5 Responses to “Starting Linux through Windows XP boot list (boot.ini)”

  1. LT says:

    Another lesser known option is to use grub4dos/wingrub http://sourceforge.net/projects/grub4dos/

    basically all it does is install grub on your C:\ drive and then NTLDR (windows bootloader) will just boot into wingrub and then into my local grub. You can take that step out (booting 1 grub instead of twice), but I’m too lazy to do it.

    I personally didn’t have any luck last time I tried using the “dd” command.

    My boot.ini:
    C:\grldr=”Start Linux Bootloader”

  2. nigel says:

    Andre,
    thanks for this – sounds useful – will give it a try

  3. Nandan V says:

    replace “size” in the dd command with “bs”

    So it should be:

    $ sudo dd if=/dev/name_of_device of=bootsect.lnx bs=512 count=1

    UbuntuForums.org helped as usual

  4. Andre Noel says:

    Thanks Nandan.

  5. Alexander says:

    Andre, thanks a lot for your post – very useful.
    I think you should submit it to the ubuntu wiki.

    Your solution is way better than booting GRUB, then NTLDR or vice versa.
    For some people NTLDR menu could be a better option than GRUB.

Leave a Reply