Image of Linux Kernel Development (3rd Edition)
Image of XSLT 2.0 and XPath 2.0 Programmer's Reference (Programmer to Programmer)
Image of Modern Operating Systems (3rd Edition)
Image of Operating System Concepts

Upgrading Fedora 13 to GRUB2

While a number of other GNU/Linux releases such as Ubuntu have moved to GRUB2, Fedora continues to use GRUB Legacy. Some preliminary investigation work on migrating to GRUB2 was done by Jeremy Katz for the Fedora Project when he worked for Red Hat. but that work seems to have completely stopped when he left Red Hat as the last update of the project page was in July 2009.

This post will show you how to migrate your Fedora 13 system to boot using GRUB2 instead of GRUB Legacy. As always, back up your system before attempting the migration. Things can and do go wrong. Even for you! Yes you! You have been warned! If you have a serious problem with a bootloader that you are unfamiliar with, you can end up spending many frustrating hours attempting to get the system to successfully boot.

There currently is a GRUB2 package (RPM) available for Fedora 13 (Goddard). As of the date of this post, the RPM version is grub2-1.98-2.fc13.*.rpm. However, it is does not replace GRUB Legacy with GRUB2. Instead it co-exists with GRUB Legacy and adds itself to the GRUB Legacy menu upon installation so you are able to select GRUB2 from the GRUB Legacy menu when booting your system. Here is the README.Fedora that is included with this package:

Using GNU GRUB 2 in Fedora

Though GRUB 2 provides various feature enhancements over previous GRUB
version (referred to as "GRUB", or "GRUB Legacy"), it did not reach its
stability and feature completness yet, and thus is not ready to replace
it for the whole user base. This package is primarily intended to
encourage testing and accelerate distribution integration.

It is generally safe to install the package. It is able to co-exist with
existing GRUB installation and adds itself to the GRUB menu upon
installation, so you'll able to select GRUB 2 from GRUB menu during
the boot.


The GRUB 2 utilities are prefixed (or postfixed) with 'grub2':



The GRUB 2 lacks documentation. While you are encouraged to contribute
the documentation, you can use the GRUB 2 Wiki [1] as primary source of
information pertaining to this development snapshot.


If you intend to install grub2 as your primary boot loader refer to
the GRUB 2 Wiki for information on how to set it up.

Support channels

If you find a bug in this package, report them to the Red Hat Bugzilla [2].
For talk about using grub2, use IRC channel #grub on freenode Network [3].
You can meet this package maintainer there (nick lkundrak).


Lubomir Rintel 
Fedora Project

This is a rather strange way to add GRUB2 support to Fedora since it adds no value to the boot process. Instead it complicates it. First boot to GRUB Legacy, then select GRUB2 then boot Fedora. It does not supplant GRUB Legacy. It renames the GRUB2 scripts and binaries and thus is incompatible with other platforms that use GRUB2. In my opinion, users should simply avoid installing this package and the quicker this package is obsoleted the better.

We will build GRUB2 from the 1.98 release source tarball and replace GRUB legacy with GRUB2. After you are finished there will be no dependency on GRUB Legacy. You can download the 1.98 release from For the purpose of this post I am going to use /work/grub2 as the build directory.

$ mkdir -p /work/grub2
$ cd /work/grub2
$ wget
$ wget
$ gpg --verify grub-1.98.tar.gz.sig
$ tar xvf grub-1.98.tar.gz
$ cd grub-1.98
$ ls
cinclude.m4    DISTLIST      mkinstalldirs
aclocal.m4      docs                gentrigtables.c       mmap
AUTHORS         efiemu           NEWS      font                gettext               normal
autom4te.cache  fs                  gfxmenu               partmap
boot         gnulib                parttool
bus         grub-1.98.tar.gz.sig  po
ChangeLog        hello                 README
commands   hook                  script
conf      include     
config.guess          INSTALL               term   install-sh            tests
config.rpath    genmk.rb            io                    THANKS
config.sub      genmoddep.awk       kern                  TODO
configure        lib                   util   loader                video
disk      missing
$ ls -d */
autom4te.cache/  disk/    gettext/  include/  mmap/      script/
boot/            docs/    gfxmenu/  io/       normal/    term/
bus/             efiemu/  gnulib/   kern/     partmap/   tests/
commands/        font/    hello/    lib/      parttool/  util/
conf/            fs/      hook/     loader/   po/        video/

You may be wondering why I downloaded a second file, i.e. gpg –verify grub-1.98.tar.gz.sig<./em>. Each downloadable tarball at has an accompanying .sig file. This is a digital signature created with GnuPG. Assuming you already have a suitable public key, you can verify the signature of the downloaded tarball using gpg –verify grub-1.98.tar.gz.sig.

Next you need to configure the GRUB2 build environment using configure:

./configure --enable-efiemu=no
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for cmp... cmp
checking for bison... bison
checking for gawk... (cached) gawk
checking whether make sets $(MAKE)... (cached) yes
config.status: creating Makefile
config.status: creating
config.status: creating
config.status: creating stamp-h
config.status: creating config.h
config.status: config.h is unchanged
config.status: linking include/grub/i386 to include/grub/cpu
config.status: linking include/grub/i386/pc to include/grub/machine
config.status: executing depfiles commands
config.status: executing po-directories commands
GRUB2 will be compiled with following components:
Platform: i386-pc
With memory debugging: No
efiemu runtime: No (explicitly disabled)
grub-fstest: Yes
grub-mkfont: No (need freetype2 library)

Notice that I explicitly turned off EFI emulation via a configure command line option as you really do not need it. You can use configure –help to see what other options are available to customize the build.

Next build the GRUB2 binaries and modules. You can perform the build on either a 32-bit or a 64-bit system; it does not manner.

$ make
gcc -Ignulib -I./gnulib -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1 -DGRUB_KERNEL_MACHINE_LINK_ADDR=0x8200 -MD -c -o grub_mkimage-gnulib_progname.o gnulib/progname.c
gcc -Iutil -I./util -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -DGRUB_MACHINE_PCBIOS=1 -DGRUB_UTIL=1 -DGRUB_KERNEL_MACHINE_LINK_ADDR=0x8200 -MD -c -o grub_mkimage-util_grub_mkrawimage.o util/grub-mkrawimage.c
/bin/mkdir -p $(dirname po/
/usr/bin/msgfmt -c --statistics -o po/ po/ru.po
268 translated messages, 1 fuzzy translation, 1 untranslated message.
/usr/bin/msgmerge -U po/sv.po po/grub.pot
...................................... done.
/bin/mkdir -p $(dirname po/
/usr/bin/msgfmt -c --statistics -o po/ po/sv.po
168 translated messages, 1 fuzzy translation, 101 untranslated messages.
/usr/bin/msgmerge -U po/zh_CN.po po/grub.pot
.............................................. done.
/bin/mkdir -p $(dirname po/
/usr/bin/msgfmt -c --statistics -o po/ po/zh_CN.po
268 translated messages, 1 fuzzy translation, 1 untranslated message.

If the build is successful, you then install the build using make install.

# make install
/usr/bin/msgmerge -U po/ast.po po/grub.pot
....................................... done.
/usr/bin/msgmerge -U po/ca.po po/grub.pot
............................................ done.
/usr/bin/msgmerge -U po/de.po po/grub.pot
..................................... done.
/usr/bin/msgmerge -U po/fi.po po/grub.pot
...................................... done.
/usr/bin/msgmerge -U po/fr.po po/grub.pot
......................................... done.
/usr/bin/msgmerge -U po/hu.po po/grub.pot
........................................ done.
/usr/bin/msgmerge -U po/id.po po/grub.pot
....................................... done.
/usr/bin/msgmerge -U po/it.po po/grub.pot
.................................. done.
/usr/bin/msgmerge -U po/nl.po po/grub.pot
......................................... done.
/usr/bin/msgmerge -U po/ru.po po/grub.pot
..................................... done.
/usr/bin/msgmerge -U po/sv.po po/grub.pot
....................................... done.
/usr/bin/msgmerge -U po/zh_CN.po po/grub.pot
...................................... done.
/bin/sh ./mkinstalldirs /usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`
mkdir -p -- /usr/local/lib/grub/i386-pc
rm -f /usr/local/lib/`echo grub/i386-pc | sed 's,x,x,'`/*
/bin/sh ./mkinstalldirs /usr/local/share/`echo grub | sed 's,x,x,'`
mkdir -p -- /usr/local/share/grub
/bin/sh ./mkinstalldirs /usr/local/bin /usr/local/share/man/man1
mkdir -p -- /usr/local/bin /usr/local/share/man/man1
/bin/sh ./mkinstalldirs /usr/local/sbin /usr/local/share/man/man8
mkdir -p -- /usr/local/sbin /usr/local/share/man/man8
/bin/sh ./mkinstalldirs /usr/local/etc/grub.d
mkdir -p -- /usr/local/etc/grub.d
/bin/sh ./mkinstalldirs /usr/local/lib/grub
/bin/sh ./mkinstalldirs /usr/local/share/info

If you thought that make install actually installed GRUB2 you are mistaken. Instead this command installs the GRUB2 build system into /usr/local. You then use some of these scripts and binaries to install and configure GRUB2. make install simply populates a number of subdirectories in /usr/local.

# ls /usr/local/bin
grub-bin2h    grub-mkelfimage  grub-mkpasswd-pbkdf2  grub-script-check
grub-editenv  grub-mkimage     grub-mkrelpath
grub-fstest   grub-mkisofs     grub-mkrescue
# ls /usr/local/sbin 
grub-install   grub-mkdevicemap  grub-reboot       grub-setup
grub-mkconfig  grub-probe        grub-set-default
# ls /usr/local/etc/grub.d
00_header  10_linux  30_os-prober  40_custom  README

To actually install GRUB2 on your system, the easiest way is to run the grub-install shell script which in turn calls other scripts and binaries to do the actual work. The only parameter you need to pass to grub-install is a boot device. In our case it is /dev/sda.

# cd /usr/local/sbin
# ./grub-install --help
Usage: grub-install [OPTION] install_device
Install GRUB on your drive.

  -h, --help              print this message and exit
  -v, --version           print the version information and exit
  --modules=MODULES       pre-load specified modules MODULES
  --root-directory=DIR    install GRUB images under the directory DIR
                          instead of the root directory
  --grub-setup=FILE       use FILE as grub-setup
  --grub-mkimage=FILE     use FILE as grub-mkimage
  --grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
  --grub-probe=FILE       use FILE as grub-probe
  --no-floppy             do not probe any floppy drive
  --recheck               probe a device map even if it already exists
  --force                 install even if problems are detected
  --disk-module=MODULE    disk module to use

INSTALL_DEVICE can be a GRUB device name or a system device filename.

grub-install copies GRUB images into /boot/grub (or /grub on NetBSD and
OpenBSD), and uses grub-setup to install grub into the boot sector.

If the --root-directory option is used, then grub-install will copy
images into the operating system installation rooted at that directory.

Report bugs to .
# ./grub-install /dev/sda
Installation finished. No error reported.

So what does grub-install actually do? Among other things, it

  • Copies all the module (*.mod) files from /work/grub into /boot/grub.
  • Copies all the list (*.lst) files from /work/grub into /boot/grub. Simply put, a .lst file maps an entity to a module. For example, moddep.lst contains a list of all the other modules that a particular module depends on. When a module is loaded, the dependent modules are also automatically loaded.
  • Generates a core image (core.img) which contains the basic GRUB2 image, plus the filesystem driver module needed to read the filesystem which contains the GRUB2 files and possibly one or more other modules. In our case, the appropriate filesystem module is ext2.mod.
  • Modifies the contents of core.img to insert specific values for the boot device and the addresses of the other blocks of the file It then copies core.img to specific sectors on the boot device. In our case, the first 0×10000 sectors (32Kb) immediately following the MBR Master Boot Record).
  • Generates and write an 512-byte MBR image to the appropriate area of the boot device which includes a pointer to the first block of core.img.

Here is a listing of the files that are installed in /boot/grub:

acpi.mod          dm_nv.mod                    gfxterm.mod    msdospart.mod        search_label.mod
affs.mod          drivemap.mod                 gptsync.mod    multiboot2.mod       search.mod
afs_be.mod        echo.mod                     grubenv        multiboot.mod        serial.mod
afs.mod           efiemu32.o                   gzio.mod       normal.mod           setjmp.mod
aout.mod          efiemu64.o                   halt.mod       ntfscomp.mod         setpci.mod
ata.mod           efiemu.mod                   handler.lst    ntfs.mod             sfs.mod
ata_pthru.mod     elf.mod                      handler.mod    ohci.mod             sh.mod
at_keyboard.mod   example_functional_test.mod  hashsum.mod    part_acorn.mod       sleep.mod
befs_be.mod       ext2.mod                     hdparm.mod     part_amiga.mod       tar.mod
befs.mod          extcmd.mod                   hello.mod      part_apple.mod       terminal.lst
biosdisk.mod      fat.mod                      help.mod       part_gpt.mod         terminal.mod
bitmap.mod        font.mod                     hexdump.mod    partmap.lst          terminfo.mod
bitmap_scale.mod  fshelp.mod                   hfs.mod        part_msdos.mod       test.mod
blocklist.mod     fs.lst                       hfsplus.mod    part_sun.mod         tga.mod
boot.img          functional_test.mod          iso9660.mod    parttool.lst         trig.mod
boot.mod          gcry_arcfour.mod             jfs.mod        parttool.mod         true.mod
bsd.mod           gcry_blowfish.mod            jpeg.mod       password.mod         udf.mod
bufio.mod         gcry_camellia.mod            kernel.img     password_pbkdf2.mod  ufs1.mod
cat.mod           gcry_cast5.mod               keystatus.mod  pbkdf2.mod           ufs2.mod
cdboot.img        gcry_crc.mod                 linux16.mod    pci.mod              uhci.mod
chain.mod         gcry_des.mod                 linux.mod      play.mod             usb_keyboard.mod
charset.mod       gcry_md4.mod                 lnxboot.img    png.mod              usb.mod
cmp.mod           gcry_md5.mod                 loadenv.mod    probe.mod            usbms.mod
command.lst       gcry_rfc2268.mod             locale         pxeboot.img          usbtest.mod
configfile.mod    gcry_rijndael.mod            loopback.mod   pxecmd.mod           vbeinfo.mod
core.img          gcry_rmd160.mod              lsmmap.mod     pxe.mod              vbe.mod
cpio.mod          gcry_seed.mod                ls.mod         raid5rec.mod         vbetest.mod
cpuid.mod         gcry_serpent.mod             lspci.mod      raid6rec.mod         vga.mod
crc.mod           gcry_sha1.mod                lvm.mod        raid.mod             vga_text.mod
crypto.lst        gcry_sha256.mod              mdraid.mod     read.mod             video_fb.mod
crypto.mod        gcry_sha512.mod              memdisk.mod    reboot.mod           video.lst
datehook.mod      gcry_tiger.mod               memrw.mod      reiserfs.mod         video.mod
date.mod          gcry_twofish.mod             minicmd.mod    relocator.mod        videotest.mod
datetime.mod      gcry_whirlpool.mod           minix.mod      scsi.mod             xfs.mod        gettext.mod                  mmap.mod       search_fs_file.mod   xnu.mod
diskboot.img      gfxmenu.mod                  moddep.lst     search_fs_uuid.mod   xnu_uuid.mod

Now GRUB2 is nearly ready to use. The only thing missing is a working grub.cfg configuration file located in the /boot/grub/ subdirectory. You can edit the /etc/default/conf configuration file and then use /usr/local/sbin/grub-mkconfig to create /boot/grub/grub.cfg. Note some distributions, including Ubuntu, specify the use of update-grub instead of grub-mkconfig. However update-grub is simply a link to grub-mkconfig. This is the official way of doing things. I, on the other hand, find it easier just to directly edit /boot/grub/grub.cfg and skip the other steps. Why complicate things!

You can easily modify your GRUB Legacy configuration file to work with GRUB2. For example, here is a very basic menu.lst configuration file for GRUB Legacy which boots Fedora 13 from /dev/sda:


title Fedora (
	root (hd0,0)
	kernel /vmlinuz- ro root=/dev/mapper/vg_ultra-lv_root rd_LVM_LV=vg_ultra/lv_root rd_LVM_LV=vg_ultra/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us rhgb quiet
	initrd /initramfs-

and here is the same configuration modified to work with GRUB2:


menuentry "Fedora 13" {
   linux /vmlinuz- ro root=/dev/mapper/vg_ultra-lv_root rd_LVM_LV=vg_ultra/lv_root rd_LVM_LV=vg_ultra/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us rhgb quiet
   initrd /initramfs-

As you can see the structure of a menu stanza has changed. Menu stanzas are now delineated by means of the menuitem “Name” { } syntax rather than by Python-like indenting. The keyword kernel is replaced with a new keyword linux. GRUB2 partitions start from 1 rather than 0 – hence root=(hd0,0) becomes root=(hd0,1).

If you want to display the GRUB2 menu at a higher resolution than VGA and display a background graphic, you have to modify your GRUB2 configuration file to support the higher resolution. The vbe.mod loadable module provides drivers for standard VESA BIOS Extentions 2.0 graphics. In addition you have to supply a suitable font.for the text glyphs and a background image of suitable format and resolution. For example, the following is a simple GRUB2 configuration file which uses the vbe.mod and gfxterm.mod modules to display the GRUB2 menu with a resolution of 1024 x 768 and a full screen background image (f13rockets.tga) using a unicode font.


if loadfont /grub/font/unicode.pf2
   set gfxmode="1024x768x32"
   set gfxpayload=keep
   insmod gfxterm
   insmod vbe
   terminal_output gfxterm
   terminal gfxterm
   insmod tga
   background_image /grub/image/f13rockets.tga

set color_normal=yellow/black
set color_highlight=blue/yellow
set menu_color_normal=yellow/black
set menu_color_highlight=white/light-gray

menuentry "Fedora 13" {
   linux /vmlinuz- ro root=/dev/mapper/vg_ultra-lv_root rd_LVM_LV=vg_ultra/lv_root rd_LVM_LV=vg_ultra/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us rhgb quiet
   initrd /initramfs-

I suggest you start with a very simple GRUB2 configuration file such as the first example shown above for the first reboot of your system after installing GRUB2. Once you can successfully boot your system using that configuration, then you can experiment with more complex and sophisticated configuration file. Walk before you run! The rescue mode in GRUB2 is better than that in GRUB Legacy but you will quickly run into problems if you are unfamiliar with GRUB2.

By the way, if you want GRUB2 to install the build and configuration scripts and binaries in more expected location than /usr/local, here is how I configure my GRUB2 build:

# ./configure --prefix=/usr --sysconfdir=/etc --disable-largefile --enable-efiemu=no --disable-grub-fstest

During install, the subdirectories /usr/sbin, /usr/bin, /usr/lib/grub, /usr/share/grub, /etc/default and /etc/grub. are populated with the relevant GRUB2 files.
This post should be enough to enable you to migrate to booting your Fedora system using GRUB2. Good luck with the migration! If you discover that I have left out any step that should be included in this post, please let me know.

8 comments to Upgrading Fedora 13 to GRUB2

  • al

    getting ready to try this… I always feel like I have forgotten something just before cranking this kind of thing up.

    will let you know.


  • al

    ok… it is working now. not too much trouble. good idea to do:
    rpm -qa |grep grub
    rpm -e grub
    (the legacy grub1)
    If grub1 (legacy) is installed you need to get rid of it,
    that’s why Fedora does the complex work around.

    It’s ok if grubby stays behind, it didn’t seem to cause any problem.

    They don’t really work smoothly together if you are looking for real grub2.
    In other words, you don’t get to choose grub1 or grub2 at boot.
    I’m sure there is a way but not for this go round.

    The first time I rebooted after the install of grub2 I had not removed grub1.
    This brought up the grub1 menu and boot was ok, but that wasn’t what I was looking for.
    After rpm -e grub and redo the grub-install it was a pure grub2 boot.


  • al

    stupid me… the info about removing the legacy version was hinted at in the Ubuntu wiki

    In other words after you run the “we-do-it” scripts the wiki states:

    [GRUB 2 should be fully installed, with GRUB legacy removed, and it's configuration files backed up. GRUB legacy configuration files are located in /boot/grub and are named menu.lst*
    You can confirm the version you are installing at any time with:]
    grub-install -v

    The trick is that they have a bunch of nice scripts to do the remembering of the details for them.
    Nothing like on Fedora 13 yet.

  • Al,

    You are correct. GRUB Legacy and GRUB2 do not really co-exist. You need to pick one or the other. I have moved all my GNU/Linus platforms to GRUB2 and have never looked back.

  • Quintesse

    Just encountered this article and would like to try it, but I wondered if (Fedora?) specific features like automatically adding new kernels to the menu will keep working?

    • Good question. Yes, this is an issue. Fedora 13 knows nothing about GRUB2. The update script will try and modify grub.conf and not grub.cfg. That is why I leave a dummy grub.conf in place so that the update script can find it.

      You will have to manually modify grub.cfg to add a stanza for the new kernel or modify an existing stanza to point to the new kernel.

  • peter


    When I follow your steps including the ./configure part to set the /etc sysconfig directories, it still doesn’t look at the /etc/default/grub file

    So the 00_header and other files in /etc/grub.d don’t get the settings that are supposed to be passed to it from /etc/default/grub file.

    Any ideas why it’s not looking at that file?

  • I do not know whose instructions you are following but they certainly are not mine.

    I recommend ignoring the files in /etc/grub.d and directly editing grub.cfg. Why do I need to edit one or more configuration files, run a script to update grub.cfg when I can directly edit grub.cfg? Makes absolutely no sense to me! What value does it add? Such technological deconstructionism ignores the past and especially the KISS (Keep It Simple Stupid) principle.

    However if you wish to follow the “recommended and documented” method, depending on your particular version of GRUB2, use update-grub or grub-mkconfig to update your boot.cfg.

    Yup, the GRUB2 developers change the names of scripts at a whim! Fine to change the script name; I have no problem with that. However it would be better practice to link the old script to the new script with a suitable advisory message for at least one release.