I ran into this as well, trying to automating my auto-rebuild system for my home network.
I am going to start from the beginning on this: troubleshooting.
When you use autoinstall and it errors out, it allows you to drop to a command prompt. From there you can run the ‘curtain in-target’ commands in ‘late-commands’.
While looking at it, even though ‘openssh-server’ is in ‘autoinstall’ → ‘apt’→ ‘ssh’ → ‘install_server: true’, it doesn’t get a chance to install openssh server at the point ‘late-commands’ are executed. You need to make sure that ‘openssh-server’ is under the ‘autoinstall’ → ‘packages’ section.
From there, you might need to enable ‘ssh’ (ssh is the systemctl name of openssh-server on Ubuntu 24.04).
In ‘late-commands’ the line you should be using is:
late-commands:
- curtain in-target --target=/target -- systemctl enable ssh
This will enable ssh for after the reboot. Here is my full (redacted) user-data file:
#cloud-config
autoinstall:
version: 1
refresh-installer:
update: true
network:
version: 2
ethernets:
enp0s3:
dhcp4: true
identity:
hostname: k8scp.themetzler.com
realname: "My Real Name"
username: "myusername"
password: "myencrypted password with mkpasswd"
apt:
preserve_sources_list: true
geoip: true
fallback: abort
ssh:
install_server: true
authorized-keys:
- ssh-ed25519 mypublicsshkey
allow-pw: true
locale: en_US
keyboard:
layout: us
timezone: America/Chicago
packages:
- virtualbox-guest-utils
- vim
- apt-transport-https
- software-properties-common
- ca-certificates
- tree
- socat
- openssh-server
updates: all
shutdown: reboot
codecs:
install: false
drivers:
install: true
debconf-selections: |
openssh-server openssh-server/permit-root-login boolean false
ufw ufw/enable boolean true
storage:
layout:
name: direct
swap:
size: 0
late-commands:
- "curtin in-target --target=/target -- systemctl enable ssh"
This, along with cloud-localds, I can autoinstall onto a virtual environment. Just mount your standard Ubuntu ISO as the bootable ISO and the output of cloud-localds as the secondary ISO. subuquity detects the second ISO and uses that as user-data.
cloud-localds user-data.iso user-data where user-data is a text input of the autoinstall file and user-data.iso is the created/output ISO file.
Watch out on late-commands as it converts the file autoinstall file from YAML to JSON, which can get the quotes/doublequotes mixed up. Easiest way to test it is use yq –output-format=json user-data where user-data is the file mentioned above. This allows you to see how it is parsed, and adjust your quotes as needed. That little bit tripped me up. On Ubuntu yq is available through sudo apt install yq or snap install yq. This is your choice, but I’m an old fart still staying away from snap as much as possible.