This page details how to convert an Ubuntu installation using Grub Legacy (version 0.97) to Grub 2 (version 1.96 or later) and vice versa.

Grub Legacy (0.97) was the standard Ubuntu bootloader for many years, and was the default through Ubuntu 9.10 (Karmic Koala). While there are users still using the early versions of Ubuntu and Grub Legacy, it is also possible that a user who reverted to Grub Legacy from a newer version now wishes to return to Grub 2. These procedures will work for both first-time upgraders or those who have used Grub 2 in the past.

Upgrading to GRUB 2 From GRUB 0.97

The conversion to the much-improved GRUB 2 is relatively easy. Importantly, the upgrade offers a process to ensure GRUB 2 will work on your machine before the user commits to a full conversion. Note however that the developers made a decision to not use an automatic update to GRUB 2 as the default on upgrade installs.

  • Before installing GRUB 2, if able refresh the repository indexes to ensure the system has the latest update list.
    • The repositories for unsupported Ubuntu releases are probably not available at the original address. The user can access them via http://old-releases.ubuntu.com/releases/ if desired.

    • On supported releases, refreshing the packages will ensure the latest repository packages for the current release are available. Newer repositories may also be enabled but ensure to install only the associated Grub 2 packages (grub-common, grub-pc, grub-pc-bin and grub-gfxpayload-lists) to prevent dependency problems.
    sudo apt-get update
  • To upgrade to GRUB 2 install the grub-pc package. This package can be installed with Synaptic, if installed, or by running the command below. Once the installation begins, a simple script will guide the user through the rest of the installation:

    sudo apt-get install grub-pc
    • The package manager may complain about version conflicts and offer a solution to un-install GRUB. This may cause you to worry that it might become impossible for you to use the "Chain load to GRUB2 from legacy GRUB" option that is mentioned below. Selecting the un-install GRUB option here will not prevent you booting with the legacy menu described in step 4 below.

    1. At the first prompt, read the message, tab to select "OK", then press ENTER.

    g2_configuring_grub-pc.png

    2. After selecting "OK" the next option allows the user to test GRUB 2 by adding an entry to their normal GRUB menu. Select "Yes" to place a Chainload option on the GRUB menu. When GRUB boots the next time, the user can select a normal GRUB entry or transfer control to GRUB 2 via the Chainload entry.

    3. The next step(s) will import sections from GRUB's menu.lst to the "Linux command line" (shown) and possibly the "Linux default command line". These entries allow the user to enter any special commands such as quiet, splash, noapic and others of that nature. GRUB 2 should automatically import these settings. Normally the user should accept any existing entries and TAB to "OK". If necessary, entries can be added later. Refer to the Configuring GRUB 2 section for more detail.

    g2_configuring_command-line.png

info.pngWhen installing on a fresh drive, you may need to mark the selected partition as bootable. Although Linux does not use the boot flag, other OS's may require its presence.

  • 4. During installation the user will be prompted to provide the device(s) on which to install GRUB 2. Use the UP/DOWN keys to highlight a device (sda, sdb, etc), then the SPACE key to select the device. Once at least one device is selected, use the TAB key to highlight OK and press ENTER. Failure to select a drive will result in a GRUB Error 15 and failure of the installation.

    g2_dpkg-reconfigure.png

    Read the information on the screen carefully. Selecting an option which includes a partition number (such as /dev/sda9 in the example) is not recommended. It will install GRUB 2 boot information directly on the Ubuntu partition. The location is specified by blocklists and GRUB 2 is more likely to break if boot files are moved for any reason.

    5. Once the system has installed GRUB 2, the user can reboot and will be greeted by an updated GRUB legacy menu. As shown, the user will see a "Chainload" option which will test the GRUB 2 installation. Selecting the Chainload option will transfer control to GRUB 2 and display a GRUB 2 menu.

    5a. If users experience an "Unrecognized device string" Error 11 when making a selection from the GRUB menu, press "e" to edit the GRUB menuentry. Use the arrow keys to move the cursor to the line beginning with "grub edit> root". Change "root" to "uuid", ENTER, then boot by pressing "b", "F10" or CTRL-x. More details on Error 11 are located in the Command Line and Rescue Mode section.

    5. Test the new entries and note the Grub 1.9X version number at the top of the GRUB 2 menu. (highlight added).

    g2_grubversion1.png

    6. If the GRUB 2 menus function properly the user can upgrade to GRUB 2 at any time by running:

    sudo upgrade-from-grub-legacy

    Upon successful installation of GRUB 2, a message will inform the user that some GRUB Legacy configuration files are still present and can be removed. The instructions provide the following command, which must be run as 'root': rm -f /boot/grub/menu.lst* Use caution when running the rm command as "root". Incorrectly entering this command could result in permanently deleting necessary system files.

Reverting to GRUB Legacy

If a user chooses to return to GRUB legacy (0.97), these steps will remove GRUB 2 and install GRUB.

via Boot-Repair graphical tool

  1. Run Boot-Repair from a liveCD or your installed session

  2. Click "Advanced options" --> GRUB options --> tick the "GRUB Legacy" option

  3. Click the "Apply" button

http://img15.hostingpics.net/pics/924248leg.png

via Command Lines

This works only when your boot is not broken.

  1. Open a terminal. The method varies depending on the Ubuntu release.
  2. Optional: Make backup copies of the main GRUB 2 directories and files.
    • sudo cp /etc/default/grub /etc/default/grub.old

    • sudo cp -R /etc/grub.d /etc/grub.d.old

    • sudo cp -R /boot/grub /boot/grub.old

  3. Remove GRUB 2
    • sudo apt-get purge grub-pc

    • important.png The system will be unbootable until another bootloader is installed.

    • Once the packages are removed, many files will still remain in '/boot/grub'
  4. Install GRUB 0.97
    • sudo apt-get install grub

  5. With grub installed, the user must still create the menu.lst and stage1/stage2 files by running the following two commands.

    1. sudo grub-install /dev/sdX

      • Choose the correct device (sda, sdb, etc), normally the one on which Ubuntu is installed.
      • Creates the stage1 and stage2 files in /boot/grub and writes to the MBR.

    2. sudo update-grub

      • Generates menu.lst

      • Tab to "Yes" when prompted.
  6. Reboot

important.pngIf the user receives an "Unrecognized device string Error 11" message on rebooting see the Resolving an "Unrecognized Device String" (Error 11) section for instructions on how to edit the menu and make the system bootable.


Related Links:

Grub2

Grub2/Installing

GNU GRUB Manual

Grub2/Upgrading (last edited 2012-09-24 12:09:59 by yannubuntu)