Skip to content

Imagecraft

Richard Spindler edited this page Oct 4, 2026 · 1 revision

Imagecraft Examples

Instead of downloading a cloud image, Chausie can build an Ubuntu image locally with imagecraft by using --vmtype imagecraft. The script generates the imagecraft YAML file, runs imagecraft pack (inside a multipass VM), and converts the result to qcow2. The image is saved in the releases directory as <os>-<release>-<name>-imagecraft-<arch>.img and is only built if it doesn't already exist.

Build an image only:

./chausie.sh --action createimage --name test --release 24.04 --vmtype imagecraft

Build the image if needed, and create a VM from it:

./chausie.sh --action createvm --name test --release 24.04 --vmtype imagecraft

Dryrun

Write the YAML to /tmp and print the commands without running them:

./chausie.sh --action createimage --name test --release 24.04 --vmtype imagecraft --options dryrun

Sizes

--imagesize (image, default 10G), --rootsize or --size (VM disk, default 20G), --bootsize (EFI partition, default 512M), and --swapsize:

./chausie.sh --action createvm --name test --release 24.04 --vmtype imagecraft \
  --imagesize 20G --size 50G

Networking

DHCP is used if --options dhcp is given, or if no --ip is given:

./chausie.sh --action createvm --name test --release 24.04 --vmtype imagecraft --options dhcp

Otherwise a static netplan config is built from --ip, --cidr, --gateway, and --dns:

./chausie.sh --action createvm --name test --release 24.04 --vmtype imagecraft \
  --ip 192.168.10.74 --cidr 22 --gateway 192.168.11.254 --dns 8.8.8.8

Build base

Imagecraft builds from the snapcraft multipass remote, which doesn't have an image for every release. The script uses the release itself if available, devel for the development release, and otherwise falls back to 24.04. Override with --buildbase:

./chausie.sh --action createimage --name test --release 26.10 --vmtype imagecraft --buildbase devel

Cloud-init

Use --cloudinit (or --options cloudinit) to build an image that relies on cloud-init rather than a baked-in root password and netplan config. The image name includes -cloudinit, and the VM is created with a cloud-init seed disk:

./chausie.sh --action createvm --name test --release 24.04 --vmtype imagecraft --cloudinit \
  --sshkeyfile ~/.ssh/id_rsa.pub

The cloud-init config location can be changed with --cloudinitfile:

./chausie.sh --action createvm --name test --release 24.04 --vmtype imagecraft --cloudinit \
  --cloudinitfile /tmp/test.cloud.cfg

Notes

  • Without --cloudinit, SSH host keys are regenerated in the VM disk when the VM is created, so VMs from the same image don't share them.
  • Without --cloudinit, the root user has the default password (ubuntulinux).
  • If the host osinfo-db doesn't know the release, the newest Ubuntu OS variant it knows is used for virt-install.

Clone this wiki locally