Contents

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_install plugin 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:

1
2
3
4
5
6
7
8
/ (Ventoy Flash Drive Root)
├── ubuntu-24.04-live-server-amd64.iso  <-- Ubuntu Server ISO file
└── ubuntu/
    ├── autoinstall/
    │   ├── meta-data                   <-- Initial instance/hostname identity
    │   └── user-data                   <-- Cloud-config & installation automation script
    └── ventoy/
        └── ventoy.json                 <-- ISO mapping to autoinstall script

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:

1
openssl passwd -6 "YourStrongPassword"

Output Result: $6$xxxxxx$... (Copy this hash string into the identity.password field in user-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.

1
2
3
4
5
6
7
8
{
  "auto_install": [
    {
      "image": "/ubuntu-24.04-live-server-amd64.iso",
      "template": "/ubuntu/autoinstall/user-data"
    }
  ]
}

2. Instance Metadata File: meta-data

Location: /ubuntu/autoinstall/meta-data

1
2
instance-id: ubuntu-autoinstall
local-hostname: changeme

3. Autoinstall Main Config File: user-data

Location: /ubuntu/autoinstall/user-data

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#cloud-config
autoinstall:
  version: 1

  apt:
    geoip: true
    preserve_sources_list: false
    primary:
    - arches: [ amd64, i386 ]
      uri: http://archive.ubuntu.com/ubuntu
    - arches: [ default ]
      uri: http://ports.ubuntu.com/ubuntu-ports

  identity:
    hostname: changeme
    realname: Changeme
    username: changeme
    password: changeme # Replace with output from: openssl passwd -6 "YourStrongPassword"

  ssh:
    install-server: true
    allow-pw: true
    authorized-keys: []

  keyboard:
    layout: us

  locale: en_US

  storage:
    layout:
      name: lvm
      sizing-policy: all

  network:
    version: 2
    ethernets:
      enp0s31f6:
        dhcp4: true

    wifis:
      wlp3s0:
        dhcp4: true
        access-points:
          "Your WiFi SSID":
            password: "yourwifipassword"

  packages:
  - curl

  late-commands:
  - curtin in-target -- apt update
  - curtin in-target -- systemctl enable ssh

Troubleshooting & Known Issues

Problem / ErrorCauseSolution / 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-lv
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
Network Connection / Interface Not DetectedNetwork 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 HashEntering 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 AutoinstallThe 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 -6 to encrypt user passwords before saving user-data.
    • Perform LVM disk expansion (lvextend) post-installation if using disk capacity > 100GB.
    • Verify network interface name compatibility (Ethernet / Wi-Fi) on target hardware.
  • Don’t:
    • Save plain-text passwords in the user-data file.
    • Change the ventoy.json folder location from the default path /ventoy/ventoy.json or /ubuntu/ventoy/ventoy.json.