ubuntu 使用云配置文件安装VM时发生Cloud-init错误[已关闭]

ttvkxqim  于 2023-03-29  发布在  其他
关注(0)|答案(1)|浏览(386)

**已关闭。**此问题为not about programming or software development。当前不接受答案。

此问题似乎与a specific programming problem, a software algorithm, or software tools primarily used by programmers无关。如果您认为此问题与another Stack Exchange site的主题有关,您可以留下评论,说明在何处可以回答此问题。
2天前关闭。
Improve this question
我创建了一个cloud-init文件,并使用以下命令对其进行了验证:

cloud-init schema --config-file source-files/server/user-data

在Ubuntu 22.04 ISO文件中包含我的云配置文件后,我修改了Ubuntu中的其他文件,使其使用我的用户数据。然而,当尝试安装VM时,我遇到了以下错误:

__init()__ missing 1 required positional argument: 'name'

以下是我的cloud-init内容:

#cloud-config
autoinstall:
  version: 1
  identity:
    realname: clusteradmin
    username: clusteradmin
    hostname: newhost
    password: "$6$m39rWH9yal3nbN1M$R54RPwl0iMwkVz4A.qFyW.e.2ieMPBQL58RySuRtmDCofNS/lZiP2PbZUrLB5whEAOSrAUOh54aTWmMceB1SO1"
  ssh:
    allow-pw: true
    install-server: true
  refresh-installer:
    update: false
  locale: en_US.UTF-8
  keyboard:
    layout: us
    variant: eng
  package_update: true
  package_upgrade: true
  storage:
    config:
    - id: sda
      type: disk
      name: 'main'
      ptable: gpt
      wipe: superblock
      preserve: false
      grub_device: true
    - id: bios-grub-partition
      type: partition
      number: 1
      device: sda
      size: 1048576
      preserve: false
      grub_device: false
      flag: bios_grub
    - id: boot-partition
      type: partition
      number: 2
      device: sda
      size: 2G
      wipe: superblock
      preserve: false
      grub_device: false
      flag: ''
    - id: ubuntu-vg-partition
      type: partition
      number: 3
      device: sda
      size: -1
      wipe: superblock
      preserve: false
      grub_device: false
      flag: ''
    - id: boot-format
      type: format
      fstype: ext4
      volume: boot-partition
      preserve: false
    - id: boot-mount
      type: mount
      device: boot-format
      path: /boot
    - id: ubuntu-vg
      type: lvm_volgroup
      name: ubuntu-vg
      devices:
      - ubuntu-vg-partition
      preserve: false
    - id: root-lv
      type: lvm_partition
      volgroup: ubuntu-vg
      size: 15%
      wipe: superblock
      preserve: false
    - id: var-lv
      type: lvm_partition
      volgroup: ubuntu-vg
      size: 30%
      wipe: superblock
      preserve: false
    - id: vartmp-lv
      type: lvm_partition
      volgroup: ubuntu-vg
      size: 5%
      wipe: superblock
      preserve: false
    - id: varlog-lv
      type: lvm_partition
      volgroup: ubuntu-vg
      size: 15%
      wipe: superblock
      preserve: false
    - id: varlogaudit-lv
      type: lvm_partition
      volgroup: ubuntu-vg
      size: 15%
      wipe: superblock
      preserve: false
    - id: home-lv
      type: lvm_partition
      volgroup: ubuntu-vg
      size: 15%
      wipe: superblock
      preserve: false
    - id: tmp-lv
      type: lvm_partition
      volgroup: ubuntu-vg
      size: 5%
      wipe: superblock
      preserve: false
    - id: root-format
      type: format
      volume: root-lv
      preserve: false
      fstype: ext4
    - id: var-format
      type: format
      volume: var-lv
      preserve: false
      fstype: ext4
    - id: vartmp-format
      type: format
      volume: vartmp-lv
      preserve: false
      fstype: ext4
    - id: varlog-format
      type: format
      volume: varlog-lv
      preserve: false
      fstype: ext4
    - id: varlogaudit-format
      type: format
      volume: varlogaudit-lv
      preserve: false
      fstype: ext4
    - id: home-format
      type: format
      volume: home-lv
      preserve: false
      fstype: ext4
    - id: tmp-format
      type: format
      volume: tmp-lv
      preserve: false
      fstype: ext4
    - id: root-mount
      type: mount
      device: root-format
      path: /
    - id: var-mount
      type: mount
      device: var-format
      path: /var
    - id: vartmp-mount
      type: mount
      device: vartmp-format
      path: /var/tmp
    - id: varlog-mount
      type: mount
      device: varlog-format
      path: /var/log
    - id: varlogaudit-mount
      type: mount
      device: varlogaudit-format
      path: /var/log/audit
    - id: home-mount
      type: mount
      device: home-format
      path: /home
    - id: tmp-mount
      type: mount
      device: tmp-format
      path: /tmp

以下是连接时虚拟机的视图:

z9smfwbn

z9smfwbn1#

您的存储配置中有一个错误。所有逻辑卷都必须有一个名称,但您在所有lvm_partition块中缺少一个name:属性。而不是:

- id: root-lv
  type: lvm_partition
  volgroup: ubuntu-vg
  size: 15%
  wipe: superblock
  preserve: false

你需要这样的东西:

- id: root-lv
  name: root
  type: lvm_partition
  volgroup: ubuntu-vg
  size: 15%
  wipe: superblock
  preserve: false

(And对于其余的逻辑卷定义,也是如此。)
我认为你也应该报告安装程序的bug:在这种情况下,您应该会收到更有用的错误消息。

相关问题