Access and Use the GRUB Mode

The GNU GRand Unified Boot loader (GRUB) is a program which enables you to select the installed operating system or kernel to load at system boot time. The GRUB mode in Cisco Catalyst 8000V supports a subset of configuration register options, similar to the ROM Monitor (ROMMON) options on other Cisco routers. These configuration register options allow you to:

  • Force the router to boot into GRUB mode (bootstrap program)

  • Select a boot source and the default boot filename

  • Recover a lost password

Configuration register in Cisco Catalyst 8000V

Cisco Catalyst 8000V has a 16-bit configuration register in NVRAM. Each bit can be set to a value of 1 (on or set) or 0 (off or clear). The setting configured for each bit determines the router's behavior at the next power cycle.

This table describes the configuration register bits.

Table 1. Configuration Register Bit Descriptions

Bit number

Hexadecimal

Description

00–03

0x0000–0x000F

Boot field. The boot field setting determines whether the router loads an operating system and where it obtains the system image.

06

0x0040

Causes the system software to ignore the contents of NVRAM. This setting is useful for password recovery.

GRUB mode usage guidelines

Entering the GRUB mode for Cisco Catalyst 8000V running on cloud solutions depends on the console access capabilities of the cloud provider. If the cloud provider offers limited access to the console, you cannot access the GRUB mode for password recovery.

To configure the router to automatically enter GRUB mode upon reboot, use the 0x000 setting.

Access the GRUB mode

Perform this task to access the GRUB mode.

Procedure


Step 1

enable

Example:

Router> enable

Enables the privileged EXEC mode. Enter your password, if prompted.

Step 2

config-register 0x0000

Access the GRUB mode by setting the configuration register to "0000" (0x0).

Example:

Router# config-register 0x0000

This a sample configuration to access the GRUB mode.

Router(config)# config-register 0x0000
GNU GRUB  version 2.02
Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists possible
device or file completions. ESC at any time exits.
grub> confreg 0x2102

If you enter a question mark at the grub> prompt, the system displays the two options available; for viewing the system help or for entering the config register command.

Access the GRUB menu

The GRUB menu displays the software images loaded on the router. Use the GRUB menu to select which image to boot from.

Procedure


Step 1

To access the GRUB menu, enter ESC at the GRUB prompt.

The system displays the GRUB menu with all the images that are loaded on the router.

Step 2

Select the image to boot the router by using the up and down arrow keys.

Step 3

To return to the GRUB prompt, enter the letter c .


Load a new system image from GRUB menu

Perform this task to load a new system image from the GRUB mode.

Procedure


Step 1

dirbootflash:

Displays a list of all the files and directories in bootflash memory.

Example:

Router# dir bootflash:
Directory of bootflash:/
3     -rw-  6458388   Dec 18 2020 00:00:58 c8000v.tmp 
1580  -rw-  6462268   Dec 18 2020 06:14:02 c8000v-ata
63930368 bytes total (51007488 bytes free)

Step 2

configureterminal

Enters the global configuration mode.

Example:

Router# configure terminal
Router(config)#

Step 3

bootsystem bootflash: system-image-filename .bin

Loads the new system image after the next system reload or power cycle.

Example:

Router(config)# boot system bootflash: c8000v-universalk9.17.04.01a.SPA.bin

Note

 
If the new system image is the first file or the only file displayed in the dirbootflash: command output, you do not need to perform this step.

Step 4

dowrite

or

dowritememory

Example:

Router(config)# do write memory

Note

 
Entering the dowrite or dowritememory command updates the list of images available on the bootflash disk.

Step 5

config-register0x0000

Enters the GRUB mode.

Example:

GNU GRUB  version 2.02
Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists possible
device or file completions. ESC at any time exits.
grub> confreg 0x2102

Example:

Note

 

If you set the config-register to 0x0000, you should reset it back to the default of 0x2102 for the system to autoboot. If the value is 0x0, the system stops in the GRUB mode.

Step 6

At the grub> prompt, enter ESC to access the GRUB menu.

The system displays the GRUB menu with the images that are available to boot.

Example:

Cisco IOS XE Software, Version 2020-09-17_09.24_kamitch
Cisco IOS Software [Bengaluru], Virtual XE Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Experimental Version 17.5.20200916:194029 [HEAD-/scratch/kamitch/git/polaris-work/boottime1 106]
Copyright (c) 1986-2020 by Cisco Systems, Inc.
Compiled Wed 16-Sep-20 15:45 by kamitch

Cisco IOS-XE software, Copyright (c) 2005-2020 by cisco Systems, Inc.
All rights reserved.  Certain components of Cisco IOS-XE software are
licensed under the GNU General Public License ("GPL") Version 2.0.  The
software code licensed under GPL Version 2.0 is free software that comes
with ABSOLUTELY NO WARRANTY.  You can redistribute and/or modify such
GPL code under the terms of GPL Version 2.0.  For more details, see the
documentation or "License Notice" file accompanying the IOS-XE software,
or the applicable URL provided on the flyer accompanying the IOS-XE
software.

ROM: IOS-XE ROMMON

Router uptime is 18 minutes
Uptime for this control processor is 21 minutes
System returned to ROM by reload
System image file is "bootflash:packages.conf"

Step 7

Select the image to boot the router by using the up and down arrow key. To return to the GRUB prompt, enter the letter c .

Step 8

Select the .bin file to upgrade the software image on the router to the new version.

Step 9

Press Enter to boot the selected image.

The upgrade process begins.


Modify the configuration register

This section describes how to modify the configuration register by using the confreg GRUB command. This command is similar to the confreg ROMMON command used on other Cisco hardware routers. Because the router does not include a ROMMON mode, tGRUB command mode provides the equivalent functionality.

You can also modify the configuration register setting from the Cisco IOS XE CLI by using the config-register command in global configuration mode.


Note


The modified configuration register value is automatically written into NVRAM. To apply the new value, reset or power-cycle the router.

Procedure


confreg [ value ]

Example:

grub> confreg 0x2102

Changes the configuration register settings while in GRUB command mode.

  • Optionally, enter the new hexadecimal value for the configuration register. Specify a value between 0x0 and 0xFFFF.

  • If you do not enter the value, the router prompts you for each bit of the 16-bit configuration register.


This sample configuration specifies entering the GRUB mode and using the configuration register. You access the GRUB mode by entering the Cisco IOS XE config-register command and specifying the value as “0000”.


        Router(config)# 
        config-register 0x0000
        GNU GRUB  version 0.97  (638K lower / 3143616K upper memory)
        [ Minimal BASH-like line editing is supported.  For the first word, TAB
        lists possible command completions.  Anywhere else TAB lists the possible
        completions of a device/filename.  ESC at any time exits to menu. ]
        grub> help
        [ Minimal BASH-like line editing is supported.  For the first word, TAB
        lists possible command completions.  Anywhere else TAB lists the possible
        completions of a device/filename.  ESC at any time exits to menu. ]
        confreg [VALUE]                        help [--all] [PATTERN ...]
        grub> 
        confreg
        Configuration Summary
        (Virtual Configuration Register: 0x0)
        enabled are:
        boot: the boot loader
        do you wish to change the configuration? y/n [
        n
        ]:
        ignore system config info? y/n [
        n
        ]:
        automatically boot default system image? y/n [
        n
        ]:
        Configuration Register: 0x0
        grub> confreg    
        Configuration Summary
        (Virtual Configuration Register: 0x0)
        enabled are:
        boot: the boot loader
        do you wish to change the configuration? y/n [
        n
        ]:
        ignore system config info? y/n [n]:
        automatically boot default system image? y/n [n]:
        Configuration Register: 0x42
        grub> confreg 0x2102
        Configuration Register: 0x2102
        grub> 
        confreg
        Configuration Summary
        (Virtual Configuration Register: 0x2102)
        enabled are:
        boot: default image
        do you wish to change the configuration? y/n [
        n
        ]:
        grub>   
        grub>
        GNU GRUB  version 2.02  (638K lower / 3143616K upper memory)
        -------------------------------------------------------------------
        0: C8000v - packages.conf
        1: C8000v - c800v-packages-universalk9
        2: C8000v - GOLDEN IMAGE
        -------------------------------------------------------------------
        Use the ^ and v keys to select which entry is highlighted.
        Press enter to boot the selected OS, or 'c' for a command-line.
        Highlighted entry is 0: 
        Booting 'C8000v - packages.conf'
        root (hd0,0)
        Filesystem type is ext2fs, partition type 0x83
        kernel /packages.conf rw root=/dev/ram console=ttyS1,9600 max_loop=64 HARDWARE=
        virtual SR_BOOT=harddisk:packages.conf
        Calculating SHA-1 hash...done
        SHA-1 hash:
        calculated   817e1716:e8e62778:7dd0b806:32db2bdd:13e51407
        expected     817e1716:e8e62778:7dd0b806:32db2bdd:13e51407
        package header rev 1 structure detected
        Calculating SHA-1 hash...done
        SHA-1 hash:
        calculated   d4eaba99:34cbda63:26151233:9d0e9aa4:9c625302
        expected     d4eaba99:34cbda63:26151233:9d0e9aa4:9c625302
        Package type:0x7531, flags:0x0
        [Linux-bzImage, setup=0x2e00, size=0x2c18c00]
        [isord @ 0x7e6d0000, 0x191f000 bytes]
      

Modify the configuration register settings

You can change the configuration register settings using either the GRUB or the Cisco IOS XE CLI. This section explains how to modify these settings using the Cisco IOS XE CLI.

Procedure


Step 1

Power on the router.

Step 2

If you are asked whether you would like to enter the initial dialog, answer no.

Example:

Would you like to enter the initial dialog? [yes/no]: no

After a few seconds, the system displays the user EXEC prompt (Router>).

Step 3

enable

Enters the privileged EXEC mode. Enter your password, if prompted.

Example:

Router> enable
Password:password
Router#

Step 4

configure terminal

Enters the global configuration mode.

Example:

Router# configure terminal
Enter configuration commands, one per line.
Edit with DELETE, CTRL/W, and CTRL/U; end with CTRL/Z

Step 5

config-register value command, where value is a hexadecimal number preceded by 0x :

Changes the configuration register settings.

Example:

Router(config)# config-register 0x value

Step 6

end

Exits the global configuration mode.

Step 7

copyrunning-configstartup-config

Saves the configuration changes to NVRAM.

The new configuration register settings are saved to NVRAM, but they do not take effect until the next router reload or power cycle.


Verify the configuration register settings

Perform this task to display the configuration register settings that are currently in effect and the settings that will be used at the next router reload.

Procedure


Run the show version command in privileged EXEC mode.

This command displays the configuration register settings that are currently in effect.

Example:


Configuration register is 0x142 (will be 0x142 at next reload)

The configuration register settings are displayed in the last line of the command output.