Tuesday, July 2, 2013

How to Restore-edit Linux Grub2 After Windows is reinstalled in dual boot

Shared via https://help.ubuntu.com/community/Grub2

GRUB 2 is the default boot loader and manager for Ubuntu since version 9.10 (Karmic Koala). As the computer starts, GRUB 2 either presents a menu and awaits user input or automatically transfers control to an operating system kernel. GRUB 2 is a descendant of GRUB (GRand Unified Bootloader). It has been completely rewritten to provide the user significantly increased flexibility and performance. GRUB 2 is Free Software.

In this guide, GRUB 2 is version 1.98 or later. GRUB legacy (version 0.97) will be referred to as GRUB. To determine your version, use grub-install -v. Grub version 1.99 will be the default on Ubuntu 11.04 (Natty Narwhal) and introduces some major changes in the Grub file contents. The main user interface file, /etc/default/grub will appear relatively unchanged to the user. This guide primarily details the use of Grub 1.98, the Grub release found in Ubuntu 10.04 LTS (Lucid Lynx). Content reflecting other versions of Grub 2 will be noted in the appropriate entry.

Improvements

GRUB 2's major improvements over the original GRUB include:

    Scripting support including conditional statements and functions
    Dynamic module loading
    Rescue mode
    Custom Menus
    Themes
    Graphical boot menu support and improved splash capability
    Boot LiveCD ISO images directly from hard drive
    New configuration file structure
    Non-x86 platform support (such as PowerPC)
    Universal support for UUIDs (not just Ubuntu)

GRUB vs GRUB 2

GRUB 2's default menu will look familiar to GRUB users but there are a great number of differences beneath the surface.

    On a new installation of Ubuntu 9.10 or later with no other installed operating systems, GRUB 2 will boot directly to the login prompt or Desktop. No menu will be displayed.
    Hold down SHIFT to display the menu during boot. In certain cases, pressing the ESC key may also display the menu.

    No /boot/grub/menu.lst. It has been replaced by /boot/grub/grub.cfg.
    There is no "/find boot/grub/stage1" at the grub prompt. Stage 1.5 has been eliminated.

    The main Grub 2 configuration file, normally located in the /boot/grub folder, is grub.cfg. It is the product of various scripts and should not normally be edited directly.

    grub.cfg is overwritten by certain Grub 2 package updates, whenever a kernel is added or removed, or when the user runs update-grub.

    The menu list of available Linux kernels is automatically generated by running update-grub.

    The user can create a custom file in which the user can place his own menu entries. This file will not be overwritten. By default, a custom file named 40_custom is available for use in the /etc/grub.d folder.

    The primary configuration file for changing menu display settings is called grub and by default is located in the /etc/default folder.

    There are multiple files for configuring the menu - /etc/default/grub mentioned above, and all the files in the /etc/grub.d/ directory.

    Partition numbering has changed. The first partition is now 1 rather than 0. The first device/drive is still hd0 by default (no change). These designations can be altered if necessary in the device.map file in the /boot/grub folder.

    Automated searches for other operating systems, such as Windows, are accomplished whenever update-grub is executed. Operating systems found will be placed in the Grub 2 menu.

    Changes made in the configuration files will not take effect until the update-grub command is executed.

No comments:

Post a Comment