15.7.15. 使用 bootupd 更新引导装载程序

要使用 bootupd 更新引导装载程序,您必须手动在 RHCOS 机器上安装 bootupd,或使用启用的 systemd 单元提供机器配置。与 grubby 或其他引导装载程序工具不同,bootupd 不管理内核空间配置,如传递内核参数。

安装 bootupd 后,您可以从 OpenShift Container Platform 集群远程管理它。

注意

建议您仅在裸机或虚拟化管理程序安装中使用 bootupd,如防止 BootHole 漏洞。

手动安装方法

您可以使用 bootctl 命令行工具手动安装 bootupd

  1. 检查系统状态:

    # bootupctl status

    输出示例

    Component EFI
      Installed: grub2-efi-x64-1:2.04-31.fc33.x86_64,shim-x64-15-8.x86_64
      Update: At latest version

  1. 如果创建的 RHCOS 镜像没有在其中安装 bootupd,则需要一个明确的采用步骤。

    如果系统状态是 Adoptable,执行采用过程:

    # bootupctl adopt-and-update

    输出示例

    Updated: grub2-efi-x64-1:2.04-31.fc33.x86_64,shim-x64-15-8.x86_64

  2. 如果有可用更新,请应用更新以便在下次重启时使更改生效:

    # bootupctl update

    输出示例

    Updated: grub2-efi-x64-1:2.04-31.fc33.x86_64,shim-x64-15-8.x86_64

机器配置方法

启用 bootupd 的另一个方法是提供机器配置。

  • 使用启用的 systemd 单元提供一个机器配置文件,如下例所示:

    输出示例

      variant: rhcos
      version: 1.1.0
      systemd:
        units:
          - name: custom-bootupd-auto.service
            enabled: true
            contents: |
              [Unit]
              Description=Bootupd automatic update
    
              [Service]
              ExecStart=/usr/bin/bootupctl update
              RemainAfterExit=yes
    
              [Install]
              WantedBy=multi-user.target