CML2のNX-OS 9000がBoot Loaderに落ちた場合の対処

# はじめに
CiscoエミュレータのCML2。CML2上で作成したLABの中を開始後、NX-OS 9000がBoot Loaderで正常に起動しない事象が起きました。
復旧方法を書きます。

<details><summary>Boot Loader時のログ</summary><div>

```
BdsDxe: loading Boot0002 "UEFI QEMU HARDDISK QM00005 " from PciRoot(0x0)/Pci(0xE,0x0)/Sata(0x0,0xFFFF,0x0)
BdsDxe: starting Boot0002 "UEFI QEMU HARDDISK QM00005 " from PciRoot(0x0)/Pci(0xE,0x0)/Sata(0x0,0xFFFF,0x0)
Sysconf checksum failed. Using default values
WARNING:  No BIOS Info found 
Sysconf checksum failed. Using default values
Sysconf checksum failed. Using default values
Sysconf checksum failed. Using default values
ATE0Q1&D2&C1S0=1
Standalone chassis 
check_bootmode: grub2pxe: grub failed, launch ipxe
Trying to load ipxe 
Loading Application: 
/Vendor(429bdb26-48a6-47bd-664c-801204061400)/UnknownMedia(6)/EndEntire
cannot load imageFailed to launch ipxe 
Came back to grub, now load efi shell
Trying to load efishell 
Loading Application: 
/Vendor(429bdb26-48a6-47bd-664c-801204061400)/UnknownMedia(6)/EndEntire
cannot load imageFailed to launch shell
Trying to read config file /boot/grub/menu.lst.local from (hd0,4) 
 Filesystem type is ext2fs, partition type 0x83
Trying to read config file /boot/grub/menu.lst.local from (hd0,5) 
 Filesystem type is ext2fs, partition type 0x83
No autoboot or failed autoboot. falling to loader 



                Loader Version 5.9

loader >      
```

</div></details>

# 復旧手順概要
起動するイメージファイルが認識できていることが前提なので、特に特別なことはありません。

1. Boot Loaderにて認識しているイメージをブート
1. 起動後、boot設定追加
1. 設定保存

# 復旧手順
## 1. Boot Loaderにて認識しているイメージをブート
### 認識しているファイルの確認
Boot Loaderでの操作になります。コマンド間違えてもバックスペースなどが使用できないため
あらかじめあらかじめ
dirコマンドにて確認します。
'bootflash::'とコロンが2つ続いてますが、気にしません。

```
loader > dir                                                                   

bootflash::  

  .rpmstore
  nxos.9.2.4.bin   # これがイメージファイルです。
  .swtam
  virtual-instance
  virtual-instance.conf
  virt_strg_pool_bf_vdc_1
  scripts
  platform-sdk.cmd
```


### イメージファイルをブート
bootコマンドにてイメージファイルを指定して起動します。
ファイルパスは2つ目のコロンを'/'に変えてください。(変えないと怒られます。)

- 実行コマンド

```
loader > boot bootflash:/イメージファイル
```

<details><summary>ファイルパス誤り時ログ</summary><div>

```
loader > boot bootflash::nxos.9.2.4.bin                                        
Booting bootflash::nxos.9.2.4.bin 
Trying diskboot 
Boot failed 

Error 9: Unknown boot failure
```
</details></div>


<details><summary>実行ログ例</summary><div>

```
loader > boot bootflash:/nxos.9.2.4.bin 
Booting bootflash:/nxos.9.2.4.bin 
Trying diskboot 
 Filesystem type is ext2fs, partition type 0x83

Image valid


Image Signature Verification Failed.

Boot Time: 5/18/2021  15:4:45
Installing klm_card_index
done
Linking n9k flash devices
creating flash devices BOOT_DEV= sda
INIT: version 2.88 booting
Installing ata_piix module ... done.
Unsquashing rootfs ...
Total size needed in bootflash is 149520
check bootflash : OK
Total size needed in bootflash is 35832
check bootflash : OK
Enabling 8250 serial driver spurious INTs workaround
Installing isan procfs ... done.
is_lxc: is_stby: suffix:
Installing ftrace in non-lxc mode done
Installing SSE module ... done.
Creating SSE device node 247 ... done.
Loading I2C driver ... done.
Loading MEM scrub driver ... done.
Installing CCTRL driver for card_type 29 on a VM without NEED_GEM ... done.
29.43: Interrupt throttling disabled. No cctrl irq detected.
Loading IGB driver ... done.
Cannot change large-receive-offload
Not Micron SSD...

Checking all filesystems.
Installing SPROM driver ... IS_N9K done.
Installing pfmsvcs module ...done.
Installing nvram module ... done.
Installing if_index module with port mode 6 ... done.
Installing fcfwd
Installing RNI lcnd ... done
Installing LC netdev ... done
Installing psdev module ... done.
Installing veobc module ... done.
Inserting eMMC module ... 
Inserting mtdphysmap module...[   37.266087] Error: Could not find mtd devices 
Inserting OBFL module ... done.
Making OBFL character devices
mounting plog for N9k!
Inserting kernel_services module ... done.
Making kernel_services character devices
cgroups initialized
Trying to mount cdrom...

Mounted /dev/scd0 on /mnt/cdrom
Detected dynamic environment properties (bootstrap CLI) on nxos_config.txt
File nxos_config.txt unchanged since last boot; will not re-apply configuration

invalid group file entry
delete line 'aaa-db-operator:508:'? No
grpck: no changes
exit code: 1
Starting OpenBSD Secure Shell server: sshd ... done.
mkdir: cannot create directory '/lc': File exists
tune2fs 1.42.9 (28-Dec-2013)
Setting reserved blocks percentage to 0% (0 blocks)
Starting portmap daemon...
creating NFS state directory: done
starting 8 nfsd kernel threads: done
starting mountd: done
starting statd: done
Saving image for img-sync ...
Loading system software
Installing local RPMS
Patch Repository Setup completed successfully
Creating /dev/mcelog
Starting mcelog daemon
mcelog: Family 6 Model 3f CPU: only decoding architectural errors
Overwriting dme stub lib
INIT: Entering runlevel: 3
Running S93thirdparty-script...

Populating conf files for hybrid sysmgr ...
Starting hybrid sysmgr ...
done
Netbroker support IS present in the kernel.
done
Executing Prune clis.
System is coming up ... Please wait ...
.

User Access Verification
dist-sw01 login: 
```

</details></div>


## 2. 起動後、boot設定追加
### boot設定確認
正常に起動したら、bootの設定を確認してみます。

```
dist-sw01# show boot
Current Boot Variables:
sup-1
NXOS variable not set
Boot POAP Disabled

Boot Variables on next reload:
sup-1
NXOS variable not set
Boot POAP Disabled
dist-sw01# 
dist-sw01# show run | i boot
dist-sw01# 
dist-sw01# dir bootflash:
       4096    May 18 01:37:36 2021  .rpmstore/
       4096    May 18 01:38:01 2021  .swtam/
 1339749888    Aug 20 16:21:45 2019  nxos.9.2.4.bin
          0    May 18 06:00:48 2021  platform-sdk.cmd
       4096    May 18 01:39:00 2021  scripts/
       4096    May 18 01:39:45 2021  virt_strg_pool_bf_vdc_1/
       4096    May 18 01:38:27 2021  virtual-instance/
         59    May 18 01:38:18 2021  virtual-instance.conf

Usage for bootflash://sup-local
 1519140864 bytes used
 1950969856 bytes free
 3470110720 bytes total
```
boot設定がないので、設定を追加します。

### boot設定追加
イメージファイルはboot時に指定したファイルと同一です。

設定コマンド

```
boot nxos bootflash:/イメージファイル
```


設定ログ

```
dist-sw01# conf t
Enter configuration commands, one per line. End with CNTL/Z.
dist-sw01(config)# boot nxos bootflash:/nxos.9.2.4.bin
Performing image verification and compatibility check, please wait....
dist-sw01(config)# 
dist-sw01(config)# 
dist-sw01(config)# end
dist-sw01# 
```


### 設定の確認
設定後、指定したイメージがbootに指定できているかの確認。

```
dist-sw01# show boot
Current Boot Variables:
sup-1
NXOS variable = bootflash:/nxos.9.2.4.bin
Boot POAP Disabled

Boot Variables on next reload:
sup-1
NXOS variable not set
Boot POAP Disabled
dist-sw01# 
dist-sw01# show run | i boot
boot nxos bootflash:/nxos.9.2.4.bin 
dist-sw01# 
```

## 3. 設定保存
最後に設定を保存して、次回のLAB使用時に正常に起動するようにして終了です。

```
dist-sw01# show start | i boot
dist-sw01# 
dist-sw01# 
dist-sw01# copy run startup-config 
[########################################] 100%
Copy complete, now saving to disk (please wait)...
Copy complete.
dist-sw01# 
dist-sw01# 
dist-sw01# show boot
Current Boot Variables:
sup-1
NXOS variable = bootflash:/nxos.9.2.4.bin
Boot POAP Disabled

Boot Variables on next reload:
sup-1
NXOS variable = bootflash:/nxos.9.2.4.bin
Boot POAP Disabled
dist-sw01# 
dist-sw01# show start | i boot
boot nxos bootflash:/nxos.9.2.4.bin 
dist-sw01# 

```



以上