PXE 启动设置#

DGX 服务器 UEFI BIOS 支持 PXE 启动。需要进行几个手动自定义步骤才能使 PXE 启动基础操作系统镜像。

注意

本文档旨在用作参考。未提供配置 DHCP、FTP 和 TFTP 服务器的明确说明。预计最终用户的 IT 团队将对其进行配置,以符合其公司的安全准则。

先决条件

  • 已设置 TFTP 和 FTP 服务器

    • IP 地址为 <FTP IP>

    • 完全限定主机名为 <FTP host>

本文档旨在提供关于如何为 DGX 系统设置 PXE 启动环境的详细分步说明。这些示例基于 DGX A100。该解决方案有几个主要组成部分

  • DHCP 服务器:dnsmasq (https://thekelleys.org.uk/dnsmasq/doc.html) 在本文档中使用。

  • TFTP 服务器:dnsmasq 也用作 TFTP 服务器。

  • HTTP 服务器:HTTP 服务器用于传输大型文件,例如 ISO 镜像和 initrd。或者,FTP 也可用于此目的。本文档中使用 HTTP。

  • Syslinux:Linux 启动加载程序软件包。 部分

PXE 服务器概述#

PXE 服务器分为以下几个区域

  • 启动加载程序 (syslinux)

  • FTP 内容(即 ISO 镜像及其解压内容)

请注意,将基础操作系统 5.x 内容与以前的版本进行比较时,ISO 中的文件相对较少。FTP 服务器上的大致目录结构如下所示(其中 5.x.y 是您正在安装的版本)

/local/ftp
└── dgxbaseos-5.x.y
    ├── base_os_5.x.y.iso
    ├── boot/
    │   └── grub
    │       └── bios.img
    │       └── boot.catdefault
    │       └── grub.cfg
    └── EFI
    │   └── efiboot.imgg
    ├── initrd
    ├── live/
    │       └── filesystem.squashfs
    ├── md5sum.txt
    ├── UBUNTU_LIVE
    ├── vmlinuz
/local/syslinux
└── efi64
    ├── syslinux.efi
    ├── ldlinux.e64
    ├── pxelinux.cfg
    │   └── default
    ├── sdgx-5.x.y/
    │   └── vmlinuz
    │   └── initrd

tftp-server(由 xinetd 服务控制,配置位于 /etc/xinetd.d/tftp 中)指向 syslinux 目录,以便系统进行 PXE 启动。TFTP 用于传输 DHCP 服务器的 dhcpd.conf 文件中指定的 syslinux.efi 文件(请参阅配置您的 DHCP 服务器)。默认情况下,在 syslinux.efi 启动后,它会查找 pxelinux.cfg/default 文件,其中包含进一步启动的菜单选项,即 sdgx/ 目录中的内核和 initrd。该配置文件将在与其 pxelinux.cfg 目录相同的工作目录中查找其文件。在本例中,它是 /local/syslinux/efi64。

以下步骤将假定 DHCP 和 PXE 服务器配置为使用上述目录结构。实验室管理员或负责部署 PXE 环境的任何人都应更改目录名称和结构以适应其基础设施。

设置 dnsmasq 以进行 DHCP#

DGX 系统 BIOS 不允许您手动指定 PXE 服务器。您需要使用 DHCP 服务器来确定它是什么以及从哪个文件启动。

  1. 安装 dnsmasq。

    apt install dnsmasq
    
  2. 在自定义配置文件之前备份该文件。

    mv /etc/dnsmasq.conf /etc/dnsmasq.conf.backup
    
  3. 使用适合您系统的值编辑配置文件。

    vi /etc/dnsmasq.conf
    
    interface=enp226s0
    bind-interfaces
    domain=nvidia.com
    dhcp-range=enp226s0,10.33.254.106,static,1h
    dhcp-host=5c:ff:35:e1:a4:d1,DGX-A100-PM2,10.33.254.106
    dhcp-option=option:router,10.33.254.1
    dhcp-option=option:dns-server,8.8.8.8
    enable-tftp
    tftp-root=/local/syslinux/efi64/
     dhcp-boot=syslinux.efi
    
  4. 创建并设置 local/syslinux/efi64/ 文件夹。

    sudo mkdir -p /local/syslinux/efi64
    
    systemctl restart dnsmasq
    
    systemctl status dnsmasq
    

配置 FTP 端#

挂载 ISO

假设您有一个 5.x.y ISO 副本位于“/tmp/base_os_5.x.y.iso”,并且您的挂载点是“/mnt”

sudo mount -o loop /tmp/base_os_5.x.y.iso /mnt

将 ISO 及其解压内容复制到 FTP 目录

使用概述中的示例目录结构,FTP 根目录是“/local/ftp/”,并且在其下有一个“dgxbaseos-5.x.y/”目录。

cp -r /mnt/* /local/ftp/dgxbaseos-5.x.y/
cp /tmp/base_os_5.x.y.iso /local/ftp/dgxbaseos-5.x.y/

确保所有文件都归“ftp”用户所有,或者至少可由其读取。现在可以安全地卸载 ISO(如果需要)。

sudo umount /mnt

配置 HTTP 文件目录和 ISO 镜像#

以下是配置 PXE 启动的 http 文件目录和 ISO 镜像的步骤。

这些说明在 PXE 服务器上生成以下文件结构。

/local/http
└── dgxbaseos-5.x.y
    ├── base_os_5.x.y.iso
    ├── initrd
    └── vmlinuz

您应该已获取 ISO 镜像并将其复制到“/tmp/dgxbaseos-5.x.y.iso”。

  1. 创建 DGX OS 目录。

    sudo mkdir -p /local/http/dgxbaseos-5.x.y
    
  2. 挂载 ISO。

    您的挂载点是 /mnt

    sudo mount -o loop /tmp/base_os_5.x.y.iso /mnt
    
  3. 将 ISO 及其解压内容复制到 HTTP 目录。

    sudo cp /mnt/{initrd,vmlinuz} /local/http/dgxbaseos-5.x.y/
    
    cp /tmp/dgxbaseos-5.0.2.iso /local/http/dgxbaseos-5.x.y/
    
  4. 确保所有文件都归 http 用户所有,或者至少可由其读取。

  5. 您现在可以卸载 ISO。

    sudo umount /mnt
    

配置您的 DHCP 服务器#

遗憾的是,DGX 服务器 BIOS 不允许您手动指定 PXE 服务器。您必须依赖 DHCP 服务器来告诉您它是什么,以及要从哪个文件启动。在 DHCP 服务器的 /etc/dhcp/dhcpd.conf 文件中

  • 将“next-server”设置为 <FTP IP_ADDR>

  • 将“filename”设置为“efi64/syslinux.efi”

同样,这假定概述中的目录结构。

可选:配置 NVIDIA ConnextX 卡以进行 PXE 启动

DGX 服务器也可以使用 NVIDIA ConnextX 卡进行 PXE 启动。如果您已登录 DGX 系统,则可以使用 /usr/sbin/mlnx_pxe_setup.bash 工具执行本节的步骤,这将启用找到的每个 NVIDIA ConnectX InfiniBand 设备的 UEFI PXE ROM。

否则,请继续执行以下手动步骤。

查询 UEFI PXE ROM 状态

为了从 MLNX CX-4/5/6 卡进行 PXE 启动,您必须首先启用您希望从中进行 PXE 启动的卡的 UEFI PXE ROM,因为它默认情况下处于禁用状态。这需要从 DGX 服务器主机操作系统本身执行,无法远程完成。NVIDIA ConnextX 设备的配置通过“mlxconfig”命令处理。

要确定 NVIDIA ConnectX 卡的设备名称和当前配置,请运行 sudo mlxconfig query

sudo mlxconfig query

Device #1:

----------

Device type: ConnectX4
Name: MCX455A-ECA_Ax
Description: ConnectX-4 VPI adapter card; EDR IB (100Gb/s) and 100GbE;
single-port QSFP28; PCIe3.0 x16; ROHS R6

Device: /dev/mst/mt4115_pciconf3
Configurations: Next Boot

...

...

EXP_ROM_UEFI_x86_ENABLE False(0)

...
...

Enable UEFI PXE ROM

对于您希望从中进行 PXE 启动的 NVIDIA ConnectX 卡,EXP_ROM_UEFI_x86_ENABLE 配置必须设置为 True(1),然后重新启动。

sudo mlxconfig -y -d /dev/mst/mt4115_pciconf3 set EXP_ROM_UEFI_x86_ENABLE=1

重新启动系统

sudo reboot

重新启动后,确认配置已设置。

sudo mlxconfig query

Device #1:

----------

Device type: ConnectX4
Name: MCX455A-ECA_Ax
Description: ConnectX-4 VPI adapter card; EDR IB (100Gb/s) and 100GbE;
single-port QSFP28; PCIe3.0 x16; ROHS R6

Device: /dev/mst/mt4115_pciconf3
Configurations: Next Boot

...
...

EXP_ROM_UEFI_x86_ENABLE True(1)

...
...

配置 syslinux 启动加载程序#

这些说明安装 syslinux 6.04-pre1 软件包。5.x.y 操作系统镜像不包含用于 PXE 启动的启动加载程序。相反,使用来自 kernel.org 的 syslinux。安装 syslinux 6.04-pre1 软件包是因为需要 6.04 中的修复程序来支持从 Mellanox 以太网卡进行 PXE 启动作为选项。从 Mellanox 卡进行 PXE 启动还需要至少 16.23.1020 级别的固件,具有

  • FW 16.23.1020

  • PXE 3.5.0504

  • UEFI 14.16.0017

这些说明在 PXE 服务器上生成以下文件结构。

/local/syslinux
└── efi64
    ├── ldlinux.e64
    ├── libcom32.c32
    ├── libutil.c32
    ├── menu.c32
    ├── pxelinux.0
    ├── pxelinux.cfg
    │   └── default
    ├── syslinux.efi
    └── vesamenu.c32
  1. 安装 Syslinux 6.04-pre1

    1. 下载并解压 syslinux 存档。

      cd /local
      
      wget https://mirrors.edge.kernel.org/pub/linux/utils/boot/syslinux/Testing/6.04/syslinux-6.04-pre1.tar.gz
      
      sudo tar -xvf syslinux-6.04-pre1.tar.gz
      
    2. 复制 syslinux 文件。

      sudo ln -s /local/syslinux-6.04-pre1 /local/syslinux
      
      sudo mkdir /local/syslinux/efi64/pxelinux.cfg
      
      sudo cp syslinux-6.04-pre1/bios/core/pxelinux.0 syslinux/efi64/
      
      sudo cp syslinux-6.04-pre1/efi64/efi/syslinux.efi syslinux/efi64/
      
      sudo cp syslinux-6.04-pre1/efi64/com32/elflink/ldlinux/ldlinux.e64 syslinux/efi64/
      
      sudo cp syslinux-6.04-pre1/efi64/com32/menu/vesamenu.c32 syslinux/efi64/
      
      sudo cp syslinux-6.04-pre1/efi64/com32/menu/menu.c32 syslinux/efi64/
      
      sudo cp syslinux-6.04-pre1/efi64/com32/libutil/libutil.c32 syslinux/efi64
      
      sudo cp syslinux-6.04-pre1/efi64/com32/lib/libcom32.c32 syslinux/efi64/
      
  2. 按如下方式编辑 PXE 启动默认配置文件,并确保您更新 http 服务器的 IP 地址

    sudo vi /local/syslinux/efi64/pxelinux.cfg/default
    default menu
    prompt 0
    timeout 300
    menu title DGX Install Images
    label dgxbaseos-5.x.y
    menu label DGXBaseOS 5.x.y (Base OS)
    kernel http://<http-address>/dgxbaseos-5.x.y/vmlinuz
    initrd http://<http-address>/dgxbaseos-5.x.y/initrd
    append boot=live config components union=overlay noswap noeject ip::enp226s0:dhcp ethdevice-timeout=60 fetch=http://<http-address>/dgxbaseos-5.x.y/DGXOS-5.x.y-<release-labels>.iso apparmor=0 elevator=noop nvme-core.multipath=n nouveau.modeset=0 rebuild-raid offwhendone console=tty0 console=ttyS1,115200n8
    

内核启动参数应与相应 ISO 的启动菜单的内容匹配,该菜单位于 /mnt/boot/grub/grub.cfg 中。

Live Boot 参数#

以下是关于 pxelinux.cfg/default 文件中指定的 live boot 参数的一些信息。

注意

可以在此处找到上述所有 live-boot 参数(以及更多)的手册页

以下参数可用于配置系统的网络接口

ip=: 告诉 initramfs 通过使用 DHCP 自动配置系统的接口。如果只有一个接口连接到网络,则此接口应该足够。如果多个接口连接到网络,则 initramfs 将使用第一个收到回复的接口。

在这种情况下,您可能需要提供更具体的配置。例如,ip::enp1s0f0:dhcp 告诉 initramfs 通过使用 DHCP 配置 enp1s0f0 接口。

ethdevice-timeout:允许您指定等待以太网设备配置完成的时间。上面的示例给系统 60 秒的时间来配置其接口,然后放弃。

以下参数是 DGX OS 安装程序特有的

rebuild-raid:如果指定了数据 RAID,则告诉安装程序重建 RAID。来自工厂的安装应始终指定此参数,但在其他情况下,它是可选的。

curtin-encrypt-root:使用众所周知的密码在根文件系统上设置 LUKS 加密。

no-mlnx-fw-update:跳过在安装期间更新 NVIDIA ConnectX 卡固件。

设置 GRUB PXE 服务器#

除了使用 syslinux 启动之外,您可以修改本文档前面概述的 PXE 服务器设置以改用 GRUB。作为提醒,“实验室管理员或负责部署 PXE 环境的任何人都应更改目录名称和结构以适应其基础设施。” 此外,所需的 GRUB 二进制文件应下载并放置在正确的目录中,具体取决于实验室管理员选择的基础设施。

下载 GRUB 软件包

创建一个新目录 /local/grub2/,然后下载具有指定正确架构的相关软件包。在此示例中,我们将使用 x86_64

yum install --downloadonly shim-x64.x86_64 grub2-efi-x64.x86_64

RPM 最终位于:/var/cache/yum/x86_64/7/base/packages 和 /var/cache/yum/x86_64/7/updates/packages。使用以下命令解压 RPM

rpm2cpio grub2-efi-x64-2.02-0.86.el7.centos.x86_64.rpm | cpio -idmv
rpm2cpio shim-x64-15-8.el7.x86_64.rpm | cpio -idmv

将以下二进制文件从解压的 RPM 复制到 /local/grub2/

  • shim.efi

  • shimx64.efi

  • grubx64.efi

    在 /local/grub2/ 中复制 shimx64.efi,并将副本重命名为 bootx64.efi。

    修改 DHCP 配置

    在 DHCP 服务器的 /etc/dhcp/dhcpd.conf 文件中

    • 将“next-server”保留为 <FTP IP_ADDR>

    • {.p dir=“ltr”} 更改指向“syslinux.efi”的“filename”条目,如下所示

if option architecture = 00:06 {
 filename "grub2/bootia32.efi";
} elsif option architecture = 00:07 {
 filename "grub2/bootx64.efi";
} elsif option architecture = 00:09 {
 filename "grub2/bootx64.efi";
} elsif option architecture = 00:0b {
 filename "grub2/grubaa64.efi";
} else {
 filename "pxelinux.0";
}

修改 TFTP 配置

修改 /etc/xinetd.d/tftp

  • 将 tftp-server 指向 grub2 目录,以便系统进行 PXE 启动

  • 使 tftp-server 从 DHCP 服务器的 dhcpd.conf 文件中指定的 grub2 目录传输新的 .efi 文件

    一旦 *.efi 启动,它应该在同一目录中查找相应的 grub.cfg 文件,该文件指向 vmlinuz 和 initrd

    示例

    /local/http
    └── http/
        ├── dgxbaseos-5.x.y/
        │   └── base_os_5.x.y.iso
    └── ftp/
        ├── dgxbaseos-5.x.y/
        │   └── base_os_5.x.y.iso
        ├── boot/
        │   └── grub/
        │    │    └── bios.img
        │    │    └── boot.cat
        │    │    └── grub.cfg
        ├── EFI/
        │   └── efiboot.img
        ├── live/
        │   └── filesystem.squashfs
        ├── md5sum.rtxt
        ├── UBUNTU_LIVE
     - dgxbaseos-5.x.z/
        │   └── base_os_5.x.z.iso
        ├── boot/
        │   └── grub/
        │    │    └── bios.img
        │    │    └── boot.cat
        │    │    └── grub.cfg
        ├── EFI/
        │   └── efiboot.img
        ├── live/
        │   └── filesystem.squashfs
        ├── md5sum.rtxt
        ├── UBUNTU_LIVE
    - dgxbaseos-5.a.b/
        ├── boot/
        │   └── grub/
        │    │    └── bios.img
        │    │    └── boot.cat
        │    │    └── grub.cfg
        ├── base_os_5.a.b.iso
        ├── boot/
        │   └── grub/
        │    │    └── bios.img
        │    │    └── boot.cat
        │    │    └── grub.cfg
        ├── EFI/
        │   └── efiboot.img
        ├── live/
        │   └── filesystem.squashfs
        ├── md5sum.rtxt
        ├── UBUNTU_LIVE
    - grub2/
        ├── sdgx-5.x.y/
           └── vmlinuz
           └── initrd
        ├── grub.cfg
        ├── grubx64.efi
        ├── shim.efi
        ├── shimx64.efi
    

grub2/grub.cfg 文件的内容应如下所示

set default=0
set timeout=-1
insmod all_video
menuentry 'dgxbaseos-5.x.y' {
linux /sdgx-5.x.y/vmlinuz boot=live config components union=overlay noswap noeject ip= ethdevice-timeout=60
initrd /sdgx-5.x.y/initrd
}

可选:配置 NVIDIA ConnextX 卡以进行 PXE 启动#

DGX 服务器也可以使用 MLNX CX-4/5/6 卡进行 PXE 启动。如果您已登录 DGX 服务器主机操作系统,并且运行 DGX 基础操作系统 4.4 或更高版本,则可以使用 /usr/sbin/mlnx_pxe_setup.bash 工具执行本节的步骤,这将启用找到的每个 MLNX Infiniband 设备的 UEFI PXE ROM。

否则,请继续执行以下手动步骤。

查询 UEFI PXE ROM 状态#

以下是查询 UEFI PXE ROM 当前状态的步骤。为了从 MLNX CX-4/5/6 卡进行 PXE 启动,请启用您要从中进行 PXE 启动的卡的 UEFI PXE ROM。

默认情况下,UEFI PXE ROM 处于禁用状态。

注意

此过程无法远程完成,因为它需要从主机操作系统执行。

MLNX CX 设备的配置通过 [mlxconfig] 命令处理。

要确定 MLNX CX 卡的设备名称和当前配置,请运行 [sudo mlxconfig query]

sudo mlxconfig query

Device #1:
----------

Device type:    ConnectX4
Name:           MCX455A-ECA_Ax
Description:    ConnectX-4 VPI adapter card; EDR IB (100Gb/s) and 100GbE; single-port QSFP28; PCIe3.0 x16; ROHS R6
Device:         /dev/mst/mt4115_pciconf3

Configurations:                              Next Boot
         ...
         ...
         EXP_ROM_UEFI_x86_ENABLE             False(0)
         ...
         ...

启用 UEFI PXE ROM#

以下是关于如何启用 UEFI PXE ROM 的一些信息。

  1. 确保对于您要从中进行 PXE 启动的 MLNX CX 卡,EXP_ROM_UEFI_x86_ENABLE 配置设置为 True(1)

    sudo mlxconfig -y -d /dev/mst/mt4115_pciconf3 set EXP_ROM_UEFI_x86_ENABLE=1
    
  2. 重新启动系统

    sudo reboot
    
  3. 等待系统重新启动并确认配置已设置。

    sudo mlxconfig query
    Device #1:
    ----------
    Device type:    ConnectX4
    Name:           MCX455A-ECA_Ax
    Description:    ConnectX-4 VPI adapter card; EDR IB (100Gb/s) and 100GbE; single-port QSFP28; PCIe3.0 x16; ROHS R6
    Device:         /dev/mst/mt4115_pciconf3
    Configurations:                              Next Boot
             ...
             ...
             EXP_ROM_UEFI_x86_ENABLE             True(1)
             ...
             ...
    

Curtin 自定义#

以下是关于自定义 curtin 文件的一些信息。

对于某些部署,您可能希望使用自己的 curtin 文件。本节将描述内置 curtin 文件中包含的一些部分,以及如何执行一些常见的自定义。

自定义 Curtin YAML#

curtin 文件位于 filesystem.squashfs 中。创建无接触安装(例如通过播种初始用户 ID 和密码并跳过 oem-config 步骤)是通过自定义 curtin 文件来完成的。(上面描述的 nooemconfig 启动参数执行初始用户 ID/密码播种和 oem-config 跳过。对于 curtin yaml 的任何其他自定义,请按照以下步骤操作)。

  1. 从 ISO 获取 filesystem.squashfs

  2. 运行“unsquashfs filesystem.squashfs”

  3. squashfs-root/curtin/ 目录中复制您尝试从中进行 PXE 安装的平台的 curtin 文件到 Web 服务器或 FTP 服务器。

  4. 自定义 curtin 文件

  5. 在您的 PXE 启动加载程序条目中使用 force-curtin 参数指向您的新 curtin 文件的 URL

有关 curtin 的更多信息,请参见此处:https://curtin.readthedocs.io/en/latest/index.html

以下是可以找到的用于执行无接触安装的示例 curtin 文件

apt:
  preserve_sources_list: false
  sources_list: |
    # network: will be available to target from early stage
    deb [trusted=yes] http://127.0.0.1/ /
  conf: |
    Dpkg::Options {
      "--force-confdef";
      "--force-confold";
    };

install:
  log_file: /var/log/curtin.log
  error_tarfile: /var/log/curtin/curtin-error-logs.tar
  post_files:
    - /var/log/curtin.log
    - /var/log/syslog
  save_install_config: /var/log/curtin-conf.yaml
  save_install_log: /var/log/curtin-install.log
  umount: disabled

kernel:
  package: linux-generic

storage:
  version: 1
  config:
  - id: CHANGE_BOOT_DISK_NAME_1
    type: disk
    ptable: gpt
    path: CHANGE_BOOT_DISK_PATH_1
    name: osdisk
    wipe: superblock-recursive
    grub_device: 1
  - id: CHANGE_BOOT_DISK_NAME_1-part1
    type: partition
    device: CHANGE_BOOT_DISK_NAME_1
    number: 1
    size: 512MB
    flag: boot
  - id: CHANGE_BOOT_DISK_NAME_1-part2
    type: partition
    device: CHANGE_BOOT_DISK_NAME_1
    number: 2
    size: CHANGE_BOOT_DISK_SIZE_1
  - id: CHANGE_BOOT_DISK_NAME_1-part1-fs1
    type: format
    fstype: fat32
    label: efi
    volume: CHANGE_BOOT_DISK_NAME_1-part1
  - id: CHANGE_BOOT_DISK_NAME_1-part2-fs1
    type: format
    fstype: ext4
    label: root
    volume: CHANGE_BOOT_DISK_NAME_1-part2
  - id: CHANGE_BOOT_DISK_NAME_1-mount2
    type: mount
    path: /
    device: CHANGE_BOOT_DISK_NAME_1-part2-fs1
    options: errors=remount-ro
    passno: 1
  - id: boot-mount1
    type: mount
    path: /boot/efi
    device: CHANGE_BOOT_DISK_NAME_1-part1-fs1
    passno: 1

swap:
  size: 0

power_state:
  mode: CHANGE_POWER_STATE
  delay: 5
  message: Installation Complete

sources:
  05_primary:
    uri: "file:///curtin/ubuntu-20.04-server-cloudimg-amd64-root.tar.xz"
    type: "tgz"

reporting:
  mylistener:
    type: journald
    identifier: "curtin-journald"
    level: DEBUG

#early_commands:
#  90_mount_curtin: mount -o bind /curtin/repo/ /var/www/html/
#  91_chown_www: chown www-data:www-data /curtin/repo /var/www/html

late_commands:
  # SSH is configured differently in the cloud images so reconfigure it here to get back
  # to the default settings
  10_conf_ssh: ["curtin", "in-target", "--", "sh", "-c", "dpkg-reconfigure openssh-server"]
  11_conf_ssh: ["curtin", "in-target", "--", "sh", "-c", "sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config"]

  23_apt_update: ["curtin", "in-target", "--", "sh", "-c", "DEBIAN_FRONTEND=noninteractive apt update -y"]
  #24_install_pkgs: ["curtin", "in-target", "--", "sh", "-c", "DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends CHANGE_INSTALL_PKGS"]
  #25_unattended_upgrades: ["curtin", "in-target", "--", "sh", "-c", "DEBIAN_FRONTEND=noninteractive apt purge -y unattended-upgrades"]

  # Rewrite sources list
  30_write_sources: ["curtin", "in-target", "--", "sh", "-c", "echo deb http://us.archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse > /etc/apt/sources.list"]
  31_write_sources: ["curtin", "in-target", "--", "sh", "-c", "echo deb http://us.archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse >> /etc/apt/sources.list"]
  32_write_sources: ["curtin", "in-target", "--", "sh", "-c", "echo deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse >> /etc/apt/sources.list"]

  # [bug 3099036]: create auth.log now so the fail2ban service can start
  33_touch_auth: ["curtin", "in-target", "--", "sh", "-c", "sudo -u syslog -g adm touch /var/log/auth.log && chmod 644 /var/log/auth.log || true"]

  # Disable release-upgrade prompt
  40_disable_upgrade: ["curtin", "in-target", "--", "sh", "-c", "sed -i -e 's/^Prompt=.*/Prompt=never/' /etc/update-manager/release-upgrades"]

  # Create user
  50_create_user: ["curtin", "in-target", "--", "sh", "-c",
    "adduser --disabled-password --gecos \"\" --quiet lab"]
  51_add_user_group: ["curtin", "in-target", "--", "sh", "-c",
    "usermod -aG sudo lab"]
  52_set_user_password: ["curtin", "in-target", "--", "sh", "-c",
    "echo 'lab:labuser' | chpasswd"]

  # Copy logs from the install environment into the target
  90_mkdir_installer_logs: mkdir -p $TARGET_MOUNT_POINT/var/log/installer
  91_copy_logs: cp -rf /var/log/* $TARGET_MOUNT_POINT/var/log/installer/

NVIDIA 特定的 Curtin 变量#

以下是关于 NVIDIA 特定的 curtin 变量的一些信息。

ISO 中包含的 curtin 文件特定于平台,并且可以作为自定义版本的良好起点。它们中的许多文件都包含变量,前缀为 CHANGE_,这些变量由安装程序替换。

CHANGE_STORAGE_REG#

当 boot 参数 curtin-encrypt-root 不存在时,这将删除并取消注释。取消注释此节会导致标准的磁盘分区方案,而无需 LUKS 加密。

CHANGE_STORAGE_ENC#

当 boot 参数“curtin-encrypt-root”存在时,这将删除并取消注释。取消注释此节会导致加密的根分区。

CHANGE_BOOT_DISK_NAME_x#

这是一个磁盘名称,不带“/dev”前缀。对于期望 RAID 启动设备的平台,可能会有多个(即 CHANGE_BOOT_DISK_NAME_1 和 CHANGE_BOOT_DISK_NAME_2),DGX-2 和 DGX A100 就是这种情况。安装程序将找到要在此处替换的适当磁盘名称。或者,“force-bootdisk”参数可用于指定磁盘名称。

CHANGE_BOOT_DISK_PATH_x:这与上面的 CHANGE_BOOT_DISK_NAME_x 变量相同,只是前缀为 /dev/

CHANGE_POWER_STATE:这告诉安装程序在安装完成后是停止还是重新启动计算机。它由“offwhendone”启动参数控制。

CHANGE_DESC_PLATFORM:安装程序将使用特定于平台的描述性名称替换此项。

CHANGE_SERIAL_NUMBER:安装程序将使用 dmidecode 报告的序列号替换此项

CHANGE_MLNX_FWUPD:此值将被删除或替换为“RUN_FW_UPDATER=no”,由安装程序完成。这基于是否存在“no-mlnx-fw-update”启动参数来完成。这决定了安装程序是否会更新计算机上存在的 Mellanox 网络卡上的固件。

CHANGE_INSTALL_PKGS:安装程序将使用特定于平台的软件包列表替换此值。软件包列表由 squashfs 中的 *-pkgs 文件指定。

CHANGE_REBUILD_RAID:这将根据是否存在“rebuild-raid”启动参数替换为“true”或“false”。

CHANGE_IPMISOL:这将根据是否存在“curtin-encrypt-root”启动参数替换为“true”或“false”。当我们使用加密设置系统时,我们还会撤消 IPMI 串行通过 LAN 配置,以确保 LUKS 密码短语提示显示在控制台上,而不是串行通过 LAN 接口上。

虽然可以自行替换这些值,但我们强烈建议让安装程序处理此问题。

通过 PXE 启动 DGX 系统#

您可以通过 BMC GUI 对 DGX A100 进行电源循环,或者,或者,使用“ipmitool”设置 pxe 启动并重新启动客户端 DGX A100

ipmitool -I lanplus -H <DGX-BMC-IP> -U <username> -P <password> chassis bootdev pxe options=efiboot
ipmitool -I lanplus -H <DGX-BMC-IP> -U <username> -P <password> chassis power reset

故障排除

在 PXE 启动过程中,您可能会从客户端 BMC 看到以下错误

BootCurrent: 0018
Timeout: 1 seconds
BootOrder: 0000,0006,0007,0008,000C,000D,000E,000F,0016,0017,0001
Boot0000* ubuntu
Boot0001  UEFI: Built-in EFI Shell
Boot0004* UEFI: PXE IPv4 Intel(R) I210 Gigabit  Network Connection
Boot0005* UEFI: PXE IPv6 Intel(R) I210 Gigabit  Network Connection
Boot0006* UEFI: PXE IPv4 Mellanox Network Adapter - 0C:42:A1:5F:44:7C
Boot0007* UEFI: PXE IPv4 Mellanox Network Adapter - 0C:42:A1:74:74:9E
Boot0008* UEFI: PXE IPv4 Mellanox Network Adapter - 0C:42:A1:74:74:8E
Boot0009* UEFI: PXE IPv4 Mellanox Network Adapter - 0C:42:A1:74:6B:CA
Boot000A* UEFI: PXE IPv4 Mellanox Network Adapter - 0C:42:A1:74:74:9A
Boot000B* UEFI: PXE IPv4 Mellanox Network Adapter - 0C:42:A1:5F:51:D8
Boot000C* UEFI: PXE IPv4 Mellanox Network Adapter - 0C:42:A1:74:6A:FA
Boot000D* UEFI: PXE IPv4 Mellanox Network Adapter - 0C:42:A1:74:74:C2
Boot000E* UEFI: PXE IPv4 Mellanox Network Adapter - 0C:42:A1:4A:62:60
Boot000F* UEFI: PXE IPv4 Mellanox Network Adapter - 0C:42:A1:4A:62:61
Boot0016* UEFI: PXE IPv6 Mellanox Network Adapter - 0C:42:A1:4A:62:60
Boot0017* UEFI: PXE IPv6 Mellanox Network Adapter - 0C:42:A1:4A:62:61
Invalid BootOrder order entry value0018
                                     ^
efibootmgr: entry 0018 does not exist
Unexpected error while running command.
Command: ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmpsgpxpe9k/target', 'efibootmgr', '-o', '0018,0000,0006,0007,0008,000C,000D,000E,000F,0016,0017,0001']
Exit code: 8

解决方案是等待 Ubuntu 控制台出现,以 root 身份登录(无需密码),然后运行以下命令使 Intel I210 NIC 成为第一个尝试 PXE 启动的 NIC

efibootmgr -o 0004,0000,0006,0007,0008,0009,000A,000B, 000C,000D,000E,000F

参考:其他 IPMI 启动选项#

以下是关于其他 IPMI 启动选项的一些信息。