Understanding GRUB

GRUB (Grand Unified Loader for x86 systems only) 


  • It loads the boot archive(contains kernel modules & configuration files) into the system's memory.
  • It has been implemented on x86 systems that are running the Solaris OS.

Some Important Terms before we proceed ahead:

Boot Archive: Collection of important system file required to boot the Solaris OS. The system maintains two boot archive:
1. Primary boot archive: It is used to boot Solaris OS on a system.
2. Secondary boot archive: Failsafe Archive is used for system recovery in case of failure of primary boot archive. It is referred as Solaris  failsafe in the GRUB menu.

Boot loader: First software program executed after the system is powered on.

GRUB edit Menu: Submenu of the GRUB menu.

GRUB main menu: It lists the OS installed on a system.
menu.lst file: It contains the OS installed on the system. The OS displayed on the GRUB main menu is determined by menu.lst file.

Miniroot: It is a minimal bootable root(/) file system that is present on the Solaris installation media. It is also used as failsafe boot archive.

GRUB-Based Booting:
1. Power on system.
2. The BIOS initializes the CPU, the memory & the platform hardware.
3. BIOS loads the boot loader from the configured boot device. The BIOS then gives the control of system to the boot loader.

The GRUB implementation on x86 systems in the Solaris OS is compliant with the multiboot specification. This enables to :
1. Boot x86 systems with GRUB.
2. individually boot different OS from GRUB.

Installing OS instances:
1. The GRUB main menu is based on a configuration file.
2. The GRUB menu is automatically updated if you install or upgrade the Solaris OS.
3. If another OS is installed, the /boot/grub/menu.lst need to be modified.

GRUB Main Menu: 
It can be used to : 
1. Select a boot entry.
2. modify a boot entry.
3. load an OS kernel from the command line.

Editing the GRUB Maine menu:
1. Highlight a boot entry in GRUB Main menu.
2. Press 'e' to display the GRUB edit menu.
3. Select a boot entry and press 'c'.

Working of GRUB-Based Booting:
1. When a system is booted, GRUB loads the primary boot archive & multiboot program. The primary boot archive, called /platform/i86pc/boot_archive, is a RAM image of the file system that contains the Solaris kernel modules & data.
2. The GRUB transfers the primary boot archive and the multiboot program to the memory without any interpretations.
3. System Control is transferred to the multiboot program. In this situation, GRUB is inactive & system memory is restored. 
The multiboot program is now responsible for assembling core kernel modules into memory by reading the boot archive modules and passing boot-related information to the kernel.

GRUB device naming conventions:
(fd0), (fd1) : First diskete, second diskette
(nd): Network device
(hd0,0),(hd0,1): First & second fdisk partition of the first bios disk
(hd0,0,a),(hd0,0,b): SOLARIS/BSD slice 0 & 1 (a & b) on the first fdisk partition on the first bios disk.

Functional Component of GRUB
It has three functional components:
1. stage 1: It is installed on first sector of SOLARIS fdisk partition
2. stage 2: It is installed in a reserved areal in SOLARIS fdisk partition.  It is te core image of GRUB.
3. menu.lst: It is a file located in /boot/grub directory. It is read by GRUB stage2 functional component.

The GRUB Menu
1. It contains the list of all OS instances installed on the system.
2. It contains important boot directives.
3. It requires modification of the active GRUB menu.lst file for any change in its menu options.

Locating the GRUB Menu:
#bootadm list-menu
The locatiofor the active GRUB menus is : /boot/grub/menu.lst

Edit the menu.lst file to add new OS entries & GRUB console redirection information.
Edit the menu.lst file to modify system behaviour.

GRUB Main Menu Entries:
On installing the Solaris OS, by default two GRUB menu entries are installed on the system:
1. Solaris OS entry: It is used to boot Solaris OS on a system.
2. miniroot(failsafe) archieve: Failsafe Archive is used for system recovery in case of failure of primary boot archive. It is referred as Solaris  failsafe in the GRUB menu.

Modifying menu.lst: 
When the system boots, the GRUb menu is displayed for a specific period of time. If the user do not select during this period, the system boots automatically using the default boot entry. 
The timeout value in the menu.lst file:
1. determines if the system will boot automatically
2. prevents the system from booting automatically if the value specified as -1.


Modifying X86 System Boot Behavior
1. eeprom command: It assigsn a different value to a standard set of properties. These values are equivalent to the SPARC OpenBoot PROM NVRAM variables and are saved in /boot/solaris/bootenv.rc
2. kernel command: It is used to modify the boot behavior of a system.
3. GRUB menu.lst: 
Note: 
1.The kernel command settings override the changes done by using the eeprom command. However, these changes are only effective until you boot the system again.
2. GRUB menu.lst is not preferred option because entries in menu.lst file can be modified during a software upgrade & changes made are lost.

Verifying the kernel in use:
After specifying the kernel to boot using the eeprom or kernel commands, verify the kernel in use by following command:
#prtconf -v | grep /platform/i86pc/kernel


GRUB Boot Archives
The GRUB menu in Solaris OS uses two boot archive:
1. Primary boot archive: It shadows a root(/) file system. It contains all the kernel modules, driver.conf files & some configuration files. All these configuration files are placed in /etc directory. Before mounting the root file system the kernel reads the files from the boot archive. After the root file system is mounted, the kernel removes the boot archive from the memory.
2. failsafe boot archive: It is self-sufficient and can boot without user intervention. It does not require any maintenance. By default, the failsafe boot archive is created during installation and stored in /boot/x86.minor-safe.

Default Location of primary boot archive: /platform/i86pc/boot_archive

Managing the primary boot archive:
The boot archive :
1. needs to be rebuilt, whenever any file in the boot archive is modified.
2. Should be build on system reboot.
3. Can be built using bootadm command
#bootadm update-archive -f -R /a
Options of the bootadm command:
-f: forces the boot archive to be updated
-R: enables to provide an alternative root where the boot archive is located.
-n: enables to check the archive content in an update-archive operation, without updating the content.

The boot archive can be rebuild by booting the system using the failsafe archive.

Booting a system in GRUB-Based boot environment

Booting a System to Run Level 3(Multiuser Level):
To boot a system functioning at run level 0 to 3:
1. reboot the system.
2. press the Enter key when the GRUB menu appears.
3. log in as the root & verify that the system is running at run level 3 using :
#who -r

Booting a system to run level S (Single-User level):
1. reboot the system
2. type e at the GRUB menu prompt.
3. from the command list select the "kernel /platform/i86pc/multiboot" boot entry and type e to edit the entry.
4. add a space and -s option at the end of the "kernel /platform/i86pc/multiboot -s" to boot at run level S.
5. Press enter to return the control to the GRUB Main Menu.
6. Type b to boot the system to single user level.
7. Verify the system is running at run level S:
#who -r
8. Bring the system back to muliuser state by using the Ctrl+D key combination.


Booting a system interactively:
1. reboot the system
2. type e at the GRUB menu prompt.
3. from the command list select the "kernel /platform/i86pc/multiboot" boot entry and type e to edit the entry.
4. add a space and -a option at the end of the "kernel /platform/i86pc/multiboot -a" .
5. Press enter to return the control to the GRUB Main Menu.
6. Type b to boot the system interactively.

Stopping an X86 system:
1. init 0
2. init 6
3. Use reset button or power button.

Booting the failsafe archive for recovery purpose:
1. reboot the system.
2. Press space bar while while GRUB menu is displayed.
3. Select Solaris failsafe entry and press b.
4. Type y to automatically update an out-of-date boot archive.
5. Select the OS instance on which the read write mount can happen.
6. Type y to mount the selected OS instance on /a.
7. Update the primary archive using following command:
#bootadm update-archive -f -R /a
8. Change directory to root(/): #cd /
9. Reboot the system.

Interrupting an unresponsive system
1. Kill the offending process.
2. Try rebooting system gracefully.
3. Reboot the system by holding down the ctrl+alt+del key sequence on the keyboard.
4. Press the reset button.
5. Power off the system & then power it back on.

No comments:

Post a Comment