Distrobuilder Menu - custom image builder (incus compatible)

About a year ago after building custom LXD images with Hashicorp’s Packer stopped working I started writing distrobuilder-menu to make it easier to build custom LXD / LXC images:

The distrobuilder-menu README should be clear enough to get most users up & running.

I provide examples to build images that incorporate shell customization & cloud-init configuration:

  • Alpine Linux & Ubuntu base images
  • Alpine Linux build environment (alpine-sdk installed on first boot - & cloud-init removed on first boot)
  • Ubuntu Gitlab container (Gitlab installed on first boot)

dbmenu follows a similar methodology to Packer with the idea being that you create:

  • base image (that overrides a standard distrobuilder image - with shell customization’s etc you would like in every image)
  • service image (with web services etc - that uses your base image as the source template)

Under the hood dbmenu uses the Go version of yq to merge template overrides & standard cloud-init yaml into an existing template (using PyYaml for merging did not give good results)

I added incus compatibility recently so dbmenu should work for everyone.

  • Installation as an isolated app should always work (pipx is how I install at the moment):

  • pipx install git+https://github.com/itoffshore/distrobuilder-menu.git


Updating LXD version data: /home/stuart/devops/distrobuilder/templates/lxd.json ... 
Caching JSON data to: /home/stuart/devops/distrobuilder/templates/cache.json
Wrote configuration as json to: /home/stuart/devops/distrobuilder/templates/cache.json

Querying the Github REST API: https://api.github.com/repos/lxc/lxc-ci/contents/images

Downloading:
 https://raw.githubusercontent.com/lxc/lxc-ci/main/images/nixos.yaml
 Saved to: ==> /home/stuart/devops/distrobuilder/templates/images/nixos.yaml

Downloading:
 https://raw.githubusercontent.com/lxc/lxc-ci/main/images/openwrt.yaml
 Saved to: ==> /home/stuart/devops/distrobuilder/templates/images/openwrt.yaml
  • custom templates are now auto regenerated as part of the standard template update / downloads (since v0.2.1)

  • Empty input from every menu / choice returns you to the main menu (main event loop).


Hopefully you find dbmenu useful:

Comments / criticism welcome - there’s always room for improvements ;o)

6 Likes

1 Like
  • automatic custom template regeneration incorporated into standard template downloads in v0.2.1

  • see the README for a screenshot

1 Like

Thank you so much for your library!

1 Like

Thanks for testing - dbmenu is now installable from pypi:

pipx || pip install distrobuilder-menu

1 Like

App updates added in version 0.2.5 via pipx or pip

  • just run: dbmenu -v

1 Like

2 more small updates today:


& an improvement for Arch Linux the following day

  • version 0.2.8 adds Arch Linux package detection (so that dbmenu -v does not offer to update with pip / pipx) - & instead displays the latest version in AUR.
2 Likes

How can I use this to create a Kali VM image? There is only a Kali container image.
But Incus now supports USB Passthrough with VMs as well, so it makes sense for a Kali VM.

dbmenu effectively builds the options on https://images.linuxcontainers.org/ (it parses the json response lxd / incus receives from there) - & can only build what’s in the template (& kali doesn’t have a vm image)

dbmenu-kali

Thanks for this.
I will try to get in contact with the person that made the Kali container image. On which repository can I find the Kali distrobuilder configuration?

dbmenu downloads the templates from:

Adding a vm option to kali.yaml would be the best option.

You could also create a custom template with dbmenu & add in the vm config from the Debian template (& manually run the generated distrobuilder command from “Build Image” as I think it will be missing the --vm option in this particular case)

dbmenu currently gets the build options (lxc / lxd / vm) from the json. Calculating these from the yaml would allow custom templates without a vm option to be tested.

1 Like

version 0.2.9 adds incus is required message for building the phased out templates no longer possible under LXD.

incus-is-required

2 Likes