MAAS - Deploy - Cloud-init user-data: Autoinstall.yaml

I have a working autoinstall.yaml script that repartitions a drive to preserve windows, for a dual-boot system. The script works fine when livebooting Ubuntu 24.04 and targeting the autoinstall file.

I’ve copied the content into “user-data” and touched a “meta-data” file. Then attempted to enter various iterations of this in Cloud-init user-data to deploy on a new system.

attempt1: autoinstall ds=nocloud-net;s=
attempt2: ds=nocloud;s=

Everything i enter here results in the installation proceeding while completely ignoring my user-data file and configurations. As you can imagine, this is terribly painful as it wipes out the Windows installation & I have to start over cloning the system back.

(in all cases, the user-data & meta-data file are reachable in the root of those urls)

What am I doing wrong?
And why doesn’t MAAS give some kind of error or notification that the cloud-init line is either misconfigured or incorrect or it can’t find the user-data files or sommmmething other than proceeding blindly forward?

Any help is much appreciated.
Thank you

Can you share it?

I don’t think you can achieve this with just some tweaks with cloud init.

I feel your pain, it’s not going to be easy to achieve this result as it’s not supported out of the box

  version: 1
    hostname: temp
    password: pwhash
    realname: temp
    username: temp
    layout: us
  locale: en_US.UTF-8
    allow-pw: true
    authorized-keys: []
    install-server: true
    - transport: pcie
      preserve: true
      id: nvme-controller-nvme0
      type: nvme_controller
    - ptable: gpt
      path: /dev/nvme0n1
      preserve: true
      grub_device: false
      id: disk-nvme0n1
      type: disk
    - device: disk-nvme0n1
      size: 104857600
      flag: boot
      number: 1
      preserve: true
      grub_device: true
      path: /dev/nvme0n1p1
      id: partition-nvme0n1p1
      type: partition
    - device: disk-nvme0n1
      size: 16777216
      flag: msftres
      number: 2
      preserve: true
      grub_device: false
      path: /dev/nvme0n1p2
      id: partition-nvme0n1p2
      type: partition
    - device: disk-nvme0n1
      size: 817889280
      number: 3
      preserve: true
      grub_device: false
      path: /dev/nvme0n1p3
      id: partition-nvme0n1p3
      type: partition
    - device: disk-nvme0n1
      size: 460504170496
      number: 4
      preserve: true
      grub_device: false
      resize: true
      path: /dev/nvme0n1p4
      id: partition-nvme0n1p4
      type: partition
    - device: disk-nvme0n1
      size: -1
      wipe: superblock
      number: 5
      preserve: false
      id: partition-0
      type: partition
    - fstype: ext4
      volume: partition-0
      preserve: false
      id: format-0
      type: format
    - path: /
      device: format-0
      id: mount-1
      type: mount
    - fstype: vfat
      volume: partition-nvme0n1p1
      preserve: true
      id: format-partition-nvme0n1p1
      type: format
    - path: /boot/efi
      device: format-partition-nvme0n1p1
      id: mount-0
      type: mount
      - nfs-common
      - curl
      - tmux
      - parallel
      - apt-transport-https
      - ca-certificates
      - gnupg-agent
      - software-properties-common
      - |
        echo "deb [arch=amd64] $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list
      - curl -fsSL | apt-key add -
      - apt-get update
      - apt-get install -y docker-ce docker-ce-cli
      - systemctl enable docker
      - systemctl start docker
      - usermod -aG docker temp
    - curtin in-target --target=/target -- apt-get update
    - curtin in-target --target=/target -- apt-get upgrade -y
  timezone: America/New_York
  updates: security

RE: “It’s not supported out of the box”
How else can I get this to work?

My answer would not be different respect to this one PXE Dual-Boot on existing Windows machines .

First you need to understand the internals of MAAS and how it uses curtin to flash the image on the disk and then you can try to patch/tweak it

Until some years ago curtin was only able to wipe the entire disk. Since [Spec] support editing partition tables in curtin - Foundations - Ubuntu Community Hub has been implemented you might be able to achieve this but first you have to

  1. find the right curtin configuration that suites your needs so to preserve your existing partition
  2. find the way to plug this config into MAAS, because as I said this is not supported out of the box.

I already worked out an autoinstall.yaml that does the job.
And the way I understand it, that file can be targeted in kernel parameters on a custom image in MAAS,
OR the autoinstall.yaml can be rewritten using curtin parameters that adhere to the cloud init scripts being asked for.

If anyone else here knows the best way to do it, and/or can help with putting my autoinstall.yaml to work in MAAS deploy - pls lmk.

*Aside, for anyone that finds this post looking to run an automatic installation for DUAL-Boot on a disk with Windows pre-installed - my script above works great. The only piece missing up there is “partition_type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7”

Make sure you add that line to the existing Windows partition, or Windows won’t be able to recognize it. So that part looks like this:

    - device: disk-nvme0n1
      size: 460504170496
      number: 4
      preserve: true
      grub_device: false
      resize: true
	  partition_type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
      path: /dev/nvme0n1p4
      id: partition-nvme0n1p4
      type: partition