A lightweight build pipeline that creates ready-to-use Vagrant boxes for the libvirt provider. The images are built from scratch on Debian stable using mkosi, then packaged as distributable .box archives and published to a Forgejo package registry.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Sebastian Schulz 2430f6531a
All checks were successful
Build Vagrant Images / build-and-push (push) Successful in 3m40s
bump: 26.12.0
2026-12-01 00:01:01 +00:00
.devcontainer build(devcontainer): update devcontainer base image 2026-06-26 01:30:18 +02:00
.forgejo/workflows build(vagrant): Replace Makefile with mise tasks 2026-10-09 15:15:58 +00:00
rescue fix(rescue): adjust root partition size 2026-11-06 17:16:34 +00:00
vagrant bump: 26.12.0 2026-12-01 00:01:01 +00:00
.gitignore chore: ignore VARS.fd 2026-11-06 17:16:34 +00:00
AGENTS.md refactor(rescue): prefix systemd drop-in files with a number 2026-11-06 17:16:34 +00:00
LICENSE Initial commit 2026-06-19 10:17:40 +00:00
mise.toml fix(rescue): ship no console= in the kernel cmdline 2026-11-06 17:16:34 +00:00
opencode.jsonc refactor(opencode.jsonc): adjust permission levels in JSONC 2026-11-06 17:16:34 +00:00
README.md refactor(rescue): let mkosi find its own repart directory 2026-11-06 17:16:34 +00:00
Vagrantfile feat: add Vagrantfile for dev stack 2026-06-25 22:51:35 +00:00

sebatec-images

Reproducible Debian images — Vagrant boxes and a rescue stick, built with mkosi

Two images, both built from scratch on Debian Trixie with mkosi:

  • Vagrant boxes for the libvirt provider, packaged as .box archives and published to a Forgejo package registry.
  • A rescue stick that boots a laptop that will no longer start, with the disk, recovery, encryption and backup tools needed to fix it. See rescue/README.md.

Note

Versions follow YY.MM.PP format and are tracked in vagrant/mkosi.version. Use mkosi bump to increment before a new release.

Features

  • Reproducible builds — Fully deterministic image generation from Debian stable
  • Minimal footprint — Optimized with systemd-boot, ext4 root, and ESP partitions
  • Vagrant-ready — Pre-configured vagrant user with insecure key and passwordless sudo
  • Cloud-native — Cloud-init, systemd-networkd (DHCP on eth0), and SSH pre-enabled
  • Versioned releases — Automatic semantic versioning with mkosi bump
  • One-step packaging — Converts raw images to .box archives with metadata
  • Registry publishing — Direct upload to Forgejo package registry
  • Rescue image — Bootable USB stick with btrfs snapshots for updates, apt upgrade inside Trixie, and secrets injected during the build

Project Structure

.
├── mise.toml                        # Build dependency declarations (apt)
├── opencode.jsonc                   # Agent guardrails around secret files
│                                    #   and the test fixtures beside them
├── Vagrantfile                      # Local development box (libvirt + sshfs)
├── rescue/
│   ├── mise-tasks/                  # Build tasks (build, clean)
│   ├── mkosi.conf                   # Image configuration (Debian trixie, btrfs root)
│   ├── mkosi.repart/                 # Partition scheme, consumed by mkosi
│   ├── mkosi.extra/                 # Overlay files (bashrc, networking, wpa, udev)
│   ├── mkosi.postinst.chroot        # Post-installation hook (directory modes)
│   ├── mkosi.bump                   # Version bump script
│   ├── mkosi.version                # Current version file
│   ├── write.sh                     # Writes the image to /dev/sdX (no mise)
│   ├── test.sh                      # Builds the image, boots it in QEMU and checks it
│   ├── tests/fixtures/secrets/      # Generated stand-ins, the default build input
│   └── README.md                    # Setup, secrets, update and rollback
└── vagrant/
    ├── mise-tasks/                  # Build tasks (build, clean, upload)
    ├── mkosi.conf                   # Image configuration (Debian stable)
    ├── mkosi.repart/                # Partition scheme (ESP, BIOS, root)
    ├── mkosi.extra/                 # Overlay files (sudoers, networking, SSH keys)
    ├── mkosi.postinst.chroot        # Post-installation hook (vagrant user setup)
    ├── mkosi.postoutput             # Post-output hook (raw → qcow2 → .box)
    ├── mkosi.bump                   # Version bump script
    ├── mkosi.version                # Current version file
    └── Vagrantfile.libvirt          # Bundled Vagrantfile for packaged boxes

Prerequisites

  • mise, to run the tasks
  • Linux host with KVM support
  • curl, for publishing
  • For publishing: Forgejo API token (PACKAGE_API_TOKEN)

On an apt host, mise bootstrap installs the build dependencies declared in mise.toml: mkosi (>= 26), qemu-utils, qemu-system-x86, ovmf, jq, dosfstools, e2fsprogs, systemd-boot, systemd-repart, mmdebstrap and util-linux. It skips packages that are already installed and uses sudo when needed.

mise bootstrap

Quick Start

Build

cd vagrant
mise run build       # Build and package the Vagrant box
mkosi bump           # Advance version to YY.MM.<patch+1>
mise run clean       # Remove build artifacts

Output artifacts are written to vagrant/mkosi.output/. The mkosi-produced artifacts are named after the codename:

  • debian-trixie-<version>.raw — Raw disk image
  • debian-trixie-<version>.efi, .vmlinuz, .initrd — Boot artifacts

The packaged box keeps -stable-:

  • debian-stable-<version>.box — Vagrant box (qcow2 + metadata)
  • debian-stable-<version>.img — Unpacked box image

Note

The codename/stable mismatch is deliberate and load-bearing: the registry path depends on it.

Test Locally

Add and boot the generated box:

cd vagrant/mkosi.output
vagrant box add debian-stable debian-stable-<version>.box
vagrant up

Or use the repository root Vagrantfile, which automatically discovers the debian-stable box:

vagrant up

Publish to Forgejo

cd vagrant
export PACKAGE_API_TOKEN=<your-forgejo-token>
export API_URL=https://forge.sebatec.eu/api
mise run upload

The box will be published to:

${API_URL}/packages/sebatec-eu/vagrant/debian-stable/<version>/libvirt.box

Warning

Publishing requires PACKAGE_API_TOKEN to be set. The upload task refuses to run without it.

Rescue image

A bootable USB stick for a laptop that no longer boots. Not published anywhere — you build it, write it to a stick and carry it.

cd rescue
mise run build                        # debian-rescue-<version>.raw in mkosi.output/
mise run build -- /srv/rescue-secrets # same, with your own secrets
sudo ./write.sh /dev/sdX              # put it on a stick

The console logs in as root without a password. Two partitions, no fstab: systemd-gpt-auto-generator finds the ESP and the btrfs root by their GPT type UUID. Updates are a btrfs snapshot plus apt upgrade, and the rollback boots the snapshot.

The build takes its secrets from the directory you name and puts them in the image; without an argument it uses the inert stand-ins in rescue/tests/fixtures/secrets/.

rescue/README.md has the full setup, the update and rollback commands, and the caveats (UEFI only, unencrypted, no password).

Versioning

Versions follow YY.MM.PP (year / month / patch):

See vagrant/mkosi.bump for implementation details.

Customizing the image