Score:0

Ubuntu 22.04.1 autoinstall cloud-config fails

bh flag

I'm currently having an issue installing Ubuntu 22.04 via cloud-init. The server has two hard drives. There should be a /data partition on the second hard disk, but currently, the installation doesn't work. Error message Does anyone have an idea what is wrong with the storage configuration?

#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
dummyuser avatar
uy flag
I would recommend to use a simple storage configuration for a test installation `storage: layout: name: direct` This will not establish your partitioning, but you will a an user-data file in `/var/log/installer/autoinstall-user-data` with more information. May be this helps to get the correct format.
Score:0
jp flag

Based on your configuration it appears you are installing onto a BIOS based device. I tried using your storage config and got the following error. To see this error message I opened a terminal in the installer environment and ran 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.

The error is telling you that you are installing onto a BIOS based device, using a GPT layout, but not creating a bios_grub partition. This will not work.

To quote from https://help.ubuntu.com/community/Grub2/Installing

installing GRUB2 on a GPT (GUID Partition Table) disk requires a dedicated BIOS boot partition with a recommended size of at least 1 MiB. ... It must be identified with a bios_grub flag.

You can add this to your storage config as the first partition.

      - type: partition
        device: disk0
        size: 4194304
        flag: bios_grub
        number: 14
        preserve: false
        grub_device: false
        id: partition-14
Alex Dresko avatar
pt flag
Can you explain what the "installer environment" is and how you were able to open a terminal in that environment? I'm having a hard time understanding the "installation environment" in relation to the other ("target"? "installed"?) environment.
Andrew Lowther avatar
jp flag
@AlexDresko the "installer environment" is what gets created when you boot from the installation media. At the console with the installer running you can open a terminal using `alt-f2` or the `Help` menu. Within the "installer environment" a `/target` mount is used as the base for the installation. This becomes the `/` mount after rebooting.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.