IBM Cloud: BIOS/UEFIの確認とプロファイル変換時の挙動

# 1. はじめに

IBM Cloud VPC では、

- 2nd Generation profile(bx2-xxxのように2が入っているプロファイル: Cascade Lakeベース)はBIOSで起動
- 3rd Generation profile(bx3-xxxのように3が入っているプロファイル: Sapphire Rapidsベース）はUEFIで起動

では、2nd Generationで作成したプロファイルを3rd Generationプロファイルにresizeした際には、どうなるのか？
結論としては、やはりresize後も、各世代のプロファイルに合わせてBIOS/UEFIの変換がされているようである（つまり、3rd Generation profileに変換したのであれば、BIOSのままプロファイル変換されるのではなくUEFIを利用するように変換される。）

# 2. 2nd Generation Profileで注文したVSIを3rd Generation Profileに変換した場合

## 2-1. 2nd Generation Profileでの環境確認

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/62127/855399b3-f4e3-4368-f8a9-1191589fb9e5.png)

```
[root@test-syasuda1 ~]# cat /etc/redhat-release
CentOS Stream release 9

[root@test-syasuda1 ~]# uname -a
Linux test-syasuda1 5.14.0-474.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 2 17:13:22 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

[root@test-syasuda1 ~]# dnf install -y efibootmgr

[root@test-syasuda1 ~]# [[ -d /sys/firmware/efi ]] && echo UEFI || echo BIOS
BIOS

[root@test-syasuda1 ~]# efibootmgr
EFI variables are not supported on this system.

[root@test-syasuda1 ~]# dmesg |grep -i efi
[    0.054730] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1910969940391419 ns
[    5.050963] systemd[1]: TPM2 PCR Machine ID Measurement was skipped because of an unmet condition check (ConditionPathExists=/sys/firmware/efi/efivars/StubPcrKernelImage-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f).
```

## 2-2. 2nd Generation Profile -> 3rd Generation Profileへの変換

VSIを停止して、resizeする。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/62127/f1fcd3f6-3ed6-b43c-c254-036b80e37b1b.png)


## 2-3. 変換後の環境確認

```
[root@test-syasuda1 ~]# [[ -d /sys/firmware/efi ]] && echo UEFI || echo BIOS
UEFI

[root@test-syasuda1 ~]# efibootmgr
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0003,0001,0000,0002
Boot0000* UiApp
Boot0001* UEFI Misc Device
Boot0002* EFI Internal Shell
Boot0003* CentOS Linux

[root@test-syasuda1 ~]# dmesg |grep -i efi
[    0.000000] efi: EFI v2.7 by Ubuntu distribution of EDK II
[    0.000000] efi: SMBIOS=0xbf920000 ACPI=0xbfb7d000 ACPI 2.0=0xbfb7d014 MEMATTR=0xbe1ba518 MOKvar=0xbf91a000 RNG=0xbfb70018
[    0.000000] efi: Remove mem142: MMIO range=[0xffc00000-0xffffffff] (4MB) from e820 map
[    0.050050] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1910969940391419 ns
[    0.421879] pci 0000:00:02.0: BAR 0: assigned to efifb
[    0.490900] Registered efivars operations
[    0.917874] efifb: probing for efifb
[    0.918411] efifb: framebuffer at 0xc0000000, using 1876k, total 1875k
[    0.918417] efifb: mode is 800x600x32, linelength=3200, pages=1
[    0.918421] efifb: scrolling: redraw
[    0.918424] efifb: Truecolor: size=8:8:8:8, shift=24:16:8:0
[    0.924462] fb0: EFI VGA frame buffer device
[    0.925081] EFI Variables Facility v0.08 2004-May-17
[    1.225722] integrity: Loading X.509 certificate: UEFI:MokListRT (MOKvar table)
[    4.203397] systemd[1]: TPM2 PCR Machine ID Measurement was skipped because of an unmet condition check (ConditionPathExists=/sys/firmware/efi/efivars/StubPcrKernelImage-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f).
```

# 3. 3rd Generation Profileで注文したVSIを2nd Generation Profileに変換した場合

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/62127/58b7fea6-1212-dc10-5b32-2adedcecbc0b.png)


## 3-1. 3rd Generation Profileでの環境確認

```
[root@test-syasuda2 ~]# cat /etc/redhat-release
CentOS Stream release 9

[root@test-syasuda2 ~]# uname -a
Linux test-syasuda2 5.14.0-474.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 2 17:13:22 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

[root@test-syasuda2 ~]# dnf install -y efibootmgr
[root@test-syasuda2 ~]# [[ -d /sys/firmware/efi ]] && echo UEFI || echo BIOS
UEFI

[root@test-syasuda2 ~]# efibootmgr
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0003,0001,0000,0002
Boot0000* UiApp
Boot0001* UEFI Misc Device
Boot0002* EFI Internal Shell
Boot0003* CentOS Linux

[root@test-syasuda2 ~]# dmesg |grep -i efi
[    0.000000] efi: EFI v2.7 by Ubuntu distribution of EDK II
[    0.000000] efi: SMBIOS=0xbf920000 ACPI=0xbfb7d000 ACPI 2.0=0xbfb7d014 MEMATTR=0xbe1ba518 MOKvar=0xbf91a000 RNG=0xbfb70018
[    0.000000] efi: Remove mem142: MMIO range=[0xffc00000-0xffffffff] (4MB) from e820 map
[    0.047643] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1910969940391419 ns
[    0.413272] pci 0000:00:02.0: BAR 0: assigned to efifb
[    0.481130] Registered efivars operations
[    0.861360] efifb: probing for efifb
[    0.861372] efifb: framebuffer at 0xc0000000, using 1876k, total 1875k
[    0.861375] efifb: mode is 800x600x32, linelength=3200, pages=1
[    0.861378] efifb: scrolling: redraw
[    0.861380] efifb: Truecolor: size=8:8:8:8, shift=24:16:8:0
[    0.864999] fb0: EFI VGA frame buffer device
[    0.865018] EFI Variables Facility v0.08 2004-May-17
[    1.216516] integrity: Loading X.509 certificate: UEFI:MokListRT (MOKvar table)
[    4.207556] systemd[1]: TPM2 PCR Machine ID Measurement was skipped because of an unmet condition check (ConditionPathExists=/sys/firmware/efi/efivars/StubPcrKernelImage-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f).
```

## 3-2. 3rd Generation Profile -> 2nd Generation Profileへの変換

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/62127/6335c261-624e-b171-d8b5-548ae6ce064f.png)

## 3-3. 変換後の環境確認

```
[root@test-syasuda2 ~]# [[ -d /sys/firmware/efi ]] && echo UEFI || echo BIOS
BIOS

[root@test-syasuda2 ~]# efibootmgr
EFI variables are not supported on this system.

[root@test-syasuda2 ~]# dmesg |grep -i efi
[    0.051862] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1910969940391419 ns
[    4.618009] systemd[1]: TPM2 PCR Machine ID Measurement was skipped because of an unmet condition check (ConditionPathExists=/sys/firmware/efi/efivars/StubPcrKernelImage-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f).

```