Install Ubuntu Server With Autoinstall
Overview & Core Concepts
TL;DR. This guide explains how to automate the installation of Ubuntu Server 24.04 LTS (Unattended Autoinstall) using the
auto_installplugin from Ventoy and Cloud-Init (Subiquity). With this method, the OS installation on Mini PCs / Bare-metal Servers can run automatically from start to finish without manual interaction.
- Scope / Domain: Automated Server Provisioning, Unattended OS Installation, Homelab / Bare-metal Setup.
- Tech Stack Related: Ubuntu Server 24.04 LTS, Ventoy Auto Install Plugin, Cloud-Init / Subiquity (
user-data&meta-data), OpenSSL, LVM. - Target Use Case: Automated local server / Mini PC setup via USB Flash Drive without the need to manually enter hostname, username, password, or network configurations during the boot process.
Setup & Initial Configuration
1. Ventoy Flash Drive Folder Structure
Place the Ubuntu Server ISO and the autoinstall configuration folders on the root of a Ventoy-installed USB Flash Drive with the following structure:
| |
2. Generating Encrypted Password (SHA-512)
By default, user-data requires a password in SHA-512 hash format. Run the following command in a Linux/macOS terminal to generate the password hash:
| |
Output Result:
$6$xxxxxx$...(Copy this hash string into theidentity.passwordfield inuser-data).
Usage & Code Snippets
1. Mapping Configuration File: ventoy.json
Location: /ubuntu/ventoy/ventoy.json
This file tells Ventoy to automatically load the user-data template when the Ubuntu Server ISO is selected.
| |
2. Instance Metadata File: meta-data
Location: /ubuntu/autoinstall/meta-data
| |
3. Autoinstall Main Config File: user-data
Location: /ubuntu/autoinstall/user-data
| |
Troubleshooting & Known Issues
| Problem / Error | Cause | Solution / Workaround |
|---|---|---|
| LVM disk capacity truncated (only ~100GB) | By default, the Ubuntu Subiquity installer with storage.layout.name: lvm only allocates a max of 100 GB for the Logical Volume (ubuntu-lv), while the rest of the disk is left unallocated. | Run the following commands on the server after installation completes to extend the LV to the remaining disk space:sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lvsudo resize2fs /dev/ubuntu-vg/ubuntu-lv |
| Network Connection / Interface Not Detected | Network interface names in user-data (enp0s31f6 / wlp3s0) are hardcoded and might differ on each PC hardware. | Adjust the ethernet/Wi-Fi interface names according to the target device, or use generic DHCP/netplan configuration after the OS is installed. |
| SSH Login Failed with Password Hash | Entering plain-text password directly into the identity.password field without OpenSSL encryption. | Always generate a SHA-512 hash using openssl passwd -6 "YourPassword" before inserting it into user-data. |
| Ventoy Does Not Automatically Load Autoinstall | The ISO or template path in ventoy.json does not match the physical location on the USB Flash Drive. | Ensure the ISO and user-data template file locations in ventoy.json start with a slash / from the flash drive root. |
Best Practices & Pitfalls
- Do:
- Use
openssl passwd -6to encrypt user passwords before savinguser-data. - Perform LVM disk expansion (
lvextend) post-installation if using disk capacity > 100GB. - Verify network interface name compatibility (Ethernet / Wi-Fi) on target hardware.
- Use
- Don’t:
- Save plain-text passwords in the
user-datafile. - Change the
ventoy.jsonfolder location from the default path/ventoy/ventoy.jsonor/ubuntu/ventoy/ventoy.json.
- Save plain-text passwords in the