Ubuntu Server 20.04 autoinstall


  • Get the Ubuntu Live Server ISO file.
  • Prepare the autoinstall configuration file.
  • Prepare the boot commands.

Prepare autoinstall configuration file

autoinstall ds=nocloud-net;seedfrom=http://repo/files/ubuntu2004/
Simple web server, serving meta-data and user-data files

Example autoinstall user-data file

user-data file

Autoinstall gotchas

  • The comment line #cloud-config is important.
  • It’s best to stop the SSH service in the installer environment. Leaving it enabled can confuse packer into initiating SSH connection and failing the packer build after 10 failed attempts.
  • The network key needs to be nested twice, it is a bug.
  • The dhcp-identifier: mac was needed to stop the DHCP server from leasing another IP address to the same MAC address. This confused packer because on the next boot the VM could have a different IP address and packer would get stuck waiting to form an SSH connection to the VM.
  • The username: root is not supported in the identity section.
  • In the late-commands section, enable the ubuntu user to sudo without a password. This will make ansible playbooks more manageable and simpler.
  • In the late-commands section, if you update the grub file, make sure to run update-grub2 in the target filesystem afterwards. The curtin command needs to have a --target /target . The documentation fails to mention this correctly.
  • The default ubuntu-vg/ubuntu-lv configuration for the root filesystem is set to 4 GiB in size. You have to extend the logical volume and resize the filesystem in a post-install step.

Preparing your boot commands for automated OS installation

  1. At language selection click Enter key for the default English selection.
autoinstall net.ifnames=0 biosdevname=0 ip=dhcp ipv6.disable=1 ds=nocloud-net;s=http://repo/files/ubuntu2004/
  • net.ifnames=0 and biosdevname=0 is needed to revert the OS naming of interface names to older eth0, eth1 formats.
  • ip=dhcp enables the use of DHCP during the automated OS installation.
  • ipv6.disable=1 disables the use of IPv6 in the OS.
  • ds=nocloud-net;s=<url> is the cloud-init datasource options for nocloud-net. The seedfrom url’s trailing slash is important because cloud-init’s nocloud-net datasource does not prepend the forward slash when requesting the meta-data and user-data files on the web server.
Great success, now automate even the boot commands…


The root filesystem is only 4GiB after autoinstall?

The Ubuntu Live Server ISO is too fast for packer

chain http://repo.home.local/artifactory/files/ubuntu2004/ubuntu2004.ipxe
Ubuntu iPXE script

No Network Installer ISO?




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How I created a function in python

Editing made easy! 📽📹

hans123 intraday breakthrough strategy

Microservices — Event-driven and the hidden landmines

CF Camp 2018: Madness in Munich Part Three- The #1 Monitoring Solution for ColdFusion

UnityDefi Is Here!

Technical Analysis — Trend basics

AWS CDK custom resources for DynamoDB inserts

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


More from Medium

Debug Walkthrough: Exploiting SSH MOTD and PHP Deserialization

MAC address spoofing and YOU!

Zoom screen sharing on linux (Ubuntu & Fedora)