Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Stefan Bethke 464e91e5ae
All checks were successful
CI / test (push) Successful in 2m7s
Release / build-binaries (amd64, linux) (push) Successful in 2m43s
CI / cross-build (amd64, linux) (push) Successful in 1m33s
Release / release (push) Successful in 51s
Wait for the nbd device size to propagate before partitioning it
qemu-nbd --connect returns as soon as the NBD handshake completes, but
the kernel picks up the export's size asynchronously, about a second
later. sgdisk run immediately after connecting was observed to see a
0-sector disk and fail every time (confirmed by hand: blockdev
--getsize64 reads 0 right after connect, then the real size shortly
after). AttachNBD now polls /sys/class/block/nbdN/size until it's
nonzero before handing the device back.

Found by running a real build (custom/debian.yaml, with and without
--compress) after the qemu-nbd migration in 43ca31f — v1.0.12 fails on
essentially every build without this fix.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018JYhRkHmARjxFQi8tayFLb
2026-09-06 17:53:49 +00:00
.forgejo/workflows Switch docs theme to mkdocs-material 2026-09-04 21:53:21 +00:00
docs Build directly on qcow2 via qemu-nbd, skipping the raw->qcow2 conversion 2026-09-06 17:01:26 +00:00
example-specs Unify file/contents/url naming across copy, run, include, and gpg-key 2026-09-06 11:02:39 +00:00
internal Wait for the nbd device size to propagate before partitioning it 2026-09-06 17:53:49 +00:00
.gitignore Initial version 2026-09-04 08:06:17 +00:00
go.mod Initial version 2026-09-04 08:06:17 +00:00
go.sum Initial version 2026-09-04 08:06:17 +00:00
LICENSE Initial version 2026-09-04 08:06:17 +00:00
main.go Build directly on qcow2 via qemu-nbd, skipping the raw->qcow2 conversion 2026-09-06 17:01:26 +00:00
mkdocs.yml Switch docs theme to mkdocs-material 2026-09-04 21:53:21 +00:00
nfpm.yaml Build and publish a .deb in the release workflow 2026-09-04 08:34:56 +00:00
README.md Split rationale into a new design.md, trim the two main docs 2026-09-04 11:11:39 +00:00

PVE Template Builder

PVE Template Builder creates VM templates in a Proxmox Virtual Environment cluster. It uses a specification file that specifies the way the disk image is built, including packages to install, configuration adjustments, and shell-based customizations, and it specifies the VM parameters. This project has been developed with the help of generative AI.

Documentation

  • docs/building-template.md — the full build sequence, host requirements, command-line flags, and how each step (including debootstrap and the optional local mirror) is actually executed.
  • docs/template-spec.md — reference for every option in the specification file.
  • docs/design.md — the reasoning behind non-obvious choices in the two documents above.

Installation

Download a release for Linux/amd64 — currently the only platform built — from Releases:

  • .deb: apt install ./pve-template-builder-<version>-amd64.deb. This also pulls in every tool pve-template-builder needs at build time (see Requirements) automatically, via the package's own apt dependencies.
  • .tar.gz: a plain binary — extract it onto $PATH yourself, then install those tools by hand (see Quick start below).

Or build from source (Go 1.26+): go build ., same manual tool installation as the .tar.gz path above.

Quick start

apt install debootstrap gdisk dosfstools e2fsprogs qemu-utils apt-move apt-utils
sudo pve-template-builder spec.yaml

pve-template-builder must run as root (loop devices, mounts and chroot all require it). See docs/building-template.md for the full requirements list and what each tool is used for.