Home News Ubuntu Autoinstall over PXE: Subiquity & Cloud-Init Guide

Ubuntu Autoinstall over PXE: Subiquity & Cloud-Init Guide

Boot the Ubuntu Live Server kernel and initrd with iPXE, pass autoinstall and an unquoted ds=nocloud-net seed URL on the kernel command line, and serve user-data plus an empty meta-data over HTTP. Verify disk boot, netplan networking, and SSH before marking the node ready.

By TNTCloud Team Published 26 Nov 2026 Updated 26 Nov 2026 Guides

Ubuntu Autoinstall over PXE: Subiquity & Cloud-Init Guide

How does Ubuntu unattended PXE installation work?

Modern Ubuntu Server (20.04, 22.04, and 24.04 LTS) no longer uses the legacy Debian Installer or Preseed. Instead, network installs boot the Live Server kernel (vmlinuz) and initrd, fetch the SquashFS/ISO image over HTTP, and hand configuration to Subiquity via cloud-init autoinstall. In a TNTCloud PXE provisioning workflow, the sequence has four stages:

  1. iPXE boot: DHCP hands the host an iPXE script scoped to the active provisioning task.
  2. Kernel, initrd, and ISO fetch: iPXE loads vmlinuz and initrd over HTTP, while the kernel parameter url= points to the full Ubuntu Live Server ISO on the local mirror.
  3. Cloud-init seed fetch: Cloud-init reads ds=nocloud-net;s=... from /proc/cmdline and pulls user-data and meta-data over HTTP.
  4. Storage, packages, and late-commands: Subiquity partitions the disk, writes the root filesystem, runs late-commands inside the target system, and reboots into the installed OS.

What kernel parameters does iPXE need to pass?

Getting the kernel command line right is the difference between a hands-free install and an installer that stops at the language screen. A working iPXE kernel line for Ubuntu 24.04 looks like this:

kernel http://pxe.example.local/mirrors/ubuntu24.04/vmlinuz initrd=initrd ip=dhcp url=http://pxe.example.local/mirrors/ubuntu24.04/ubuntu-24.04-live-server-amd64.iso autoinstall ds=nocloud-net;s=http://pxe.example.local/seed/task-token/ cloud-config-url=/dev/null
initrd http://pxe.example.local/mirrors/ubuntu24.04/initrd
boot
  • ip=dhcp: Ensures initramfs brings up networking before fetching the ISO and seed files.
  • autoinstall: Tells Subiquity not to wait for interactive confirmation on the console.
  • ds=nocloud-net;s=... (no quotes): Do not wrap the ds= value in double quotes inside an iPXE script. iPXE passes literal quote characters straight into /proc/cmdline, which prevents cloud-init from matching the datasource and drops Subiquity back to interactive mode.
  • cloud-config-url=/dev/null: Prevents cloud-init from treating the ISO URL as a cloud-config file.

How should user-data and meta-data be structured?

The seed directory served at the s= URL needs at least two endpoints: user-data (starting with #cloud-config) and meta-data (which can be an empty 200 OK response or contain an instance-id). Returning an empty 200 OK for vendor-data is also good practice so cloud-init does not log repeated 404 retries.

#cloud-config
autoinstall:
  version: 1
  locale: en_US.UTF-8
  keyboard:
    layout: us
  network:
    version: 2
    ethernets:
      id0:
        match:
          name: "en*"
        dhcp4: true
  storage:
    layout:
      name: lvm
      sizing-policy: all
  ssh:
    install-server: true
    allow-pw: false
    authorized-keys:
      - ssh-ed25519 AAAA... [email protected]
  late-commands:
    - curtin in-target --target=/target -- systemctl enable ssh

What are the most common autoinstall pitfalls?

  • Unquoted colons in late-commands: Each entry under late-commands is a YAML string. A command containing : (such as curl -H "Authorization: Bearer ...") without outer quotes will be parsed as a YAML mapping and trigger Malformed autoinstall in 'late-commands'. Wrap the full command in single quotes or use a short bootstrap script.
  • Insufficient RAM for ISO download: Because url= downloads the Live Server ISO into tmpfs before mounting it, bare-metal nodes should have enough RAM (typically 4 GB or more for 24.04). Keep the ISO on a fast local HTTP mirror on the provisioning VLAN so transfer finishes in seconds.
  • Wrong storage.layout on multi-disk servers: On machines with NVMe + SATA drives or leftover RAID metadata, specify explicit match rules or wipe stale signatures instead of relying on default disk selection.

How do you verify an Ubuntu autoinstall before handing over the server?

An installation is not complete when the installer reboots. Confirm four checks after the host boots from local disk:

  1. Disk boot & kernel: Verify the server booted from its local disk rather than looping back into PXE.
  2. Static Netplan & DNS: Check ip addr and resolvectl status if late-commands or a first-boot agent wrote production Netplan configs.
  3. SSH & credentials: Test SSH login using the provisioned key or rotated root password, and verify no temporary bootstrap scripts remain on disk.
  4. APT sources: Run apt-get update to confirm internal or upstream package repositories resolve cleanly.

Tags: UbuntuAutoinstallCloud-InitSubiquityPXEiPXELinux provisioning

Questions worth asking first

Does Ubuntu 22.04 or 24.04 still support Debian Preseed?

No. Ubuntu Server switched from Debian Installer (Preseed) to Subiquity and cloud-init autoinstall starting in 20.04 LTS. Modern Ubuntu PXE deployments must use autoinstall user-data instead of preseed.cfg.

Why does Subiquity ignore my user-data and show the interactive installer?

The most frequent causes are missing the autoinstall kernel flag, wrapping ds=nocloud-net;s=... in quotes inside iPXE, a missing #cloud-config header on line 1 of user-data, or a 404 on meta-data.

Why do I get 'Malformed autoinstall in late-commands'?

YAML treats any unquoted ': ' sequence inside a list item as a key-value mapping. Wrap shell commands that contain headers, URLs, or colons in single quotes.

How do I keep credentials out of plain HTTP seed URLs?

Scope each seed URL to a short-lived single-use Task Token that is revoked as soon as the install finishes, and inject final SSH keys or root passwords via an authenticated post-install agent.

← All news