If Fedora's Grub doesn't see your previous installation

IMPORTANT NOTE!
This page has become outdated. I'm leaving it up for reference, and because many other distributions don't yet use Grub2. However, the method outlined below does not work with Grub2.

A common issue on Fedora Forums is that someone had an installation of Ubuntu. They then install Fedora and are now unable to boot their Ubuntu installation.

Note that if you took Fedora's default options without changing anything, your Ubuntu installation is probably gone. This article assumes that you didn't take the default options and choose to use free space rather than remove existing Linux partitions.

What happens is that Fedora's grub is a bit more MS like than Ubuntu's, and won't see the Ubuntu installation. (Conversely, Ubuntu will see a Fedora installation and add it to its grub menu.)

Jaunty and earlier

There are various methods, but this one will work and is relatively simple. Once Fedora is installed and running, if you aren't sure where your Ubuntu installation is, run the commmand
cfdisk

If you only have one hard drive, then you can run it as written above. If you have more than one drive, then run cfdisk /dev/sda, /dev/sdb, or with whatever disk holds your Ubuntu installation. Hopefully, you'll be able to see where your Ubuntu installation is located.

For example if the installation is on a 20 gig partition and cfdisk shows that partition sda1 is 20 gigs and sda2 is 1000 megs, then it's a fairly safe bet that sda1 is your Ubuntu installation and sda2 is your swap partition.

Ubuntu had its grub installed in the master boot record, the MBR. Fedora, during installation, also installed grub in the MBR, overwriting Ubuntu's grub. (The way to avoid this during installation would have been to check the advanced options when installing Fedora and choosing to have grub installed in the root or boot partition of Fedora. However, the default is to install grub in the MBR, and many people overlook the option.)

So, now that you've established that Ubuntu is in /dev/sda1, we are going to go into the Ubuntu installation. Note that the order of these next steps is important. First mount the Ubuntu partition, then proc and dev. Assuming Ubuntu is on /dev/sda1
mount /dev/sda1 /mnt
mount -o bind /proc /mnt/proc
mount -o bind /dev /mnt/dev
chroot /mnt /bin/bash

Note that in the chroot command, there is a space after /mnt. Don't do chroot /mnt/bin/bash.

You should now see your Ubuntu prompt. First run grub to make sure that you did the above properly.
grub

You should see the grub prompt, looking something like grub >. At the prompt type
root (hd0,

Hit the tab key. You should now see a listing of partitions, looking something like
Partion num:0 Filesystem type is ext2

or something similar.

As long as you see that, everything is mounted correctly. Exit grub by typing "quit" (without the quotes) at the grub prompt. You should be back at the Ubuntu prompt. Now type
grub-install /dev/sda1

You should see a few messages and it should end by saying grub installed successfully.

Edit your Fedora /boot/grub/menu.lst with your favorite text editior. Look for the line that says timeout=0 and change it to 3, 5, or whatever you want. (The number refers to time in seconds, so 3 would be 3 seconds). Note that in Fedora 11, at present anyway (at time of writing, it's in pre release) will still, upon booting the machine, only show the line to boot Fedora 11, however, once you see that, you can hit the down arrow to show other available boot options.

Add the following to /boot/grub/menu.lst
title Ubuntu
	rootnoverify (hd0,0)
	chainloader +1

Spacing is important. It's chainloader, space, plus sign, no space and the numeral one.

At this point, if you reboot, you should see Ubuntu listed in the grub menu (though as mentioned, it may be necessary to use the down arrow) and if you select it, it should boot back into Ubuntu.

Karmic and later

With changes in grub, the above method no longer works with Karmic Koala.

It is probably not necessary to try to reinstall grub on Karmic. However, the entries in Fedora's grub.conf are slightly different.

The chainloader +1 option seems to no longer work. However, if one points to Ubuntu's vmlinuz and initrd.img, it will boot.

Ubuntu wisely puts a symlink to their vmlinuz and initrd.img files in root. That is, though the files themselves are called vmlinuz-<kernel-version>, e.g., vmlinuz-2.6.30-5.generic there will be a symbolic link at /vmlinuz. The same holds for initrd.img.

Therefore, grub should read
title Ubuntu
root (hd0,0)
kernel /vmlinuz root=/dev/sda1
initrd /initrd.img

This allows you to boot Karmic and other distributions with later versions of grub.