Proxmox VE VM Creation and Ubuntu 26.04 Unattended Installation: A Practical Guide
Proxmox VE VM Creation and Ubuntu 26.04 Unattended Installation: A Practical Guide
Creating virtual machines and installing operating systems are among the most fundamental and frequent tasks in server operations and maintenance. While traditional interactive installation via VNC or IPMI is intuitive, it is inefficient—especially when deploying multiple servers in batches. This article provides a detailed walkthrough of how to leverage Proxmox VE (PVE) combined with Cloud-init technology to achieve fully automated unattended installation of Ubuntu 26.04 Server.
Background and Requirements
As a DevOps engineer, I frequently need to rapidly provision virtual machines in test environments. Interactive installation via VNC is time-consuming and prone to human error leading to inconsistent configurations. Therefore, I sought to establish a standardized workflow for VM creation and OS installation that is:
- Standardized: All VMs use a unified configuration template
- Automated: No manual intervention from creation to installation
- Repeatable: Quickly provision any number of VMs
- Traceable: Complete audit trail for every creation
This article documents the complete实践 (practice) process, including encountered issues and their solutions.
Environment Overview
The environment for this operation is a Proxmox VE 9.0 virtualization server running on a local area network. Key configuration details:
- Virtualization Platform: Proxmox VE 9.0
- Storage Type: LVM-thin (local SSD storage)
- Network Mode: Bridge mode (bridge vmbr0)
- ISO Storage: CIFS shared storage (for system images)
- Target OS: Ubuntu 26.04 LTS Server
Note: All sensitive information including IP addresses and hostnames has been redacted in this article. Only technical details are provided for reader reference.
Solution Selection
Before starting, I evaluated three common automated installation approaches:
Option 1: PVE Native Cloud-init Support
Advantages:
- Native PVE support, deeply integrated with VM configuration
- Supports customizable username, password, network configuration
- Complete unattended installation with AutoYAML
Disadvantages:
- Requires additional Cloud-init data volume creation
- Relatively complex configuration, requires understanding Cloud-init data structures
Option 2: Terraform + PVE Provider
Advantages:
- Infrastructure as Code (IaC) capability
- Supports large-scale batch deployment
- Version control friendly
Disadvantages:
- Requires additional Terraform installation and configuration
- Steeper learning curve, better suited for large-scale operations
Option 3: PXE Network Boot
Advantages:
- No additional media required, high automation
- Suitable for large-scale batch installation
Disadvantages:
- Requires PXE server configuration
- More complex network setup in current environment
After considering the actual project requirements and tech stack, I selected Option 1: Using PVE’s native Cloud-init functionality combined with Ubuntu’s autoinstall technology for unattended installation.
Implementation Steps
Step 1: Prepare Ubuntu 26.04 Installation Image
First, obtain the Ubuntu 26.04 Server installation image. Ubuntu 26.04 is an upcoming LTS release (still in development at time of writing), and its server edition provides complete autoinstall support.
# Check ISO directory on PVE storage
ls -la /mnt/pve/dsm10-iso/template/iso/ | grep ubuntu
Common ISO naming conventions:
ubuntu-26.04-live-server-amd64.iso— Desktop version (with GUI)ubuntu-26.04-live-server-amd64.iso— Server version (used in this article)
After uploading the downloaded ISO file to PVE’s ISO storage directory, you can begin creating the virtual machine.
Step 2: Create the Virtual Machine
There are two ways to create VMs on PVE: via Web UI or command line. For batch operations or scripting scenarios, the command line is more efficient.
First, let’s look at the reference VM (VM 4519) configuration:
# View reference VM configuration
qm config 4519
Key configuration items include:
| Config Item | Value | Description |
|---|---|---|
ostype |
l26 |
Linux kernel 2.6+ |
bios |
ovmf |
UEFI boot |
cores |
2 |
CPU core count |
cpu |
x86-64-v2-AES |
CPU type |
memory |
4096 |
Memory size (MB) |
scsi0 |
local-lvm:vm-4519-disk-1,size=20G |
Primary disk |
efidisk0 |
local-lvm:vm-4519-disk-0,size=4M |
EFI partition |
sata0 |
local-lvm:vm-4519-cloudinit |
Cloud-init volume |
net0 |
virtio=xx:xx:xx:xx:xx:xx,bridge=vmbr0 |
Network config |
Since PVE’s qm create command cannot directly specify disk volumes to associate (they must exist first), a workaround is using the qm clone command to clone from an existing VM.
# Clone reference VM
qm clone 4519 4526 --name "VM-Ubuntu26.04-20G" --full
This command will:
- Create new VM ID (4526)
- Clone all disks (EFI disk, system disk, Cloud-init volume)
- Copy base configuration (CPU, memory, network, etc.)
After cloning, modify the VM configuration for new requirements:
# Modify VM name and tags
qm set 4526 --name "VM-Ubuntu26.04-20G" --tags ubuntu26.04
# Configure Cloud-init user (username)
qm set 4526 --ciuser margrop
# Configure Cloud-init password (password: xc112vm)
qm set 4526 --cipassword xc112vm
# Mount Ubuntu 26.04 ISO as installation medium
qm set 4526 --ide2 /mnt/pve/dsm10-iso/template/iso/ubuntu-26.04-live-server-amd64.iso,media=cdrom
# Set boot order: ISO first for installation, then disk after
qm set 4526 --boot order="ide2;scsi0"
Note: Cloned VMs replicate all disk contents from the source VM. If the source VM has an OS installed, cloned disks will still contain the original system data. For fresh installations, ensure cloning from a blank system or use alternative methods to create blank disks.
Step 3: Configure Cloud-init for Unattended Installation
Ubuntu Server 20.04 and later support fully automated OS installation through autoinstall technology. Combined with Cloud-init, you can achieve:
- Automatic username and password configuration
- Automatic network configuration (DHCP or static IP)
- Automatic partitioning and LVM configuration
- Automatic software package installation
- Automatic post-installation script execution
First, create Cloud-init configuration files. Cloud-init uses YAML format, primarily including user-data (user configuration) and meta-data (instance metadata) files.
user-data Configuration Example:
#cloud-config
autoinstall:
version: 1
identity:
hostname: ubuntu
username: margrop
password: $6$v/wBNKhSNqXsLSTw$6V6Um5Jot07v2LJGyRtFHlqDYgzzbQGn9...
ssh:
install-server: true
allow-pw: true
storage:
layout:
name: lvm
guipart: use-existing
packages:
- openssh-server
- qemu-guest-agent
- vim
- net-tools
- curl
- wget
late-commands:
- systemctl enable qemu-guest-agent
Configuration Items Explained:
| Config Item | Description |
|---|---|
identity.hostname |
System hostname |
identity.username |
Initial username |
identity.password |
User password (SHA-512 encrypted) |
ssh.install-server |
Install SSH server |
ssh.allow-pw |
Allow password authentication |
storage.layout.name |
Partition layout scheme, lvm for LVM |
packages |
Additional packages to install |
late-commands |
Commands to execute after installation |
Generating encrypted password:
# Generate SHA-512 encrypted password using openssl
openssl passwd -6 xc112vm
meta-data Configuration:
instance-id: ubuntu26-4526
local-hostname: ubuntu
Step 4: Create Cloud-init ISO
Cloud-init needs to be passed to the installer via ISO medium. The ISO file must meet these requirements:
- Volume Label must be
CIDATA - Contains both
user-dataandmeta-datafiles - Filesystem format: ISO9660 (Rock Ridge extension) or Joliet
Creating Cloud-init ISO on macOS or Linux:
Method 1: Using genisoimage (Recommended)
# Execute on PVE or Linux server
genisoimage -o cloudinit-4526.iso \
-V CIDATA \
-J \
-r \
/path/to/cloud-init-files/
Method 2: Using hdiutil (macOS)
cd /path/to/cloud-init-files
hdiutil makehybrid -o autoinstall.iso . -iso -joliet
After creation, upload the ISO to PVE storage:
# Upload to PVE
scp cloudinit-4526.iso root@<PVE-IP>:/mnt/pve/dsm10-iso/template/iso/
Step 5: Configure VM Boot and Execute Installation
Add Cloud-init ISO as the VM’s second CD-ROM drive and adjust boot order:
# Add Cloud-init ISO as second CD-ROM (ide3)
qm set 4526 --ide3 /mnt/pve/dsm10-iso/template/iso/cloudinit-4526.iso,media=cdrom
# Set boot order: ISO -> Cloud-init -> Disk
qm set 4526 --boot order="ide2;ide3;scsi0"
# Start VM
qm start 4526
After starting, the Ubuntu installer will automatically detect the CIDATA volume and execute unattended installation. The entire process requires no manual intervention, taking approximately 5-15 minutes (depending on network speed and hardware configuration).
Common Issues and Solutions
Issue 1: Insufficient Disk Space After Cloning
Error Message:
Volume group "pve" has insufficient free space
Cause: PVE uses LVM-thin storage pool. Cloning requires allocating new logical volumes. If storage pool space is insufficient, creation will fail.
Solutions:
-
Clean up unused VMs and old snapshots
# Delete unnecessary VMs qm destroy <vmid> # Delete old snapshots qm delsnapshot <vmid> <snapshot-name> -
Expand LVM-thin storage pool
# Add new physical volume pvcreate /dev/sdX # Extend volume group vgextend pve /dev/sdX # Extend logical volume lvextend -L +XXXG /dev/pve/data -
Consider using Thin Provisioning mode
Issue 2: Cloud-init ISO Not Recognized
Symptom: After VM boots from ISO, interactive installation screen still appears.
Causes:
- ISO volume label is not
CIDATA - Incorrect file structure
- Incorrect boot order settings
Solutions:
-
Verify ISO volume label
# Linux/PVE volid /dev/srX # macOS diskutil info /dev/diskX | grep "Volume Name" -
Check ISO content structure
# Mount ISO and inspect mount -o loop cloudinit.iso /mnt ls -la /mnt -
Ensure correct boot order
qm set <vmid> --boot order="ide2;ide3;scsi0"
Issue 3: Cannot SSH After Installation
Symptom: Installation completes normally but cannot connect via SSH after.
Possible Causes:
- SSH service not installed or not started
- Firewall blocking SSH connections
- Network configuration error (cannot obtain IP)
- Incorrect password format in configuration
Solutions:
-
Ensure openssh-server is installed in Cloud-init configuration
packages: - openssh-server ssh: install-server: true allow-pw: true -
Check VM console logs
# View VM startup logs qm terminal <vmid> -
Verify password format in Cloud-init configuration
# Regenerate password in correct format openssl passwd -6 <password>
Automation Script Wrapper
To facilitate future rapid VM creation, I encapsulated the entire process into a script:
#!/bin/bash
# create_vm.sh - PVE VM Quick Creation Script
set -e
VM_ID=${1:-}
VM_NAME=${2:-}
ISO_PATH=${3:-}
USER_NAME=${4:-}
USER_PASS=${5:-}
if [ -z "$VM_ID" ] || [ -z "$VM_NAME" ] || [ -z "$ISO_PATH" ]; then
echo "Usage: $0 <vm-id> <vm-name> <iso-path> [user] [password]"
exit 1
fi
USER_NAME=${USER_NAME:-margrop}
USER_PASS=${USER_PASS:-xc112vm}
# Clone reference VM (requires reference VM to be created and configured first)
qm clone 4519 ${VM_ID} --name "${VM_NAME}" --full
# Configure VM
qm set ${VM_ID} --ciuser ${USER_NAME}
qm set ${VM_ID} --cipassword ${USER_PASS}
qm set ${VM_ID} --ide2 ${ISO_PATH},media=cdrom
qm set ${VM_ID} --boot order="ide2;scsi0"
# Create Cloud-init ISO
# ... (Cloud-init configuration generation code)
# Start VM
qm start ${VM_ID}
echo "VM ${VM_ID} created and started successfully!"
Usage example:
./create_vm.sh 4527 "VM-Ubuntu26.04-Test" \
/mnt/pve/dsm10-iso/template/iso/ubuntu-26.04-live-server-amd64.iso \
margrop xc112vm
Conclusion and Future Work
Through this article’s实践, we successfully implemented a complete workflow for creating VMs on Proxmox VE and automating Ubuntu 26.04 Server installation. Key takeaways include:
-
Understood PVE VM creation mechanisms: Command-line provides more flexible control over VM creation aspects
-
Mastered Cloud-init and autoinstall integration: Core technology for Ubuntu unattended installation
-
Learned troubleshooting for common issues: Including insufficient storage space, ISO recognition problems, etc.
Areas for future optimization:
- Integrate Terraform for Infrastructure as Code
- Build PXE network boot environment for media-less installation
- Establish VM template library for further deployment efficiency
- Integrate Ansible for configuration management automation
I hope this article helps运维 engineers with similar requirements. If you have any questions or suggestions, please feel free to discuss in the comments.
References
- Ubuntu Autoinstall Documentation
- Cloud-init Documentation
- Proxmox VE QEMU/Guest Agent
- Ubuntu 26.04 Release Schedule
First published on 2026-04-25