.box archives and published to a Forgejo package registry.
- Shell 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
All checks were successful
Build Vagrant Images / build-and-push (push) Successful in 3m40s
|
||
| .devcontainer | ||
| .forgejo/workflows | ||
| rescue | ||
| vagrant | ||
| .gitignore | ||
| AGENTS.md | ||
| LICENSE | ||
| mise.toml | ||
| opencode.jsonc | ||
| README.md | ||
| Vagrantfile | ||
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
.boxarchives 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.PPformat and are tracked in vagrant/mkosi.version. Usemkosi bumpto 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
vagrantuser 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
.boxarchives with metadata - Registry publishing — Direct upload to Forgejo package registry
- Rescue image — Bootable USB stick with btrfs snapshots for updates,
apt upgradeinside 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 imagedebian-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_TOKENto be set. Theuploadtask 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):
- Patch counter resets to
0each month - Otherwise increments automatically
- Use
mkosi bumpto advance the version in vagrant/mkosi.version or rescue/mkosi.version
See vagrant/mkosi.bump for implementation details.
Customizing the image
- Packages — edit the
Packages=list in vagrant/mkosi.conf - Partitions — adjust the
SizeMinBytes/SizeMaxBytesentries in vagrant/mkosi.repart/ - Overlay files — drop content under vagrant/mkosi.extra/ (it is copied into the image as-is)
- First-boot commands — extend vagrant/mkosi.postinst.chroot
- Box metadata — modify the provider block in vagrant/Vagrantfile.libvirt