Ubuntu – Can’t add Fedora 14 to grub

11.04dual-boot

Today I installed Fedora 14 in a different partition in the same hard drive as Ubuntu. At the Fedora 14 installation, I chose not to install Boot-loader in the MBR, and instead chose to install it in the Fedora partition itself, which is according to my HD layout /sda3.

After the Fedora 14 installation I booted in to Ubuntu and ran

sudo update-grub

but 'grub.cfg' fails to add Fedora 14 in to the OS list. Here is the output of boot-info script.

                  Boot Info Script 0.60    from 17 May 2011


============================= Boot Info Summary: ===============================

 => Grub2 (v1.99) is installed in the MBR of /dev/sda and looks at sector 1 of 
    the same hard drive for core.img. core.img is at this location and looks 
    for (,msdos1)/boot/grub on this drive.

sda1: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info:  
    Operating System:  Ubuntu 11.04
    Boot files:        /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sda2: __________________________________________________________________________

    File system:       Extended Partition
    Boot sector type:  Unknown
    Boot sector info:  

sda5: __________________________________________________________________________

    File system:       swap
    Boot sector type:  -
    Boot sector info:  

sda3: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  Grub Legacy
    Boot sector info:   Grub Legacy (v0.97) is installed in the boot sector 
                       of sda3 and looks at sector 49897340 on boot drive #1 
                       for the stage2 file.  A stage2 file is at this 
                       location on /dev/sda.  Stage2 looks on partition #3 
                       for /grub/grub.conf.
    Operating System:  
    Boot files:        /grub/menu.lst /grub/grub.conf

sda4: __________________________________________________________________________

    File system:       LVM2_member
    Boot sector type:  -
    Boot sector info:  

============================ Drive/Partition Info: =============================

Drive: sda _____________________________________________________________________

Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders, total 78165360 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition  Boot  Start Sector    End Sector  # of Sectors  Id System

/dev/sda1    *          2,048    49,865,759    49,863,712  83 Linux
/dev/sda2          74,866,686    78,163,967     3,297,282   5 Extended
/dev/sda5          74,866,688    78,163,967     3,297,280  82 Linux swap / Solaris
/dev/sda3          49,866,752    50,890,751     1,024,000  83 Linux
/dev/sda4          50,890,752    74,864,639    23,973,888  8e Linux LVM


"blkid" output: ________________________________________________________________

Device           UUID                                   TYPE       LABEL

/dev/sda1        03e2a8da-171f-49e9-b24d-434e66cd1140   ext4       
/dev/sda3        dea81d77-a375-4d0e-954e-1829f6b91f10   ext4       
/dev/sda4        mzVoj0-GHJu-DJr4-0G2Y-SzZ0-LTfW-F01yf9 LVM2_member 
/dev/sda5        3e89ba8e-7754-4ee4-aca1-e2a82bffb7a7   swap       

================================ Mount points: =================================

Device           Mount_Point              Type       Options

/dev/sda1        /                        ext4       (rw,errors=remount-ro,user_xattr,commit=0)


=========================== sda1/boot/grub/grub.cfg: ===========================

--------------------------------------------------------------------------------
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  set have_grubenv=true
  load_env
fi
set default="2"
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function recordfail {
  set recordfail=1
  if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}

function load_video {
  insmod vbe
  insmod vga
  insmod video_bochs
  insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos1)'
search --no-floppy --fs-uuid --set=root 03e2a8da-171f-49e9-b24d-434e66cd1140
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=1024x768
  load_video
  insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos1)'
search --no-floppy --fs-uuid --set=root 03e2a8da-171f-49e9-b24d-434e66cd1140
set locale_dir=($root)/boot/grub/locale
set lang=en_US
insmod gettext
if [ "${recordfail}" = 1 ]; then
  set timeout=-1
else
  set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
if background_color 44,0,30; then
  clear
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
if [ ${recordfail} != 1 ]; then
  if [ -e ${prefix}/gfxblacklist.txt ]; then
    if hwmatch ${prefix}/gfxblacklist.txt 3; then
      if [ ${match} = 0 ]; then
        set linux_gfx_mode=keep
      else
        set linux_gfx_mode=text
      fi
    else
      set linux_gfx_mode=text
    fi
  else
    set linux_gfx_mode=keep
  fi
else
  set linux_gfx_mode=text
fi
export linux_gfx_mode
if [ "$linux_gfx_mode" != "text" ]; then load_video; fi
menuentry 'Ubuntu, with Linux 2.6.38-8-generic' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    set gfxpayload=$linux_gfx_mode
    insmod part_msdos
    insmod ext2
    set root='(/dev/sda,msdos1)'
    search --no-floppy --fs-uuid --set=root 03e2a8da-171f-49e9-b24d-434e66cd1140
    linux   /boot/vmlinuz-2.6.38-8-generic root=UUID=03e2a8da-171f-49e9-b24d-434e66cd1140 ro   quiet splash vt.handoff=7
    initrd  /boot/initrd.img-2.6.38-8-generic
}
menuentry 'Ubuntu, with Linux 2.6.38-8-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    set gfxpayload=$linux_gfx_mode
    insmod part_msdos
    insmod ext2
    set root='(/dev/sda,msdos1)'
    search --no-floppy --fs-uuid --set=root 03e2a8da-171f-49e9-b24d-434e66cd1140
    echo    'Loading Linux 2.6.38-8-generic ...'
    linux   /boot/vmlinuz-2.6.38-8-generic root=UUID=03e2a8da-171f-49e9-b24d-434e66cd1140 ro single 
    echo    'Loading initial ramdisk ...'
    initrd  /boot/initrd.img-2.6.38-8-generic
}
submenu "Previous Linux versions" {
menuentry 'Ubuntu, with Linux 2.6.35-28-generic' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    set gfxpayload=$linux_gfx_mode
    insmod part_msdos
    insmod ext2
    set root='(/dev/sda,msdos1)'
    search --no-floppy --fs-uuid --set=root 03e2a8da-171f-49e9-b24d-434e66cd1140
    linux   /boot/vmlinuz-2.6.35-28-generic root=UUID=03e2a8da-171f-49e9-b24d-434e66cd1140 ro   quiet splash vt.handoff=7
    initrd  /boot/initrd.img-2.6.35-28-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-28-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    set gfxpayload=$linux_gfx_mode
    insmod part_msdos
    insmod ext2
    set root='(/dev/sda,msdos1)'
    search --no-floppy --fs-uuid --set=root 03e2a8da-171f-49e9-b24d-434e66cd1140
    echo    'Loading Linux 2.6.35-28-generic ...'
    linux   /boot/vmlinuz-2.6.35-28-generic root=UUID=03e2a8da-171f-49e9-b24d-434e66cd1140 ro single 
    echo    'Loading initial ramdisk ...'
    initrd  /boot/initrd.img-2.6.35-28-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-21-generic' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    set gfxpayload=$linux_gfx_mode
    insmod part_msdos
    insmod ext2
    set root='(/dev/sda,msdos1)'
    search --no-floppy --fs-uuid --set=root 03e2a8da-171f-49e9-b24d-434e66cd1140
    linux   /boot/vmlinuz-2.6.32-21-generic root=UUID=03e2a8da-171f-49e9-b24d-434e66cd1140 ro   quiet splash vt.handoff=7
    initrd  /boot/initrd.img-2.6.32-21-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-21-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    set gfxpayload=$linux_gfx_mode
    insmod part_msdos
    insmod ext2
    set root='(/dev/sda,msdos1)'
    search --no-floppy --fs-uuid --set=root 03e2a8da-171f-49e9-b24d-434e66cd1140
    echo    'Loading Linux 2.6.32-21-generic ...'
    linux   /boot/vmlinuz-2.6.32-21-generic root=UUID=03e2a8da-171f-49e9-b24d-434e66cd1140 ro single 
    echo    'Loading initial ramdisk ...'
    initrd  /boot/initrd.img-2.6.32-21-generic
}
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
    insmod part_msdos
    insmod ext2
    set root='(/dev/sda,msdos1)'
    search --no-floppy --fs-uuid --set=root 03e2a8da-171f-49e9-b24d-434e66cd1140
    linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
    insmod part_msdos
    insmod ext2
    set root='(/dev/sda,msdos1)'
    search --no-floppy --fs-uuid --set=root 03e2a8da-171f-49e9-b24d-434e66cd1140
    linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
if [ "x${timeout}" != "x-1" ]; then
  if keystatus; then
    if keystatus --shift; then
      set timeout=-1
    else
      set timeout=0
    fi
  else
    if sleep --interruptible 3 ; then
      set timeout=0
    fi
  fi
fi
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
--------------------------------------------------------------------------------

=============================== sda1/etc/fstab: ================================

--------------------------------------------------------------------------------
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
#                
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda1 during installation
# Commented out by Dropbox
# UUID=03e2a8da-171f-49e9-b24d-434e66cd1140 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=3e89ba8e-7754-4ee4-aca1-e2a82bffb7a7 none            swap    sw              0       0
UUID=03e2a8da-171f-49e9-b24d-434e66cd1140 / ext4 errors=remount-ro,user_xattr 0 1
--------------------------------------------------------------------------------

=================== sda1: Location of files loaded by Grub: ====================

           GiB - GB             File                                 Fragment(s)

   0.065803528 = 0.070656000    boot/grub/core.img                             1
  21.263332367 = 22.831329280   boot/grub/grub.cfg                             1
   0.771381378 = 0.828264448    boot/initrd.img-2.6.31-wl                      1
   2.054199219 = 2.205679616    boot/initrd.img-2.6.32-21-generic              3
   2.893260956 = 3.106615296    boot/initrd.img-2.6.35-28-generic              2
   6.833232880 = 7.337127936    boot/initrd.img-2.6.38-8-generic               2
   1.772453308 = 1.903157248    boot/vmlinuz-2.6.32-21-generic                 2
   2.068012238 = 2.220511232    boot/vmlinuz-2.6.35-28-generic                 1
   5.532531738 = 5.940510720    boot/vmlinuz-2.6.38-8-generic                  1
   6.833232880 = 7.337127936    initrd.img                                     2
   2.893260956 = 3.106615296    initrd.img.old                                 2
   5.532531738 = 5.940510720    vmlinuz                                        1
   2.068012238 = 2.220511232    vmlinuz.old                                    1

============================= sda3/grub/grub.conf: =============================

--------------------------------------------------------------------------------
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,2)
#          kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda3
default=0
timeout=0
splashimage=(hd0,2)/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.35.6-45.fc14.i686)
    root (hd0,2)
    kernel /vmlinuz-2.6.35.6-45.fc14.i686 ro root=/dev/mapper/VolGroup-lv_root rd_LVM_LV=VolGroup/lv_root rd_LVM_LV=VolGroup/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet
    initrd /initramfs-2.6.35.6-45.fc14.i686.img
--------------------------------------------------------------------------------

=================== sda3: Location of files loaded by Grub: ====================

           GiB - GB             File                                 Fragment(s)

  23.792903900 = 25.547436032   grub/grub.conf                                 1
  23.792903900 = 25.547436032   grub/menu.lst                                  1
  23.793020248 = 25.547560960   grub/stage2                                    1
  23.817364693 = 25.573700608   initramfs-2.6.35.6-45.fc14.i686.img            2
  23.787566185 = 25.541704704   initrd-plymouth.img                            1
  23.791228294 = 25.545636864   vmlinuz-2.6.35.6-45.fc14.i686                  1

======================== Unknown MBRs/Boot Sectors/etc: ========================

Unknown BootLoader on sda2

00000000  81 71 62 ff a1 94 89 ff  4d 43 3a ff fa f2 ec ff  |.qb.....MC:.....|
00000010  fb f6 f1 ff fc f8 f4 ff  fc f8 f4 ff fc f8 f4 ff  |................|
00000020  5d 56 50 ff a1 94 89 ff  81 70 62 ff 81 70 62 ff  |]VP......pb..pb.|
00000030  81 70 62 ff 81 70 62 ff  81 70 62 ff a1 94 89 ff  |.pb..pb..pb.....|
00000040  4d 43 3a ff fa f2 ec ff  fb f6 f1 ff fc f8 f4 ff  |MC:.............|
00000050  fc f8 f4 ff fc f8 f4 ff  5d 56 50 ff a1 94 89 ff  |........]VP.....|
00000060  81 70 62 ff 81 70 62 ff  81 70 62 ff 81 70 62 ff  |.pb..pb..pb..pb.|
00000070  81 70 62 ff a1 94 89 ff  4d 43 3a ff fa f2 ec ff  |.pb.....MC:.....|
00000080  fb f6 f1 ff fc f8 f4 ff  fc f8 f4 ff fc f8 f4 ff  |................|
00000090  5d 56 50 ff a0 93 89 ff  80 6f 61 ff 80 6f 61 ff  |]VP......oa..oa.|
000000a0  80 6f 61 ff 80 6f 61 ff  80 6f 61 ff a0 93 89 ff  |.oa..oa..oa.....|
000000b0  4d 43 3a ff fa f2 ed ff  fb f6 f2 ff fc f8 f5 ff  |MC:.............|
000000c0  fc f8 f5 ff fc f8 f5 ff  5d 56 50 ff 9f 93 88 ff  |........]VP.....|
000000d0  7f 6f 60 ff 7f 6f 60 ff  7f 6f 60 ff 7f 6f 60 ff  |.o`..o`..o`..o`.|
000000e0  7f 6f 60 ff 9f 93 88 ff  4d 43 3a ff fa f2 ed ff  |.o`.....MC:.....|
000000f0  fb f6 f2 ff fc f8 f5 ff  fc f8 f5 ff fc f8 f5 ff  |................|
00000100  5d 56 50 ff 9f 93 88 ff  7f 6f 60 ff 7f 6f 60 ff  |]VP......o`..o`.|
00000110  7f 6f 60 ff 7f 6f 60 ff  7f 6f 60 ff 9f 93 88 ff  |.o`..o`..o`.....|
00000120  4d 43 3a ff fa f2 ed ff  fb f6 f2 ff fc f8 f5 ff  |MC:.............|
00000130  fc f8 f5 ff fc f8 f5 ff  5d 56 50 ff 9e 92 88 ff  |........]VP.....|
00000140  7e 6e 60 ff 7e 6e 60 ff  7e 6e 60 ff 7e 6e 60 ff  |~n`.~n`.~n`.~n`.|
00000150  7e 6e 60 ff 9e 92 88 ff  4d 43 3a ff fa f2 ed ff  |~n`.....MC:.....|
00000160  fb f6 f2 ff fc f8 f5 ff  fc f8 f5 ff fc f8 f5 ff  |................|
00000170  5d 56 50 ff 9e 92 88 ff  7d 6d 5f ff 7d 6d 5f ff  |]VP.....}m_.}m_.|
00000180  7d 6d 5f ff 7d 6d 5f ff  7d 6d 5f ff 9e 92 88 ff  |}m_.}m_.}m_.....|
00000190  4d 43 3a ff fa f2 ed ff  fb f6 f2 ff fc f8 f5 ff  |MC:.............|
000001a0  fc f8 f5 ff fc f8 f5 ff  5d 56 50 ff 9e 92 88 ff  |........]VP.....|
000001b0  7d 6d 5f ff 7d 6d 5f ff  7d 6d 5f ff 7d 6d 00 fe  |}m_.}m_.}m_.}m..|
000001c0  ff ff 82 fe ff ff 02 00  00 00 00 50 32 00 00 00  |...........P2...|
000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
00000200


=============================== StdErr Messages: ===============================

unlzma: Decoder error

According to this Fedora 14 is visible in sda3. Does anybody know a way to add Fedora 14 to grub.cfg of Ubuntu so I can choose which OS to boot? Thanks in advance.

Best Answer

The easiest way to boot Fedora would be to add an entry to grub.cfg that chain loads to Fedora's copy of Grub.

Create a file /etc/grub.d/15_fedora with the following contents:

#!/bin/sh
cat << \EOF
menuentry "Fedora" {
    set root=(hd0,3)
    chainloader +1
}
EOF

Make the file executable and then regenerate the grub configuration file:

sudo chmod a+x /etc/grub.d/15_fedora
sudo update-grub

This should ensure that the menu entry stays around when the Grub configuration is regenerated.

Related Question