Cooking a Debian System: One, Two, Debos! - Ana Guerrero López, Collabora [Open Source Summit EU 2018]

Debos creates Debian images.

Debos is a tool written in Go to create Debian (or derivative) images. Images can be disk images, container images, etc. Images are created according to a recipe file. Goal is to be easily integratable in a CI system. It is modular, so easy to implement new actions.

Recipe file is a YAML file with templating. It runs on Debian, or on non-Debian in a container.

Build is done in Qemu so only the intersection of Qemu and Debian architectures is supported. Qemu is spawned by the fakemachine library. It sets up qemu-system machine using the host’s /usr. In that qemu, you can be root, so debos can use that to use debootstrap for foreign architecture. qemu-user is later used to run things on the target system. Note that debos is not a build system, so you first have to build your .deb files before you can create an image out of them with debos.

Note that many other tools exist for creating Debian images, including debian-installer which is the official one for creating installation media.

One user is Apertis, a Debian/Ubuntu derivative tailored towards automotive. Apertis uses debos to create its images.

KernelCI uses debos to create the rootfs for the kernel under test.

The debos yaml file specifies the target architecture and a list of actions to perform. The actions at least include a debootstrap step (to create the rootfs) and a pack step (to create the image). To be able to reuse the same yaml file for different targets or configurations, the Go templating language is used. Before parsing the yaml, the templates are expanded. The templates allow to specify defaults, conditions.

Currently 12 actions exist: debootstrap for creating the base system (it uses a chroot, hence the need to be root and to run in qemu-system); apt to install packages; download to download something to be used later; overlay copies file into the target; run to run a script inside the target or fakemachine, with environment variables to specify paths; image-partition and filesystem-deploy to create parts of the image.

There is no roadmap for future development, but a few ideas exist for adding new actions. Also improving the documentation is a continuous process.

If you need multiple sources, you can just update the sources.list after debootstrap in a run action and run apt update. To install custom packages, you can follow that route or manually dpkg -i them, or skip the packaging step entirely and directly copy in from an overlay.