Debian cloud image with qemu guest agent
- HCL 53%
- Shell 47%
| .forgejo/workflows | ||
| http | ||
| scripts | ||
| .gitignore | ||
| debian.pkr.hcl | ||
| README.md | ||
| variables.pkr.hcl | ||
Debian Cloud Image Builder
Builds a minimal Debian stable (Trixie) amd64 qcow2 cloud image using Packer and QEMU, with CI/CD via Forgejo Actions.
What's included
- QEMU guest agent — enabled at boot
- cloud-init — handles SSH keys, user provisioning, network, and disk resize
- Serial console —
ttyS0at 115200 baud for hypervisor access - Minimal footprint, compressed qcow2 output
CI/CD — Forgejo Actions
Push a tag to trigger a build and publish:
git tag v1.0.0
git push origin v1.0.0
The workflow installs QEMU + Packer, builds the image, and uploads it as a Forgejo release with a SHA256 checksum.
Runner requirements
| Requirement | Notes |
|---|---|
KVM (/dev/kvm) |
Strongly recommended; falls back to software emulation |
| ~6 GB disk | ISO download + build output |
| Internet access | Fetches Debian ISO and packages |
Local build
# Install dependencies
sudo apt-get install -y qemu-system-x86 qemu-utils
# Install Packer (https://developer.hashicorp.com/packer/install)
packer init .
packer build .
# Output: output/debian-cloud-amd64.qcow2
Override variables as needed:
packer build -var disk_size=8G -var cpus=4 .
Variables
| Variable | Default | Description |
|---|---|---|
iso_url |
Debian stable netinst | URL to the installer ISO |
iso_checksum |
SHA256SUMS from cdimage.debian.org | Checksum or file: URL |
cpus |
2 | vCPUs for the build VM |
memory |
2048 | RAM in MB |
disk_size |
4G | Virtual disk size |
accelerator |
kvm | kvm or tcg (software) |
Note: When a new Debian point release ships, update
iso_urlinvariables.pkr.hclto match the new filename (e.g.debian-13.5.0-amd64-netinst.iso).