Ubuntu autoinstall is only designed and working for Ubuntu Server installs, not Ubuntu Desktop installs. However, if you want a Desktop GUI on your server, you can simply install the
ubuntu-desktop package after the system is built. Keep in mind some configurations will be different since that desktop would be based off of the Ubuntu Server image. I tried installing such packages during the autoinstall, but that feature did not work very well.
Most instruction in this 'How To' are focused in the bash terminal.
$ mkdir autoinstall $ cd autoinstall
Download the Ubuntu 22 Server ISO.
Copy the downloaded file to your working directory, e.g.:
$ cp ~/Downloads/ubuntu-22.04.2-live-server-amd64.iso source.iso
One way to configure autoinstall is to first do an interactive install. When you do an interactive install of Ubuntu Server 22, it will create a
/var/log/installer/user-data file that captures all of the choices you made during the install. That file can be used with autoinstall to automatically make those same choices for future installs.
user-data file below has an encrypted password hash displayed. The encrypted password is
#cloud-config autoinstall: apt: disable_components:  geoip: true preserve_sources_list: false primary: - arches: - amd64 - i386 uri: http://us.archive.ubuntu.com/ubuntu - arches: - default uri: http://ports.ubuntu.com/ubuntu-ports drivers: install: false identity: hostname: tmp-autoinstall password: $6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0 realname: Robot username: ubuntu kernel: package: linux-generic keyboard: layout: us toggle: null variant: '' locale: en_US.UTF-8 network: version: 2 ethernets: alleths: match: name: e* dhcp4: true source: id: ubuntu-server search_drivers: false ssh: allow-pw: true authorized-keys:  install-server: true storage: layout: name: lvm updates: security version: 1
Of course, you can also make changes to this file to suit your needs, or you can create one from scratch guided by the docs: https://ubuntu.com/server/docs/install/autoinstall
user-data file here in your working directory.
livefs-editor to create the autoinstall ISO image.
$ sudo apt -y install git xorriso squashfs-tools python3-debian gpg liblz4-tool python3-pip $ git clone https://github.com/mwhudson/livefs-editor $ cd livefs-editor/ $ sudo python3 -m pip install . $ cd ..
At this stage of the process, there are two choices:
If you want to fully automate, and remove that confirmation step, there is a different option to use for the
If you are opting for the unsafe option below, then you can skip the
grub.cfg file here because the
livefs-edit command will sufficiently edit the existing
These steps (8A), with the blue border, are for the safe option. If you want the safe option, then skip the steps with the yellow border. If you want the unsafe option (8B), then skip the steps with the blue border.
8A. Safe option:
You can create the
The following command makes a "safe" USB stick because it requires you to confirm by typing "yes" before it starts writing to disk.
SAFE USB -- because the install asks for confirmation.
$ sudo livefs-edit source.iso UbuntuAutoinstall.iso --shell --cp /home/$USER/autoinstall/user-data new/iso/CIDATA/user-data --cp /home/$USER/autoinstall/grub.cfg new/iso/boot/grub/grub.cfg
If the above command fails to find the
At the prompt, run the following two commands, then hold the control key pressed and hit the "D" key.
# mkdir new/iso/CIDATA # touch new/iso/CIDATA/meta-data
8B. UNSAFE!! -- because the install does not ask for confirmation.
$ sudo livefs-edit source.iso UbuntuAutoinstall.iso --add-autoinstall-config /home/$USER/autoinstall/user-data
If the above command fails to find the
$ sudo umount /dev/sdg /dev/sdg1
Be absolutely sure the device file, e.g.,
/dev/sdg, you type below is the USB stick you found in step 9 above, or you will destroy your file system.
$ sudo dd bs=4M if=UbuntuAutoinstall.iso of=/dev/sdg conv=fdatasync status=progress
From my experience, the progress indicator is inconsistent and unreliable. So, if you see nothing, just wait for the prompt to return. If you see some progress indicator, don't believe it.
After you get the prompt back, take this USB stick and insert it in the system you want to install and power on. If the boot configuration is set to boot from USB, then it will load the grub menu that says "Autoinstall Ubuntu" as the only menu item. You can either wait for the 10 seconds to time out, or hit enter to choose the default. It will load the installer system, then ask you to type "yes" to confirm before it starts writing to disk. If you take a lunch break and come back, it might be asking you to type "yes" again. This means it rebooted and was still set to prefer booting from USB. So, you can just power it off, unplug the USB, and power it on again to boot from your newly installed boot drive.
There are more details in the web pages below, however, I found much of the instructions did not work. So, I wrote this blog article to document at least one way that actually works.
Ubuntu, and the Ubuntu logo, are registered trademarks of Canonical.