-1

I created a cloud-init file and validated it using the following command:

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

After including my cloud config file in an Ubuntu 22.04 ISO file, I modified other files in Ubuntu to make it use my user-data. However, when attempting to install the VM, I encountered the following error:

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

Here is my cloud-init content:

#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

Here is the view from the VM when I connect: enter image description here

kursattokpinar
  • 119
  • 1
  • 8
  • That error doesn't appear to have anything to do with cloud-init. What is `subiquity`? – larsks Mar 24 '23 at 12:10
  • 1
    Subiquity is not something that I knew or configured @larsks. I thought it is part of auto installation process as error says "subiquity/Filesystem/apply_autoinstall_config" at the beginning. Looking to Google, it's said that subiquity is Ubuntu Server Installer and it is the one executing cloud-init configuration. – kursattokpinar Mar 24 '23 at 12:20
  • Ah, thanks for that. I hadn't realized they had adopted cloud-init for driving automated installs like this. Have you succesfully tried out the examples from https://ubuntu.com/server/docs/install/autoinstall-quickstart? – larsks Mar 24 '23 at 12:40
  • @larsks, I have been able to get simpler configurations to function properly, but the problem arose when I tried configuring the storage component in a more intricate way. – kursattokpinar Mar 24 '23 at 13:16

1 Answers1

1

You have an error in your storage configuration. All logical volumes must have a name, but you're missing a name: attribute in all of your lvm_partition blocks. Instead of:

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

You need something like:

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

(And so forth for the rest of your logical volume definitions.)


I would argue that you should also report a bug against the installer: you should be receiving a more useful error message in this situation.

larsks
  • 277,717
  • 41
  • 399
  • 399