GRUB Based Booting (Overview)

In this Solaris release, GRUB is the open source boot loader that is the default for x86 based systems.

Note

GRUB based booting is not available on SPARC based systems in this Solaris release.

The boot loader is the first software program that runs after you turn on a system. This program begins the boot process. After an x86 based system is powered on, the Basic Input/Output System (BIOS) initializes the CPU, the memory, and the platform hardware. When the initialization phase has completed, the BIOS loads the boot loader from the configured boot device, and then gives control of the system to the boot loader.

GRUB implements a simple menu interface that includes boot options that are predefined in a configuration file. GRUB also has a command-line interface that is accessible from the menu interface for performing various boot commands. The GRUB implementation on x86 based systems in the Solaris OS is compliant with the Multiboot Specification, which is described in detail at .

Because the Solaris kernel is fully compliant with the Multiboot Specification, you can boot x86 based systems by using GRUB. With GRUB, you can more easily boot the various operating systems that are installed on your system. For example, on one x86 based system, you could individually boot the following operating systems:

Note

GRUB detects Microsoft Windows partitions but does not verify that the OS can be booted.

Because GRUB is intuitive about file systems and kernel executable formats, you can load an operating system without recording the physical position of the kernel on the disk. With GRUB based booting, the kernel is loaded by specifying its file name, and the drive, and the partition where the kernel resides.

When you boot an x86 based system, the GRUB menu is displayed. This menu provides a list of boot entries to choose from. A boot entry is an OS instance that is installed on your system. The GRUB main menu is based on a configuration file that you can modify.

Note

In this release, the GRUB menu replaces the Solaris Device Configuration Assistant.

How GRUB Based Booting Works

After GRUB gains control of the system, a menu is displayed on the console. In the GRUB main menu, you can do the following:

  • Select a boot entry.

  • Modify a boot entry by using the GRUB edit menu.

  • Load an OS kernel from the command line manually.

The following is a sample of a typical GRUB main menu. This menu consists of two boot entries to choose from. If you do not choose an entry, the system boots the default OS. The default OS is usually the first entry that is displayed in the GRUB main menu.

GNU GRUB  version 0.95  (631K lower / 2095488K upper memory)
 +-------------------------------------------------------------------------+
 | Solaris 10.1 ... X86                                                    |
 | Solaris failsafe                                                        |
 |                                                                         |
 |                                                                         |
 +-------------------------------------------------------------------------+
      Use the ^ and v keys to select which entry is highlighted.
      Press enter to boot the selected OS, 'e' to edit the
      commands before booting, or 'c' for a command-line.

Use the arrows keys to highlight a boot entry, then press Enter to boot the selected entry. If you want to edit a boot entry by using the GRUB edit menu, use the arrow keys to highlight a boot entry in the GRUB main menu. Then, type e to display the GRUB edit menu. If you want to use the command-line interface, use the arrow keys to select a boot entry in the GRUB main menu, then type c.

For a complete list of GRUB terms and definitions, see GRUB Terminology.

A configurable timeout is available to boot the default OS entry. Press any key to abort the default OS entry boot.

When the system is booted, GRUB loads the primary boot archive and the multiboot program. The primary boot archive is a ram image of the file system that contains the Solaris kernel modules and data. See Management of the GRUB Boot Archive for more information. GRUB puts this information in memory, without any interpretations. The multiboot program is an ELF32 executable that contains a multiboot-compliant header. After the operation has completed, GRUB gives control of the system to the multiboot program. GRUB itself then becomes inactive, and system memory is reclaimed.

By reading the boot archive and passing boot-related information to the kernel, the multiboot program is responsible for assembling core kernel modules into memory. The boot-related information is specified by the Multiboot Specification.

Note

The multiboot program works together with the boot archive. You cannot combine the use of a multiboot program from one OS instance with the boot archive from another OS instance.

For more information, see Solaris Kernel Initialization Process in the GRUB Boot Environment.

Changes to the Solaris OS Installation Process

Solaris 10 1/06: The Solaris installation process has changed in the following ways:

  • Minimum memory requirements – To support GRUB, x86 based systems must have at least 256 MBytes of main memory to boot the install miniroot. On systems with insufficient memory, the following message is displayed:

    Selected item can not fit in memory
  • USB drive support – Installation from CD and DVD drives that are connected through USB interfaces is now fully supported.

  • Network installation procedure – The standard procedure for setting up net install images for x86 based systems remains the same. These systems boot with the Preboot eXecution Environment (PXE) mechanism. Systems that are not capable of a PXE boot can use a GRUB floppy.

  • Configuring devices – The GRUB menu replaces the Device Configuration Assistant in this Solaris release. After GRUB loads the Solaris OS, the following installation menu is displayed:

    Select the type of installation you want to perform:
    
    1 Solaris Interactive
    2 Custom JumpStart
    3 Solaris Interactive Text (Desktop session)
    4 Solaris Interactive Text (Console session)
    5 Apply driver updates
    6 Single user shell
    
    Enter the number of your choice followed by the <ENTER> key.
    Alternatively, enter custom boot arguments directly.
    
    If you wait 30 seconds without typing anything,
    an interactive installation will be started.

    Note

    The Device Configuration Assistant and the associated interactive shell is no longer available, starting with the Solaris 10 1/06 release. To add any required drivers during the installation process, select Option 5.

    Note that you must supply an Install Time Update (ITU) floppy diskette, CD, or DVD when applying driver updates during the installation process. The ITU will likely contain a package, but it also might contain a patch. When adding the contents of an ITU image, check the README file for additional instructions.

    To add drivers to the miniroot during installation, follow the steps for patching the x86 miniroot. For step-by-step instructions, see the following documentation:

    • For DVD media, see To Create an x86 Install Server With SPARC or x86 DVD Media in Solaris Express Installation Guide: Network-Based Installations , Step 9.

    • For CD media, see Creating an x86 Install Server With CD Media in Solaris Express Installation Guide: Network-Based Installations , Step 19.

    Option 6 is available for system recovery. This option provides quick access to a root prompt without having to go through the system identification process. Note that option 6 is identical to booting the Solaris failsafe archive option from the GRUB main menu that is displayed when the system is booted.

GRUB Device Naming Conventions

GRUB uses device naming conventions that are slightly different from previous Solaris OS versions. Understanding the GRUB device naming conventions can assist you in correctly specifying drive and partition information when you configure GRUB on your system.

The following table describes the GRUB device naming conventions.

Table 11.1. Naming Conventions for GRUB Devices

Device Name

Description

(fd0), (fd1)

First diskette, second diskette

(nd)

Network device

(hd0,0), (hd0,1)

First and second fdisk partition of first bios disk

(hd0,0,a), (hd0,0,b)

Solaris/BSD slice 0 and 1 on first fdisk partition on the first bios disk

Note

All GRUB device names must be enclosed in parentheses. Partition numbers are counted from 0 (zero), not from 1.

For more information about fdisk partitions, see Guidelines for Creating an fdisk Partition in System Administration Guide: Devices and File Systems .

Functional Components of GRUB

GRUB consists of the following functional components:

  • stage1 – Is installed on the first sector of the Solaris fdisk partition. You can optionally install stage1 on the master boot sector by specifying the m option with the installgrub command. See the installgrub ( 1M ) man page and Disk Management in the GRUB Boot Environment in System Administration Guide: Devices and File Systems for more information.

  • stage2 – Is installed in a reserved area in the Solaris fdisk partition. stage2 is the core image of GRUB.

  • menu.lst – Is a file that is typically located in the /boot/grub directory. This file is read by the GRUB stage2 file. See the section, GRUB Terminology for more information.

You cannot use the dd command to write stage1 and stage2 to disk. stage1 must be able to receive information about the location of stage2 on the disk. Use the installgrub command, which is the supported method for installing GRUB boot blocks.

GRUB Menu

By default, the Solaris menu file resides in /boot/grub/menu.lst. If the Solaris OS is booted from a pcfs partition, the effective menu is then loaded from the /stubboot/boot/grub/menu.lst file. You might also get the same configuration when performing a software upgrade. The contents of this file dictate what is displayed in the GRUB menu when you boot the system. The GRUB menu file contains entries for all the OS instances that are installed on your system, as well as other important boot directives. See How Multiple Operating Systems Are Supported in the GRUB Boot Environment.

Note

In some situations, the GRUB menu.lst file resides elsewhere. For example, if you upgrade your system, the GRUB menu.lst file might exist on a boot environment that is not the currently running boot environment. Or, if you have upgraded a system with an x86 based boot partition, the menu.lst file might reside in the /stubboot directory.

Only the active GRUB menu.lst file is used to boot the system. In order to modify the GRUB menu that is displayed when you boot the system, the active GRUB menu.lst file must be modified. Changing any other GRUB menu.lst file has no effect on the menu that is displayed when you boot the system.

To determine the location of the active GRUB menu.lst file, use the bootadm command. The list-menu subcommand displays the location of the active GRUB menu. For more information, see the bootadm ( 1M ) man page.

You might need to customize the menu.lst file for one of the following reasons:

  • To add new OS entries

  • To add GRUB console redirection information

The instructions for the syntax to use to edit the file can be found in the /boot/grub/menu.lst file comments. Because these changes are not directly related to the Solaris OS, you cannot make them by using the eeprom command. The Solaris software upgrade process preserves any changes that you make to this file.

The following is a partial sample of the /boot/grub/menu.lst file. The list that follows includes a description of the line entries.

default 0
timeout 10
.
.
.

title Solaris
  root (hd0,0,a)
  kernel /platform/i86pc/multiboot -B console=ttya
  module /platform/i86pc/boot_archive
title Solaris (test)
  root (hd0,0,a)
  kernel /boot/grub/multiboot -B console=ttya
  module /platform/i86pc/boot_archive
title Solaris fail-safe single user
  root (hd0,0,a)
  kernel /boot/multiboot -B console=ttya -s
  module /boot/x86.miniroot.safe
title OS name

Specifies the name of the operating system.

default 0

Specifies which item to boot, if the timeout expires.

timeout 10

Specifies the number of seconds to wait for user input before booting the default entry. If no timeout is specified, you are required to choose an entry.

serial --unit=0 --speed=9600

Switches the GRUB output to the tip line. Works in conjunction with the terminal command.

terminal serial

Switches the GRUB output to the tip line. Works in conjunction with the serial command.

root (hd0,0,a)

Specifies on which disk, which partition, and which slice to load the files. GRUB automatically detects the file system type.

kernel /platform/i86pc/multiboot -B console=ttya

Specifies the multiboot program. The kernel command must always be followed by the multiboot program. The string after multiboot is passed to the Solaris OS without interpretation.

Any changes that you make to the file take effect at the next system reboot.

Modifying Boot Behavior in the Solaris OS

The primary methods for modifying boot behavior in the Solaris OS are as follows:

  • By using the eeprom command.

    The eeprom command is used to assign a different value to a standard set of properties. These values, which are the equivalent to the SPARC OpenBoot PROM NVRAM variables, are stored in the /boot/solaris/bootenv.rc file. Changes that are made to the Solaris boot behavior by using the eeprom command persist over each system reboot. See the eeprom ( 1M ) man page for more information.

  • By using the kernel command, which is available in the GRUB menu when the system is booted.

    Note

    Changes that are made with the kernel command override options that you set by using the eeprom command. These changes remain in effect until the next time you boot the system. See the kernel ( 1M ) man page for more information.

You can also modify the Solaris boot behavior in the GRUB menu.lst file, similarly to how you would use the eeprom command. However, this method is not preferred, because the Solaris OS entries in the menu.lst file could be modified during a software upgrade. In this instance, any changes that you made to the file are lost. In contrast, changes made by using the eeprom command are added to the /boot/solaris/bootenv.rc file. This file is handled properly during an upgrade.

For instructions, see Modifying the Solaris Boot Behavior by Editing the GRUB Menu.

GRUB Based Disk Boot

When you install the Solaris OS, two GRUB menu entries are installed on the system by default. The first entry is the Solaris OS entry. The second entry is the miniroot (failsafe) archive, which is intended to be used for system recovery. The GRUB menu entries are installed and then updated automatically as part of the Solaris software installation and upgrade process. These entries are directly managed by the OS and should not be manually edited. For a detailed description of these and other GRUB terms, see GRUB Terminology.

During a standard Solaris OS installation, GRUB is installed on the Solaris fdisk partition, without modifying the system BIOS setting. If the OS is not on the BIOS boot disk, you need to do one of the following:

  • Modify the BIOS setting.

  • Use a boot manager to bootstrap to the Solaris partition. For more details, see your boot manager.

The preferred method is to always install the Solaris OS on the boot disk. If multiple operating systems are installed on the machine, you can add entries to the /boot/grub/menu.lst file. These entries are then displayed in the GRUB menu the next time that the system is booted.

For additional information, see How Multiple Operating Systems Are Supported in the GRUB Boot Environment.

GRUB Based Booting From the Network

This section describes the requirements and warnings for performing a GRUB based boot from the network. For overview information and additional details on booting an x86 based system from the network, see GRUB Based Booting From the Network.

To perform a GRUB based network boot, a DHCP server that is configured for PXE clients is required. A boot server that provides tftp service is also required. The DHCP server supplies the information that the client needs to configure its network interface. The DHCP server must be able to respond to the DHCP classes, PXEClient and GRUBClient with the following information:

  • IP address of the file server

  • Name of the boot file (pxegrub)

The file server is responsible for providing the following:

  • pxegrub binary

  • GRUB menu

  • Multiboot program

  • x86.miniroot

The sequence for performing a PXE network boot of the Solaris OS is as follows:

  1. The BIOS is configured to boot from a network interface.

  2. The BIOS sends a DHCP request.

  3. The DHCP server replies with the server address and the name of the boot file.

  4. The BIOS downloads pxegrub by using tftp and executes pxegrub.

  5. The system downloads a GRUB menu file by using tftp.

    This file displays the boot menu entries that are available.

  6. After you select a menu entry, the system begins to load the Solaris OS.

See How to Set Up a Network Configuration Server in System Administration Guide: IP Services for more information.

Running the add_install_client command creates the /tftpboot_01 ethernet-address file. This file is linked to pxegrub and the/tftpboot/menu.lst.01 ethernet-address file. The /tftpboot/menu.lst.01 ethernet-address file is the GRUB menu file. If this file does not exist, then pxegrub reverts to using DHCP Option 150, if this option is specified, or the /tftpboot/boot/grub/menu.lst file. Typically, a single system is set up to serve both functions. In this instance, the add_install_client command sets up the /tftpboot file with the correct pxegrub menu file and the Solaris files. DHCP service is handled separately by using the add_install_client command. The setup only needs to be completed once per client. See About DHCP Macros and How to Perform a GRUB Based Boot From the Network for more information.

Note

The rpc.bootparamd daemon is usually required on the server side for performing a network boot. However, rpc.bootparamd is not required to perform a network based boot with GRUB.

If no PXE or DHCP server is available, you can load GRUB from a diskette, a CD-ROM, or the local disk. You can then manually configure the network in GRUB and download the multiboot program and the boot archive from the file server.

PXE Network Boot Sequence

Note

The rpc.bootparamd daemon is usually required on the server side for performing a network boot. However, rpc.bootparamd is not required to perform a network based boot with GRUB.

If no PXE or DHCP server is available, you can load GRUB from a diskette, a CD-ROM, or the local disk. You can then manually configure the network in GRUB and download the multiboot program and the boot archive from the file server.

GRUB Terminology

The following GRUB terms are used throughout this documentation. To grasp GRUB concepts, an understanding of these terms is essential.

boot archive

A boot archive is a collection of critical files that is used to boot the Solaris OS. These files are needed during system startup before the root (/) file system is mounted. Two boot archives are maintained on a system:

  • The boot archive that is used to boot the Solaris OS on a system. This boot archive is sometimes called the primary boot archive.

  • The boot archive that is used for recovery when the primary boot archive is damaged. This boot archive starts the system without mounting the root (/) file system. On the GRUB menu, this boot archive is called failsafe. The archive's essential purpose is to regenerate the primary boot archive, which is usually used to boot the system.

boot loader

The boot loader is the first software program that runs after you turn on a system. This program begins the booting process.

failsafe archive

See boot archive.

GRUB

GNU GRand Unified Bootloader (GRUB) is an open source boot loader with a simple menu interface. The menu displays a list of the operating systems that are installed on a system. GRUB enables you to easily boot these various operating systems, such as the Solaris OS, Linux, or Microsoft Windows.

GRUB edit menu

A boot menu that is a submenu of the GRUB main menu. GRUB commands are displayed on this menu. These commands can be edited to change boot behavior.

GRUB main menu

A boot menu that lists the operating systems that are installed on a system. From this menu, you can easily boot an operating system without modifying the BIOS or fdisk partition settings.

menu.lst file

A file that lists all the operating systems that are installed on a system. The contents of this file dictate the list of operating systems that is displayed on the GRUB menu. From the GRUB menu, you can easily boot an operating system without modifying the BIOS or fdisk partition settings.

miniroot

A minimal, bootable root (/) file system that resides on the Solaris installation media. A miniroot consists of the Solaris software that is required to install and upgrade systems. On x86 based systems, the miniroot is copied to the system to be used as the failsafe boot archive. See boot archive for details.

primary boot archive

See boot archive.