Ubuntu 22.04.1 自动安装云配置失败

Ubuntu 22.04.1 自动安装云配置失败

我目前在通过 cloud-init 安装 Ubuntu 22.04 时遇到问题。服务器有两个硬盘。第二个硬盘上应该有一个 /data 分区,但目前安装不起作用。 错误信息 有人知道存储配置出了什么问题吗?

#cloud-config
autoinstall:
  version: 1
  apt:
    geoip: true
    preserve_sources_list: false
    primary:
    - arches: [amd64, i386]
      uri: http://de.archive.ubuntu.com/ubuntu
    - arches: [default]
      uri: http://ports.ubuntu.com/ubuntu-ports
  users:
  - default
  - name: ubuntu
    passwd: "$6$rmFIz9Pdwb1$jsUGBTC46WkdnwLos4/6TqNnZaEdR7mV/XFfcvsnQXNKqgt.oZ2HTvboeZNP/qcNQXQqKkKnAU5i0Dh4GeAwA0"
    shell: /bin/bash
    lock-passwd: false
    ssh_pwauth: True
    chpasswd: { expire: False }
    sudo: ALL=(ALL) NOPASSWD:ALL
    groups: users, admin
  identity:
    hostname: ubuntu2204
    username: ubuntu
    password: "$6$rmFIz9Pdwb1$jsUGBTC46WkdnwLos4/6TqNnZaEdR7mV/XFfcvsnQXNKqgt.oZ2HTvboeZNP/qcNQXQqKkKnAU5i0Dh4GeAwA0"
  ssh:
    allow-pw: true
    install-server: true
  user-data:
    disable_root: false
    timezone: Europe/Berlin
  locale: de_DE
  keyboard:
    layout: de
  storage:
    config:
      - type: disk
        id: disk0
        grub_device: true
        wipe: superblock
        path: /dev/sda
        ptable: gpt
        match:
          size: largest
      - type: disk
        id: disk1
        path: /dev/sdb
        ptable: gpt
        match:
         size: smallest
      - type: partition
        id: boot-partition
        flag: boot
        device: disk0
        size: 500M
        number: 1
      - type: partition
        id: root-partition
        device: disk0
        number: 2
        size: -1
        wipe: superblock
      - type: partition
        id: data-partition
        number: 1
        device: disk1
        size: -1
      - id: boot-partition-fs
        type: format
        fstype: ext4
        volume: boot-partition
      - id: root-partition-fs
        type: format
        fstype: ext4
        volume: root-partition
      - id: data-partition-fs
        type: format
        fstype: ext4
        volume: data-partition
      - id: boot-partition-fs-mount
        type: mount
        path: /boot
        device: boot-partition-fs
      - id: root-partition-fs-mount
        type: mount
        path: /
        device: root-partition-fs
      - id: data-partition-fs-mount
        type: mount
        path: /data
        device: data-partition-fs
  late-commands:
    - echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/ubuntu

答案1

根据您的配置,您似乎正在安装到基于 BIOS 的设备上。我尝试使用您的存储配置并收到以下错误。为了查看此错误消息,我在安装程序环境中打开了一个终端并运行journalctl

Stderr: Installing for i386-pc platform.
        grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
        grub-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
        grub-install: error: will not proceed with blocklists.

错误提示您正在使用 GPT 布局安装到基于 BIOS 的设备上,但未创建分区bios_grub。这不起作用。

引自https://help.ubuntu.com/community/Grub2/Installing

在 GPT(GUID 分区表)磁盘上安装 GRUB2 需要专用的 BIOS 启动分区,建议大小至少为 1 MiB。... 它必须使用 bios_grub 标志进行标识。

您可以将其添加到您的存储配置中作为第一个分区。

      - type: partition
        device: disk0
        size: 4194304
        flag: bios_grub
        number: 14
        preserve: false
        grub_device: false
        id: partition-14

相关内容