I downloaded Ubuntu Feisty Fawn, and installed it on my laptop, above Windows XP. Everything works just fine. My question is whether I can get some kind of "grub" to rebuild the boot stuff quickly, if I need to. I believe that the last act of the installation process was to create the boot sector and/or boot records, but re-installing Ubuntu is an inconvenient way of doing this again later.

When I turn on the computer I get a window that offers five possibilities:
1.Ubuntu Linux
2.ditto "restore"
3.some other flavor of Ubuntu
4.Windows XP
5.Windows XP Restore (the XP that came with the laptop has a D-disk primary partition that the user isn't supposed to mess with, which will be a great resource if a restore is necessary. This partition apparently was seen by the Ubuntu installer, and caused this to be included in the boot menu.)

Numbers 1 and 4 work perfectly; 2 and 3 I haven't tried; number 5 I early tried out of curiosity, and I'm afraid of hitting it again by accident. I don't know quite what it's supposed to do, but the first thing it does is to mess up the boot mechanism.

I have a Partition Commander CD that offers all kinds of tools, and one of them is to rebuild the boot sector. So I tried that. It worked very quickly, and then I was able to boot Windows XP. But it didn't seem to do anything for booting Linux.

So I just re-installed Ubuntu, and all is well again.

But there must be some way I can boot from a CD, and find on the CD a "grub" that will look at the hard disk the way the last act of the Ubuntu installer did, and create something that gives me the choice of booting Linux or Windows. Can you tell me what to do?

For configuring GRUB to boot your operating systems properly, you'll need to play around with the /boot/grub/menu.lst file. What does it look like at the moment, and which partition(s) contain which operating systems?

An additional note, on Linux you can back up the executable code section of your boot sector by entering the following at a Linux shell:

dd if=/dev/hda of=/mbr-exec.bin bs=446 count=1

mbr-exec.bin is the backup file to save to. Using this file, it can be restored just as easily:

dd if=/mbr-exec.bin of=/dev/hda bs=446 count=1

you could boot up with a linux distro that allows you just to install grub i.e gentoo, debian, arch, slackware etc. Im to lazy right know to figure it out but you can reinstall grub with the grub shell.

Oh yeah, if you're trying to reinstall GRUB, usually the easiest way is to chroot into your hard drive environment from a Linux rescue CD. This example assumes that /dev/hda3 is your root device.

Mount your root filesystem:

mkdir /mnt/linux
mount /dev/hda3 /mnt/linux

Check if you have a boot partition:

cat /mnt/linux/etc/fstab | grep /boot

If a device is printed out, you need to mount that too:

mount /dev/hda5 /mnt/linux/boot

Mount virtual filesystems and chroot into the environment:

mount -t proc none /mnt/linux/proc
mount -o bind /dev /mnt/linux/dev
chroot /mnt/linux /bin/bash

Now install it:

grub-install /dev/hda

Exit and reboot:

exit
umount /mnt/linux/proc /mnt/linux/dev
(if you have a boot partition) umount /mnt/linux/boot
umount /mnt/linux
reboot
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.