You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用cloud-config安装VM时出现Cloud-init参数缺失错误

Ubuntu 22.04 cloud-init自动安装报错:__init()__ missing 1 required positional argument: 'name'

我创建了一个cloud-init文件,并用以下命令验证配置:

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

将该cloud-config文件集成到Ubuntu 22.04 ISO文件后,我修改了Ubuntu镜像内的其他文件以加载我的user-data,但尝试创建虚拟机并启动安装时,出现了如下错误:

__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

连接虚拟机后看到的报错界面:
Ubuntu自动安装报错界面

内容的提问来源于stack exchange,提问作者kursattokpinar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.27 13:37:52