Booting and Shutting Down Oracle® Solaris 11.2 Systems

Exit Print View

Updated: July 2014
 
 

x86: How to Maintain the GRUB Menu

Use the set-menu subcommand of the bootadm command to maintain the GRUB menu. For example, you can use the command to change the menu timeout and the default boot entry in the GRUB menu.

  1. Assume the root role.

    See Using Your Assigned Administrative Rights in Securing Users and Processes in Oracle Solaris 11.2 .

  2. (Optional)List the GRUB menu entries.
    # bootadm list-menu
  3. Make the necessary changes to the GRUB menu.
    # bootadm set-menu [-P pool] [-R altroot [-p platform]] key=value

    For more information about each value that can you can specify by using the set-menu subcommand, see the bootadm(1M) man page. Examples of common ways that you can use the set-menu subcommand follow this procedure.

  4. Verify that the changes have been made.
    # bootadm list-menu

    Note - If you do not see your changes, check the grub.cfg file to verify that the change was made.
Example 2-1  Changing the Default Boot Entry in the GRUB Menu

Use the bootadm set-menu command with the appropriate key=value option to set the default entry number (for example, 0, 1, or 2) in the GRUB menu. This number designates which operating system is booted when the timer expires.

For example, the output of the following bootadm list-menu command shows the default boot entry as 2, which is Oracle Solaris 11_test:

# bootadm list-menu
The location of the boot loader configuration file is /rpool/boot/grub
default 2
console graphics
timeout 30
0 Oracle Solaris 11/11
1 Oracle Solaris 11.2
2 Oracle Solaris 11_test

In this example, the console is set to graphics mode. Other modes that you can set the console to include text and serial.

You can set the default boot entry to 1, as follows:

# bootadm set-menu default=1
# bootadm list-menu
The location of the boot loader configuration file is /rpool/boot/grub
default 1
console graphics
timeout 30
0 Oracle Solaris 11/11
1 Oracle Solaris 11.2
2 GRUB2

In this example, the default menu entry is now 1. When the system is rebooted, it will automatically boot the new Oracle Solaris entry after the default timer expires.

You can also set the default entry in the GRUB menu by using the change-entry subcommand. See How to Set Attributes for a Specified Boot Entry in the GRUB Menu.

Example 2-2  Changing the Menu Timeout Value in the GRUB Menu

Use the bootadm set-menu command with the appropriate key=value option to set the menu timeout value.

In the following example, the output of the bootadm list-menu command shows a default timeout value of 30 seconds that has been changed to 45 seconds. The change takes effect the next time the system is booted.

# bootadm list-menu
The location of the boot loader configuration file is /rpool/boot/grub
default 2
console graphics
timeout 30
0 Oracle Solaris 11/11
1 Oracle Solaris 11.2
2 Oracle Solaris 11_test
# bootadm set-menu timeout=45
# bootadm list-menu
The location of the boot loader configuration file is /rpool/boot/grub
default 2
console graphics
timeout 45
0 Oracle Solaris 11/11
1 Oracle Solaris 11.2
2 Oracle Solaris 11_test
Example 2-3  Setting the GRUB Console Type

One value that you can set by using the set-menu subcommand of the bootadm command is the console type. Changing the console type in this way persists over system reboots.

For example, you would set the console type to serial in the grub.cfg file, as follows:

# bootadm set-menu console=serial

You can also set the console type to text for plain text console. Choose this option if you are using BIOS serial redirection. Or, you can set the console type to graphics. This option provides a more graphical menu, and a background image is used.

When you set the console type to serial, you can configure the serial parameters that GRUB 2 uses when initializing the serial port at boot time. If you do not specify a serial_params value, the default is to use serial port 0 (COM1/ttya) and to not specify a speed. Note that if a speed is not specified and only a port is specified, for example, serial_params=0, then the speed that is used is undefined and will be whatever speed the serial port was initialized to before GRUB executes. If you to ensure a specific speed is used, they need to explicitly set it with serial_params.

Add the serial_params key value to the bootadm command line, as follows:

# bootadm set-menu console=serial serial_params=port[,speed[,data bits[,parity[,stop bits]]]]
port

Is the port number. Any number from 0 to 3 (usually 0 is used for ttya or COM1) can be used to specify ports ttya through ttyd, or COM1 through COM4, respectively.

speed

Is the speed that the serial port uses. If this value is omitted, GRUB 2 uses whatever speed the serial port has been initialized to use. If the serial port has not been initialized, failure to specify the speed might cause unpredictable output. If you are not sure if the serial port has been initialized, and you are not using BIOS console redirection, it is best to specify a speed value.

data bits

Is specified with a value of either 7 or 8.

parity

Is specified as e, o, n (for even, odd, or none), respectively.

stop bits

Is specified with a value of 0 or 1.

All of the serial parameters, with the exception of the port parameter, are optional.