0

I am trying to set up an Ubuntu Server 22.04 installation using autoinstall and cloud-init. I have two USB keys (I followed this tutorial https://www.jimangel.io/posts/automate-ubuntu-22-04-lts-bare-metal/):

  • One with an ISO image of Ubuntu Server 22.04 with autoinstall enabled.
  • The second one contains two YAML files: meta-data (empty file) and user-data.

When I try to install the new setup on a machine, ubuntu gets installed, the user is created but when the computer reboots, none of the packages (see user-data) seem to be installed. Even simple tests like creating a directory using runcmd do not persist.

Debugging Attempts

Checked cloud-init logs at /var/log/cloud-init.log and /var/log/cloud-init-output.log but did not find any relevant errors or warnings. Tried simplifying the user-data file to just create a directory, but it did not work.

I'd appreciate any pointers to debug and resolve this issue.

Here is my user-data file:

#cloud-config
package_update: true
package_upgrade: true

autoinstall: version: 1 locale: en_US keyboard: layout: fr identity: hostname: user username: user password: "$6$xyz$waX2p...." ssh: install-server: true packages: - openssh-server package_upgrade: true late-commands: - shutdown -h now runcmd:

  • apt install -y curl autossh unzip
  • apt install -y docker.io
  • systemctl start docker
  • systemctl enable docker
  • mkdir /home/bob

Bastien
  • 1
  • 2

1 Answers1

0

The answer was to include the runcmd within the autoinstall, like that:

package_update: true
package_upgrade: true

autoinstall: version: 1 locale: en_US keyboard: layout: fr identity: hostname: user username: user password: "$6$xyz$waX2p...." ssh: install-server: true packages: - openssh-server package_upgrade: true late-commands: - shutdown -h now runcmd: - apt install -y curl

Bastien
  • 1
  • 2