Accessing and Using GRUB Mode

About GRUB Mode and the Configuration Register

The Cisco CSR 1000V/ISRv has a 16-bit configuration register in NVRAM. Each bit has value 1 (on or set) or value 0 (off or clear), and each bit setting affects the router behavior upon the next reload power cycle. The GRUB mode supports a subset of configuration register options compared to ROMMON options on other Cisco routers.

You can use the configuration register to:

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

  • Select a boot source and default boot filename

  • Recover a lost password

The table below describes the configuration register bits.

Table 1. Configuration Register Bit Descriptions

BitNumber

Hexadecimal

Meaning

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.

See the table "Boot Field Configuration Register Bit Descriptions" for details.

06

0x0040

Causes the system software to ignore the contents of NVRAM. This can be used for password recovery.


Note


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


The next table describes the boot field, which is the lowest four bits of the configuration register (bits 3, 2, 1, and 0). The boot field setting determines whether the router loads an operating system.

Table 2. Boot Field Configuration Register Bit Descriptions

Boot Field(Bits 3, 2, 1, and 0)

Meaning

0000

(0x0)

At the next power cycle or reload, the router boots to the GRUB (bootstrap program).

In GRUB mode, you must manually boot the system image or any other image by using the boot command.

0001 - 1111

(0x01 - 0x0F)

At the next power cycle or reload, the router sequentially processes each boot system command in global configuration mode that is stored in the configuration file until the system boots successfully.

If the no boot system commands are stored in the configuration file, or if these commands are not executed successfully, GRUB dictates the image that needs to be booted.


Note


Use the 0x000 setting to configure the router to automatically enter GRUB mode when the router reboots.

Accessing GRUB Mode

Perform the following step to access GRUB mode:

SUMMARY STEPS

  1. enable
  2. config-register 0x0000

DETAILED STEPS

  Command or Action Purpose

Step 1

enable

Example:


Router> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2

config-register 0x0000

Example:


Router# config-register 0x0000

Enters the GRUB mode by entering the “0000” value (0x0).

What to do next

The following shows an example of entering GRUB mode.


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>

If you enter a question mark at the grub> prompt, the system shows you the two options available, for either viewing the system help or for entering the confreg command.

Using the GRUB Menu

The GRUB menu is used to display the software images loaded on the router, and to select which image to boot from. To access the GRUB menu, enter ESC at the GRUB prompt. The following shows the GRUB menu display.


GNU GRUB  version 0.97  (638K lower / 3143616K upper memory)
 +-------------------------------------------------------------------------+
 | CSR1000v - csr1000v-universalk9.03.10.00.S.153-3.S-ext.SPA.bin          |
 | CSR1000v - packages.conf                                                |
 | CSR1000v - 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.

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

Modifying the Configuration Register (confreg)

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

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, but the new value does not take effect until you reset or power-cycle the router.

SUMMARY STEPS

  1. confreg [value ]

DETAILED STEPS

Command or Action Purpose

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. The value range is from 0x0 to 0xFFFF.

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

What to do next

The following shows an example of entering 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 0.97  (638K lower / 3143616K upper memory)
-------------------------------------------------------------------
 0: CSR1000v - packages.conf
 1: CSR1000v - csr100v-packages-universalk9
 2: CSR1000v - 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 'CSR1000v - 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]

Changing the Configuration Register Settings

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

To change the configuration register settings from the Cisco IOS XE CLI, complete the following steps:

SUMMARY STEPS

  1. Power on the router.
  2. If you are asked whether you would like to enter the initial dialog, answer no:
  3. Enter privileged EXEC mode by typing enable and, if prompted, enter your password:
  4. Enter global configuration mode:
  5. To change the configuration register settings, enter the config-register value command, where value is a hexadecimal number preceded by 0x :
  6. Exit global configuration mode:
  7. Save the configuration changes to NVRAM:

DETAILED STEPS


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

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

Step 3

Enter privileged EXEC mode by typing enable and, if prompted, enter your password:

Example:


Router> enable
Password: password
Router#

Step 4

Enter 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

To change the configuration register settings, enter the config-register value command, where value is a hexadecimal number preceded by 0x :

Example:


Router(config)# config-register 0x
value

Step 6

Exit global configuration mode:

Example:


Router(config)# end
Router#

Step 7

Save the configuration changes to NVRAM:

Router# copy running-config startup-config

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


Displaying the Configuration Register Settings

To display the configuration register settings that are currently in effect and the settings that will be used at the next router reload, enter the show version command in privileged EXEC mode.

The configuration register settings are displayed in the last line of the show version command output:


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