18. Bootloader expert use

If you haven't done so yet, please read Section 17, “Bootloader main options” first.

18.1. Adding a GRUB2 based system manually

A GRUB2 based system may be added to the Mageia boot menu as follows:

  • Boot into the system in question. In order to determine the GRUB2 version run the following command in a terminal:

    sudo grub-install --version

    or if that fails try:

    sudo grub2-install --version

  • If this returns "GNU GRUB version 0.97" (possibly with a custom suffix), then it is using GRUB (otherwise called GRUB legacy) not GRUB2 and your system should be correctly identified by Mageia during installation and added automatically to the menu.

  • If this returns (GRUB) 1.98 or 1.99 or 2.xx, then you are using GRUB2.

    Make a note of the version and enter this command to identify the root partition:

    df -h / |(read; awk '{print $1; exit}')

    This will output something like :

    /dev/sdb11

    sdb11 is the root partition - make a note of it.

  • Now check that the /boot folder is in the same partition by entering the following command:

    df -h /boot |(read; awk '{print $1; exit}')

    If the /boot partition is different to the root partition then make a note and use the /boot partition in the "root" line when editing menu.lst below.

  • You can now shut down the system and install Mageia.

  • In your new running Mageia system, open a terminal and as root edit the file /boot/grub/menu.lst as follows:

  • To become root use:

    su -

    (enter root password)

  • To open the file in an editor use:

    kwrite /boot/grub/menu.lst

    (replace "kwrite" with "gedit" if you are using Gnome)

  • Add the following entry for your (e.g. Ubuntu) system, possibly as the second stanza. The position the item appears in the menu will depend on its position in the file:

    title Ubuntu

    root (hd1,10)

    kernel /boot/grub/core.img

  • [Note]

    In the second line, "hd1" means the second hard drive, the "10" indicates the 11th partition. Drives and partitions in Mageia's legacy GRUB count from zero.

    Therefore:

    sdb11 = (hd1,10)

    sda1 = (hd0,0)

  • If the GRUB2 version is 2.xx then change the last line to :

    kernel /boot/grub/i386-pc/core.img

    If you needed to use "grub2-install" earlier then change "grub" to "grub2" in the last line.

    If /boot was on a separate partition, then remove "/boot" from the last line.

  • Save the file and re-boot. You should now see your "Ubuntu" entry in the menu and be able to boot from it.

18.2. Using an existing GRUB2 bootloader

If you didn't read the general part about using an existing bootloader yet, do so now. See Section 17.2, “Using an existing bootloader”

[Note]

There is a known bug in OS-prober used during GRUB2 installation in some versions of Debian/Ubuntu that incorrectly creates grub.cfg when adding Mageia (or Mandriva) systems. This is simple to work around and details of a fix can be found in the Mageia forum. Search for "prober", the topic is "grub problem", post #9 has the information.

To make the fix permanent so that it will survive an Ubuntu kernel update, the Mageia entry should be added to /etc/grub.d/40_custom

Stop Press: The bug is fixed in os-prober-1.53 released on 8th May 2012. So now, upgrading to the new version in your GRUB2 installation is the preferred solution.