From ArchWiki
Jump to navigation Jump to search

arch-boxes builds vagrant and cloud images via Hashicorp packer. The vagrant images are going to be uploaded to, the cloud-images need to get signed manually and uploaded into a web directory.


We have the following requirements for building vagrant images and cloud-images via the arch-boxes project.

  • Virtualization support: egrep (vmx|svm) -o /proc/cpuinfo
  • Hypervisors installed: virtualbox, qemu
  • Hashicorp packer installed
Note: Use the arch-boxes Ansible role for deploying the project on a host. The role makes sure, that kernel modules are loaded, hypervisors and packer are installed and more


├── cloud.json (1)
├── (2)
├── (3)
├── http (4)
│  ├── (5)
│  ├── (6)
│  └── (7)
├── local.json (8)
├── packer_cache (9)
├── provision (10)
│  ├── (11)
│  ├── (12)
│  ├── (13)
│  ├── (14)
│  ├── (15)
│  ├── (16)
│  └── (17)
└── vagrant.json (18)
  1. The cloud.json file is the packer configuration for qcow2 cloud-images.
  2. is triggered via a systemd-timer unit every day and checks if a build needs to get triggered.
  3. is an abstraction layer for the testing environment and can be therefore ignored in production.
  4. The http directory contains all scripts for a basic installation.
  5. is all code that needs to get executed for vagrant images in the arch-mount during installation.
  6. is the installation script for the qcow2 cloud-images. It get's executed during arch-mount and replaces for cloud-images.
  7. is the code for partitioning the VM, making the filesystem and executing arch-mount.
  8. local.json is for third-party users only. You can ignore it in production.
  9. packer_cache is the cache directory of packer for saving ISOs etc (When a local mirror is used this directory should be empty)
  10. provision is a directory with additional provisioning scripts, these scripts get executed after the installation process.
  11. makes sure to remove man pages, pacman cache etc.
  12. installs cloud-init and enables all cloud-init services
  13. sets a hostname, timezone, locales and enables systemd-resolved.
  14. installs the qemu guest-agent.
  15. installs the virtualbox guest-agent.
  16. installs the vmware guest-agent.
  17. shrinks the VM image size via writing zeroes into a tmpfile. This is maybe harmful to your SSD.
  18. vagrant.json this is the packer configuration for building vagrant images and uploading them to the vagrantcloud.


If you need to run an image build manually, you can do so via:

packer build -parallel=false -var 'headless=true' -var 'write_zeroes=yes' -except=vmware-iso vagrant.json

This line will start a build process for virtualbox and qemu. If you need debugging output you need to add the following environment variable in front of the command: PACKER_LOG=1