Image was built using Debian 12, kernel 6.1.0-50-cloud-amd64, Docker version 29.6.1, build 8900f1d Built date is 12/07/2026 Here, an existing rolling release ISO is modified to include qemu-guest-agent and to be CloudInit capable instead of building the whole QCOW2 image from the ground up. First download the prerequisites ```bash sudo apt update sudo apt install -y \ git \ make \ qemu-system-x86 \ qemu-utils \ wget \ gpg \ lsb-release ``` Install Packer from HashiCorp’s repository ```bash wget -O - https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor \ -o /usr/share/keyrings/hashicorp-archive-keyring.gpg echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \ https://apt.releases.hashicorp.com \ $(grep -oP '(?<=UBUNTU_CODENAME=).*' /etc/os-release || lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list sudo apt update sudo apt install -y packer ``` Verify everything ```bash packer version qemu-system-x86_64 --version qemu-img --version test -e /dev/kvm && echo "KVM available" || echo "KVM unavailable" egrep -m1 '(vmx|svm)' /proc/cpuinfo ``` # Clone packer-vyos ```bash ISO_SOURCE="./vyos-2026.03-generic-amd64.iso" VM_NAME="$(basename "$ISO_SOURCE" .iso)" cp "$ISO_SOURCE" "iso/${VM_NAME}.iso" ``` Create and verify checksums ```bash cd iso sha256sum "${VM_NAME}.iso" > SHA256SUM cd .. cat iso/SHA256SUM sha256sum -c iso/SHA256SUM ``` First, remove the VyOS current repository from the temporary APT source used by Packer ```bash sed -i \ '\|dev.packages.vyos.net/repositories/current|d' \ http/debian_12-vyos.list ``` Now replace the script that normally reinstalls Cloud-Init ```bash cat > scripts/vyos/cloud-init-vyos.sh <<'EOF' #!/bin/bash set -euo pipefail set -x if [[ "${CLOUD_INIT:-}" != "vyos" ]]; then echo "VyOS Cloud-Init preservation not requested; skipping" exit 0 fi # Fail rather than silently replacing the Stream ISO's Cloud-Init package. if ! dpkg-query -W -f='${Status}\n' cloud-init 2>/dev/null | grep -qx 'install ok installed'; then echo "ERROR: The installed VyOS image does not contain cloud-init." exit 1 fi # Enable the existing VyOS-patched Cloud-Init installation. systemctl enable cloud-init.service # Do not let generic Cloud-Init networking conflict with VyOS interface # configuration. Interfaces will be configured using vyos_config_commands. mkdir -p /etc/cloud/cloud.cfg.d cat > /etc/cloud/cloud.cfg.d/99-disable_network_config.cfg <<'CFG' network: {config: disabled} CFG # Match the image-builder behaviour: do not execute generic config-stage # modules. VyOS-specific user-data processing remains available. cat > /etc/cloud/cloud.cfg.d/90-disable_config_stage.cfg <<'CFG' cloud_config_modules: CFG rm -f /etc/network/interfaces.d/50-cloud-init EOF chmod +x scripts/vyos/cloud-init-vyos.sh ``` The repository normally installs vim and net-tools during stage two. They are unnecessary for this image, so make that script a no-op ```bash cat > scripts/vyos/apt-install.sh <<'EOF' #!/bin/bash set -euo pipefail echo "Skipping optional vim and net-tools installation" EOF chmod +x scripts/vyos/apt-install.sh ``` The Makefile checks specifically for **local-vyos-1.5.pkrvars.hcl**, not merely **local.pkrvars.hcl**, so create it ```bash cat > local-vyos-1.5.pkrvars.hcl < .env <<'EOF' PACKER_LOG=1 PARALLEL_BUILDS=1 SLEEP_BEFORE_SHUTDOWN=0 # Leave these unset so Packer selects available ports. # VNC_PORT_FIXED= # HOST_PORT_FIXED= EOF ``` Initialize Packer. The target initializes the QEMU plugin for all supported templates ```bash make init ``` Optional validation ```bash packer validate \ -var-file=local-vyos-1.5.pkrvars.hcl \ vyos-image1-1.5.pkr.hcl packer validate \ -var-file=local-vyos-1.5.pkrvars.hcl \ vyos-image2-1.5.pkr.hcl ``` Build stage one make build1-1.5